<!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"/><title>API Error Handling and Debugging - Complete Guide</title><meta name="description" content="API Errors and Debugging"/><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/api_reference/errors-and-debugging"/><link rel="alternate" type="application/xml" href="/docs/sitemap.xml"/><link rel="alternate" type="text/markdown" href="/docs/api_reference/errors-and-debugging.md"/><meta property="og:title" content="API Error Handling and Debugging - Complete Guide"/><meta property="og:description" content="Learn how to handle errors and debug requests in OpenRouter API interactions. Comprehensive guide to error codes, messages, debugging options, and best practices."/><meta property="og:url" content="https://openrouter.ai/docs/api_reference/errors-and-debugging"/><meta property="og:site_name" content="OpenRouter Documentation"/><meta property="og:image" content="https://openrouter.ai/dynamic-og?title=API%20Error%20Handling%20and%20Debugging&amp;description=Learn%20how%20to%20handle%20errors%20and%20debug%20requests%20in%20OpenRouter%20API%20interactions."/><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="API Error Handling and Debugging - Complete Guide"/><meta name="twitter:description" content="Learn how to handle errors and debug requests in OpenRouter API interactions. Comprehensive guide to error codes, messages, debugging options, and best practices."/><meta name="twitter:image" content="https://openrouter.ai/dynamic-og?title=API%20Error%20Handling%20and%20Debugging&amp;description=Learn%20how%20to%20handle%20errors%20and%20debug%20requests%20in%20OpenRouter%20API%20interactions."/><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)"/><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"/><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>API Guides</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">Errors and Debugging</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 text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-300" 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 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 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/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 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/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/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><h3 class="sidebar-title text-[length:inherit] font-[inherit] leading-[inherit]"><span>API Guides</span></h3></div><ul class="sidebar-group space-y-px"><li id="/api_reference/overview" class="relative scroll-m-4 first:scroll-m-20" data-title="Overview"><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/api_reference/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/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></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">Overview</span></div></div></a></li><li id="/api_reference/streaming" class="relative scroll-m-4 first:scroll-m-20" data-title="Streaming"><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/api_reference/streaming"><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/bars-staggered.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/bars-staggered.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">Streaming</span></div></div></a></li><li id="/api_reference/embeddings" class="relative scroll-m-4 first:scroll-m-20" data-title="Embeddings"><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/api_reference/embeddings"><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/draw-square.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/draw-square.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">Embeddings</span></div></div></a></li><li id="/api_reference/limits" class="relative scroll-m-4 first:scroll-m-20" data-title="Limits"><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/api_reference/limits"><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">Limits</span></div></div></a></li><li id="/api_reference/authentication" class="relative scroll-m-4 first:scroll-m-20" data-title="Authentication"><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/api_reference/authentication"><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">Authentication</span></div></div></a></li><li id="/api_reference/parameters" class="relative scroll-m-4 first:scroll-m-20" data-title="Parameters"><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/api_reference/parameters"><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/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/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">Parameters</span></div></div></a></li><li id="/api_reference/errors-and-debugging" class="relative scroll-m-4 first:scroll-m-20" data-title="Errors and Debugging" 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/api_reference/errors-and-debugging"><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/triangle-exclamation.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/triangle-exclamation.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">Errors and Debugging</span></div></div></a></li><li data-title="Responses API" 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/reply.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/reply.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></div><div class=""><span>Responses API</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/code-branch.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-branch.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg><h3 class="sidebar-title text-[length:inherit] font-[inherit] leading-[inherit]"><span>Versioning</span></h3></div><ul class="sidebar-group space-y-px"><li id="/api_reference/versioning" class="relative scroll-m-4 first:scroll-m-20" data-title="API Versioning"><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/api_reference/versioning"><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-branch.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-branch.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">API Versioning</span></div></div></a></li><li id="/changelog" class="relative scroll-m-4 first:scroll-m-20" data-title="API Changelog"><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/changelog"><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/clock-rotate-left.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/regular/clock-rotate-left.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">API Changelog</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/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><h3 class="sidebar-title text-[length:inherit] font-[inherit] leading-[inherit]"><span>API Reference</span></h3></div><ul class="sidebar-group space-y-px"><li data-title="Analytics" 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=""><span>Analytics</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="TTS" 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=""><span>TTS</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="STT" 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=""><span>STT</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="OAuth" 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=""><span>OAuth</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="Benchmarks" 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=""><span>Benchmarks</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="BYOK" 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=""><span>BYOK</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="Chat" 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=""><span>Chat</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="Classifications" 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=""><span>Classifications</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="Credits" 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=""><span>Credits</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="Datasets" 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=""><span>Datasets</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="Embeddings" 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=""><span>Embeddings</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="Endpoints" 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=""><span>Endpoints</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="Generations" 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=""><span>Generations</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="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=""><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 data-title="Images" 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=""><span>Images</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="API Keys" 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=""><span>API Keys</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="Anthropic Messages" 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=""><span>Anthropic Messages</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="Models" 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=""><span>Models</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="Observability" 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=""><span>Observability</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="Organization" 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=""><span>Organization</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="Presets" 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=""><span>Presets</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="Providers" 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=""><span>Providers</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="Rerank" 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=""><span>Rerank</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="Responses" 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=""><span>Responses</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="SCIM" 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=""><span>SCIM</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="Video Generation" 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=""><span>Video Generation</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="Workspaces" 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=""><span>Workspaces</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><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/api_reference/errors-and-debugging#webpage","url":"https://openrouter.ai/docs/api_reference/errors-and-debugging","name":"Errors and Debugging","description":"API Errors and Debugging","dateModified":"2026-08-20T02:29:13.005Z","isPartOf":{"@id":"https://openrouter.ai/docs#website"},"breadcrumb":{"@id":"https://openrouter.ai/docs/api_reference/errors-and-debugging#breadcrumb"}},{"@type":"BreadcrumbList","@id":"https://openrouter.ai/docs/api_reference/errors-and-debugging#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"API Guides","item":"https://openrouter.ai/docs/api_reference/overview"},{"@type":"ListItem","position":2,"name":"Errors and Debugging","item":"https://openrouter.ai/docs/api_reference/errors-and-debugging"}]},{"@type":["Article","TechArticle"],"@id":"https://openrouter.ai/docs/api_reference/errors-and-debugging#article","headline":"Errors and Debugging","name":"Errors and Debugging","description":"API Errors and Debugging","url":"https://openrouter.ai/docs/api_reference/errors-and-debugging","mainEntityOfPage":{"@id":"https://openrouter.ai/docs/api_reference/errors-and-debugging#webpage"},"image":"https://openrouter.ai/dynamic-og?title=API%20Error%20Handling%20and%20Debugging&description=Learn%20how%20to%20handle%20errors%20and%20debug%20requests%20in%20OpenRouter%20API%20interactions.","dateModified":"2026-08-20T02:29:13.005Z","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="#error-codes" 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]">Error codes</a></li><li class="toc-item relative" data-depth="0"><a style="--toc-padding-left:0rem" href="#retry-after-header" 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]">Retry-After header</a></li><li class="toc-item relative" data-depth="0"><a style="--toc-padding-left:0rem" href="#moderation-errors" 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]">Moderation errors</a></li><li class="toc-item relative" data-depth="0"><a style="--toc-padding-left:0rem" href="#guardrail-errors" 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]">Guardrail errors</a></li><li class="toc-item relative" data-depth="0"><a style="--toc-padding-left:0rem" href="#provider-errors" 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]">Provider errors</a><ul class=""><li class="toc-item relative" data-depth="1"><a style="--toc-padding-left:1rem" href="#masking-and-raw-provider-details" 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">Masking and raw provider details</a></li></ul></li><li class="toc-item relative" data-depth="0"><a style="--toc-padding-left:0rem" href="#when-no-content-is-generated" 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]">When no content is generated</a></li><li class="toc-item relative" data-depth="0"><a style="--toc-padding-left:0rem" href="#streaming-error-formats" 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]">Streaming error formats</a><ul class=""><li class="toc-item relative" data-depth="1"><a style="--toc-padding-left:1rem" href="#pre-stream-errors" 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">Pre-stream errors</a></li><li class="toc-item relative" data-depth="1"><a style="--toc-padding-left:1rem" href="#mid-stream-errors" 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">Mid-stream errors</a></li></ul></li><li class="toc-item relative" data-depth="0"><a style="--toc-padding-left:0rem" href="#typed-error-codes" 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]">Typed error codes</a><ul class=""><li class="toc-item relative" data-depth="1"><a style="--toc-padding-left:1rem" href="#token-and-length-limits" 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">Token and length limits</a></li><li class="toc-item relative" data-depth="1"><a style="--toc-padding-left:1rem" href="#authentication-and-authorization" 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">Authentication and authorization</a></li><li class="toc-item relative" data-depth="1"><a style="--toc-padding-left:1rem" href="#rate-limiting-and-availability" 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">Rate limiting and availability</a></li><li class="toc-item relative" data-depth="1"><a style="--toc-padding-left:1rem" href="#request-validation" 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">Request validation</a></li><li class="toc-item relative" data-depth="1"><a style="--toc-padding-left:1rem" href="#content-policy" 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">Content policy</a></li><li class="toc-item relative" data-depth="1"><a style="--toc-padding-left:1rem" href="#image-errors" 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">Image errors</a></li><li class="toc-item relative" data-depth="1"><a style="--toc-padding-left:1rem" href="#generic" 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">Generic</a></li></ul></li><li class="toc-item relative" data-depth="0"><a style="--toc-padding-left:0rem" href="#model-availability-errors" 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]">Model availability errors</a><ul class=""><li class="toc-item relative" data-depth="1"><a style="--toc-padding-left:1rem" href="#availability-codes" 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">Availability codes</a></li><li class="toc-item relative" data-depth="1"><a style="--toc-padding-left:1rem" href="#the-availability-object" 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">The availability object</a></li><li class="toc-item relative" data-depth="1"><a style="--toc-padding-left:1rem" href="#retrying-with-retry_after" 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">Retrying with retry_after</a></li><li class="toc-item relative" data-depth="1"><a style="--toc-padding-left:1rem" href="#using-fallback_models-suggestions" 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">Using fallback_models suggestions</a></li><li class="toc-item relative" data-depth="1"><a style="--toc-padding-left:1rem" href="#example-availability-error-payloads" 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 availability error payloads</a></li></ul></li><li class="toc-item relative" data-depth="0"><a style="--toc-padding-left:0rem" href="#skin-specific-error-formats" 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]">Skin-specific error formats</a><ul class=""><li class="toc-item relative" data-depth="1"><a style="--toc-padding-left:1rem" href="#chat-completions-%2Fapi%2Fv1%2Fchat%2Fcompletions" 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">Chat Completions (/api/v1/chat/completions)</a></li><li class="toc-item relative" data-depth="1"><a style="--toc-padding-left:1rem" href="#responses-api-%2Fapi%2Fv1%2Fresponses" 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">Responses API (/api/v1/responses)</a></li><li class="toc-item relative" data-depth="2"><a style="--toc-padding-left:2rem" href="#error-code-transformations" 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">Error code transformations</a></li><li class="toc-item relative" data-depth="1"><a style="--toc-padding-left:1rem" href="#anthropic-messages-%2Fapi%2Fv1%2Fmessages" 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">Anthropic Messages (/api/v1/messages)</a></li></ul></li><li class="toc-item relative" data-depth="0"><a style="--toc-padding-left:0rem" href="#debugging" 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]">Debugging</a><ul class=""><li class="toc-item relative" data-depth="1"><a style="--toc-padding-left:1rem" href="#debug-option-shape" 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">Debug option shape</a></li><li class="toc-item relative" data-depth="1"><a style="--toc-padding-left:1rem" href="#usage" 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">Usage</a></li><li class="toc-item relative" data-depth="2"><a style="--toc-padding-left:2rem" href="#chat-completions" 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">Chat Completions</a></li><li class="toc-item relative" data-depth="2"><a style="--toc-padding-left:2rem" href="#responses-api" 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">Responses API</a></li><li class="toc-item relative" data-depth="1"><a style="--toc-padding-left:1rem" href="#debug-response-format" 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">Debug response format</a></li><li class="toc-item relative" data-depth="2"><a style="--toc-padding-left:2rem" href="#chat-completions-2" 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">Chat Completions</a></li><li class="toc-item relative" data-depth="2"><a style="--toc-padding-left:2rem" href="#responses-api-2" 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">Responses API</a></li><li class="toc-item relative" data-depth="1"><a style="--toc-padding-left:1rem" href="#important-notes" 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">Important notes</a></li><li class="toc-item relative" data-depth="1"><a style="--toc-padding-left:1rem" href="#use-cases" 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">Use cases</a></li><li class="toc-item relative" data-depth="1"><a style="--toc-padding-left:1rem" href="#privacy-and-redaction" 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">Privacy and redaction</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">API Guides</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">Errors and Debugging</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>API Errors and Debugging</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="Errors and Debugging" data-page-href="/api_reference/errors-and-debugging" id="content"><span data-as="p">For errors, OpenRouter returns a JSON response with the following shape:</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="7" 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_1ta0cllktbsnlhjiuasnpfiutb_" 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_1ua0cllktbsnlhjiuasnpfiutb_" 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_1va0cllktbsnlhjiuasnpfiutb_" 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-type_ErrorResponse__"><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_1i0cllktbsnlhjiuasnpfiutb_-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="7"><span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">type</span><span style="color:#953800;--shiki-dark:#4EC9B0"> ErrorResponse</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> =</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> {</span></span>
<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">  error</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">:</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> {</span></span>
<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">    code</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">:</span><span style="color:#0550AE;--shiki-dark:#4EC9B0"> number</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">;</span></span>
<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">    message</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">:</span><span style="color:#0550AE;--shiki-dark:#4EC9B0"> string</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">;</span></span>
<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">    metadata</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">?:</span><span style="color:#953800;--shiki-dark:#4EC9B0"> Record</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">&lt;</span><span style="color:#0550AE;--shiki-dark:#4EC9B0">string</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#0550AE;--shiki-dark:#4EC9B0">unknown</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">&gt;;</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>
<span data-as="p">The HTTP Response will have the same status code as <code>error.code</code>, forming a request error if:</span>
<ul>
<li>Your original request is invalid</li>
<li>Your API key/account is out of credits</li>
</ul>
<span data-as="p">Otherwise, the returned HTTP response status will be <!-- --> and any error occurred while the LLM is producing the output will be emitted in the response body or as an SSE data event.</span>
<span data-as="p">Example code for printing errors in JavaScript:</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="5" 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_1ta1kllktbsnlhjiuasnpfiutb_" 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_1ua1kllktbsnlhjiuasnpfiutb_" 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_1va1kllktbsnlhjiuasnpfiutb_" 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_request___awai"><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_1i1kllktbsnlhjiuasnpfiutb_-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="5"><span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">const</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> request</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;https://openrouter.ai/...&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">);</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">console</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#8250DF;--shiki-dark:#DCDCAA">log</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">request</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">status</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">); </span><span style="color:#6E7781;--shiki-dark:#6A9955">// Will be an error code unless the model started processing your request</span></span>
<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">const</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> response</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"> request</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#8250DF;--shiki-dark:#DCDCAA">json</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">();</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">console</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#8250DF;--shiki-dark:#DCDCAA">error</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">response</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">error</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">?.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">code</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">); </span><span style="color:#6E7781;--shiki-dark:#6A9955">// Will be an error code</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">console</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#8250DF;--shiki-dark:#DCDCAA">error</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">response</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">error</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">?.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">message</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>
<h2 class="flex whitespace-pre-wrap group font-semibold" id="error-codes"><div class="absolute" tabindex="-1"><a href="#error-codes" 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">Error codes</span></h2>
<ul>
<li>: Bad Request (invalid or missing params, CORS)</li>
<li>: Invalid credentials (OAuth session expired, disabled/invalid API key)</li>
<li>: Your account or API key has insufficient credits. Add more credits and retry the request.</li>
<li>: Forbidden (insufficient permissions, guardrail block, or moderation flag)</li>
<li>: Your request timed out</li>
<li>: You are being rate limited</li>
<li>: Your chosen model is down or we received an invalid response from it</li>
<li>: There is no available model provider that meets your routing requirements</li>
</ul>
<h2 class="flex whitespace-pre-wrap group font-semibold" id="retry-after-header"><div class="absolute" tabindex="-1"><a href="#retry-after-header" 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">Retry-After header</span></h2>
<span data-as="p">On <!-- --> and <!-- --> responses, OpenRouter may include a standard HTTP <code>Retry-After</code> response header indicating how many seconds to wait before retrying.</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="http"><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_1ta2sllktbsnlhjiuasnpfiutb_" 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_1ua2sllktbsnlhjiuasnpfiutb_" 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_1va2sllktbsnlhjiuasnpfiutb_" 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-http-code-HTTP_1_1_429_Too_Man"><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_1i2sllktbsnlhjiuasnpfiutb_-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="http"><code language="http" numberOfLines="2"><span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">HTTP</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">/</span><span style="color:#0550AE;--shiki-dark:#B5CEA8">1.1</span><span style="color:#0550AE;--shiki-dark:#B5CEA8"> 429</span><span style="color:#0A3069;--shiki-dark:#CE9178"> Too Many Requests</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#569CD6">Retry-After</span><span style="color:#CF222E;--shiki-dark:#569CD6">:</span><span style="color:#0A3069;--shiki-dark:#CE9178"> 60</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">The OpenAI SDK, Anthropic SDK, Vercel AI SDK, and OpenRouter SDK already respect this header for backoff. If you’re using <code>fetch</code> directly, honor it before retrying:</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="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_1ta3cllktbsnlhjiuasnpfiutb_" 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_1ua3cllktbsnlhjiuasnpfiutb_" 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_1va3cllktbsnlhjiuasnpfiutb_" 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_res___await_fe"><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_1i3cllktbsnlhjiuasnpfiutb_-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="8"><span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">const</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> res</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;https://openrouter.ai/api/v1/chat/completions&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, { </span><span style="color:#CF222E;--shiki-dark:#D4D4D4">...</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">res</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">status</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> ===</span><span style="color:#0550AE;--shiki-dark:#B5CEA8"> 429</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> ||</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> res</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">status</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> ===</span><span style="color:#0550AE;--shiki-dark:#B5CEA8"> 503</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"> retryAfter</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> =</span><span style="color:#8250DF;--shiki-dark:#DCDCAA"> Number</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">res</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">headers</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#8250DF;--shiki-dark:#DCDCAA">get</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#0A3069;--shiki-dark:#CE9178">&#x27;Retry-After&#x27;</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">Number</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#8250DF;--shiki-dark:#DCDCAA">isFinite</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">retryAfter</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">) </span><span style="color:#CF222E;--shiki-dark:#D4D4D4">&amp;&amp;</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> retryAfter</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> &gt;</span><span style="color:#0550AE;--shiki-dark:#B5CEA8"> 0</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:#CF222E;--shiki-dark:#569CD6"> new</span><span style="color:#0550AE;--shiki-dark:#4EC9B0"> Promise</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">((</span><span style="color:#953800;--shiki-dark:#9CDCFE">r</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">) </span><span style="color:#CF222E;--shiki-dark:#569CD6">=&gt;</span><span style="color:#8250DF;--shiki-dark:#DCDCAA"> setTimeout</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">r</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#1F2328;--shiki-dark:#9CDCFE">retryAfter</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> *</span><span style="color:#0550AE;--shiki-dark:#B5CEA8"> 1000</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">));</span></span>
<span class="line"><span style="color:#6E7781;--shiki-dark:#6A9955">    // retry the request</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>
<h2 class="flex whitespace-pre-wrap group font-semibold" id="moderation-errors"><div class="absolute" tabindex="-1"><a href="#moderation-errors" 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">Moderation errors</span></h2>
<span data-as="p">If your input was flagged, the <code>error.metadata</code> will contain information about the issue. The shape of the metadata is as follows:</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="6" 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_1ta44llktbsnlhjiuasnpfiutb_" 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_1ua44llktbsnlhjiuasnpfiutb_" 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_1va44llktbsnlhjiuasnpfiutb_" 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-type_ModerationError"><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_1i44llktbsnlhjiuasnpfiutb_-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="6"><span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">type</span><span style="color:#953800;--shiki-dark:#4EC9B0"> ModerationErrorMetadata</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> =</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> {</span></span>
<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">  reasons</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">:</span><span style="color:#0550AE;--shiki-dark:#4EC9B0"> string</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">[]; </span><span style="color:#6E7781;--shiki-dark:#6A9955">// Why your input was flagged</span></span>
<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">  flagged_input</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">:</span><span style="color:#0550AE;--shiki-dark:#4EC9B0"> string</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">; </span><span style="color:#6E7781;--shiki-dark:#6A9955">// The text segment that was flagged, limited to 100 characters. If the flagged input is longer than 100 characters, it will be truncated in the middle and replaced with ...</span></span>
<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">  provider_name</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">:</span><span style="color:#0550AE;--shiki-dark:#4EC9B0"> string</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">; </span><span style="color:#6E7781;--shiki-dark:#6A9955">// The name of the provider that requested moderation</span></span>
<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">  model_slug</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">:</span><span style="color:#0550AE;--shiki-dark:#4EC9B0"> string</span><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>
<h2 class="flex whitespace-pre-wrap group font-semibold" id="guardrail-errors"><div class="absolute" tabindex="-1"><a href="#guardrail-errors" 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">Guardrail errors</span></h2>
<span data-as="p">On inference endpoints (<code>/chat/completions</code>, <code>/responses</code>, <code>/messages</code>), a request can be blocked before it reaches a provider — for example by a content filter or prompt-injection detector configured via <a class="link" href="/docs/guides/features/guardrails">guardrails</a>. When this happens, the response is a <code>403</code> with a message describing the block reason. The OpenRouter-shaped body below applies to <code>/chat/completions</code> and <code>/responses</code>; on <code>/messages</code> the block is returned as an Anthropic <code>permission_error</code> envelope (see <a href="#anthropic-messages-apiv1messages" class="link">Anthropic Messages</a> below), with <code>openrouter_metadata</code> still carried at the top level when opted in:</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="9" 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_1ta4sllktbsnlhjiuasnpfiutb_" 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_1ua4sllktbsnlhjiuasnpfiutb_" 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_1va4sllktbsnlhjiuasnpfiutb_" 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-_____error__________"><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_1i4sllktbsnlhjiuasnpfiutb_-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="9"><span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">{</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">  &quot;error&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">    &quot;code&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0550AE;--shiki-dark:#B5CEA8">403</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">    &quot;message&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;Request blocked: prompt injection patterns detected&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">    &quot;metadata&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;patterns&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: [</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;ignore all previous instructions&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>
</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 you opt in to <a class="link" href="/docs/guides/features/router-metadata">router metadata</a> via the <code>X-OpenRouter-Experimental-Metadata: enabled</code> header, the 403 response also includes the full <code>openrouter_metadata</code> object with routing context and a <code>pipeline</code> array detailing the guardrail stages that ran:</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="38" 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_1ta5cllktbsnlhjiuasnpfiutb_" 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_1ua5cllktbsnlhjiuasnpfiutb_" 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_1va5cllktbsnlhjiuasnpfiutb_" 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-_____error__________"><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_1i5cllktbsnlhjiuasnpfiutb_-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="38"><span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">{</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">  &quot;error&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">    &quot;code&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0550AE;--shiki-dark:#B5CEA8">403</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">    &quot;message&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;Request blocked: prompt injection patterns detected&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">    &quot;metadata&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;patterns&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: [</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;ignore all previous instructions&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:#116329;--shiki-dark:#9CDCFE">  &quot;openrouter_metadata&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">    &quot;requested&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;openai/gpt-4o&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">    &quot;strategy&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;direct&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">    &quot;region&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;iad&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">    &quot;summary&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;available=1&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">    &quot;attempt&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0550AE;--shiki-dark:#B5CEA8">1</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">    &quot;is_byok&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>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">    &quot;endpoints&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;total&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0550AE;--shiki-dark:#B5CEA8">1</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;available&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: [</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">        { </span><span style="color:#116329;--shiki-dark:#9CDCFE">&quot;provider&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;OpenAI&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><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;openai/gpt-4o&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#116329;--shiki-dark:#9CDCFE">&quot;selected&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>
<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;pipeline&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;guardrail&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;regex_pi_detection&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">        &quot;guardrail_id&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;grd_abc123&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">        &quot;guardrail_scope&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;api-key&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">        &quot;summary&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;Blocked: prompt injection detected (1 pattern matched)&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">        &quot;data&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">          &quot;action&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;blocked&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">          &quot;detected&quot;</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:#116329;--shiki-dark:#9CDCFE">          &quot;engines&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: [</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;regex&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">],</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">          &quot;patterns&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: [</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;ignore all previous instructions&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 38 lines</button></div></div>
<span data-as="p">The <code>openrouter_metadata</code> object follows the same shape as on successful responses — see <a class="link" href="/docs/guides/features/router-metadata#pipeline-stages">Pipeline Stages</a> for the full stage type and field reference.</span>
<h2 class="flex whitespace-pre-wrap group font-semibold" id="provider-errors"><div class="absolute" tabindex="-1"><a href="#provider-errors" 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">Provider errors</span></h2>
<span data-as="p">OpenRouter normalizes every upstream provider error into the stable, typed
<code>error_type</code> vocabulary documented under <a href="#typed-error-codes" class="link">Typed Error Codes</a>.
The same <code>error_type</code> values describe what went wrong whether the provider
error arrives in a non-streaming response body or as a mid-stream SSE event.
Native protocol codes (the Anthropic <code>error.type</code>, the Responses <code>error.code</code>)
are best-effort and can differ between formats — <code>error_type</code> is the field to
rely on across all of them.</span>
<span data-as="p">For Chat Completions, a provider error that interrupts generation carries
<code>error_type</code> inside <code>error.metadata</code>:</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="10" 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_1ta6kllktbsnlhjiuasnpfiutb_" 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_1ua6kllktbsnlhjiuasnpfiutb_" 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_1va6kllktbsnlhjiuasnpfiutb_" 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-_____error__________"><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_1i6kllktbsnlhjiuasnpfiutb_-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="10"><span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">{</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">  &quot;error&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">    &quot;code&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0550AE;--shiki-dark:#B5CEA8">429</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">    &quot;message&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;Rate limit exceeded&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">    &quot;metadata&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;error_type&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;rate_limit_exceeded&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;provider_code&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;rate_limited&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>
</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">The same value is carried on mid-stream errors and on the Anthropic and
Responses skins — see <a href="#skin-specific-error-formats" class="link">Skin-Specific Error Formats</a>
for the exact wire location in each format.</span>
<h3 class="flex whitespace-pre-wrap group font-semibold" id="masking-and-raw-provider-details"><div class="absolute" tabindex="-1"><a href="#masking-and-raw-provider-details" 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">Masking and raw provider details</span></h3>
<span data-as="p">When a request fails with a <code>500</code>, the <code>message</code> is replaced with a generic
string and <code>provider_code</code> and <code>openrouter_metadata</code> are omitted, but
<code>error_type</code> is still present (<code>server</code>).</span>
<span data-as="p">For non-500 errors, the upstream provider’s own error code is surfaced in
<code>error.metadata.provider_code</code> when available. Opt-in routing context (which
provider was selected, fallback attempts, etc.) is carried in the
<code>openrouter_metadata</code> object when the request sets <code>X-OpenRouter-Metadata</code>
— it follows the same shape as on successful responses (routing-summary
fields only; see
<a class="link" href="/docs/guides/features/router-metadata#pipeline-stages">Pipeline Stages</a>).</span>
<h2 class="flex whitespace-pre-wrap group font-semibold" id="when-no-content-is-generated"><div class="absolute" tabindex="-1"><a href="#when-no-content-is-generated" 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">When no content is generated</span></h2>
<span data-as="p">Occasionally, the model may not generate any content. This typically occurs when:</span>
<ul>
<li>The model is warming up from a cold start</li>
<li>The system is scaling up to handle more requests</li>
</ul>
<span data-as="p">Warm-up times usually range from a few seconds to a few minutes, depending on the model and provider.</span>
<span data-as="p">If you encounter persistent no-content issues, consider implementing a simple retry mechanism or trying again with a different provider or model that has more recent activity.</span>
<span data-as="p">In some cases, you may still be charged for the prompt processing cost by the upstream provider, even if no content is generated.</span>
<h2 class="flex whitespace-pre-wrap group font-semibold" id="streaming-error-formats"><div class="absolute" tabindex="-1"><a href="#streaming-error-formats" 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 error formats</span></h2>
<span data-as="p">When using streaming mode (<code>stream: true</code>), errors are handled differently depending on when they occur:</span>
<h3 class="flex whitespace-pre-wrap group font-semibold" id="pre-stream-errors"><div class="absolute" tabindex="-1"><a href="#pre-stream-errors" 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">Pre-stream errors</span></h3>
<span data-as="p">Errors that occur before any tokens are sent follow the standard error format above, with appropriate HTTP status codes. At this stage the HTTP response hasn’t been committed yet, so OpenRouter can:</span>
<ul>
<li>Return a proper HTTP error status (4xx/5xx)</li>
<li>Silently retry with a different provider endpoint if <a class="link" href="/docs/guides/routing/provider-selection">fallback routing</a> is enabled</li>
<li>Apply rate-limit or auth checks before any work begins</li>
</ul>
<span data-as="p">You’ll see pre-stream errors for issues like invalid API keys, malformed requests, or when every available provider endpoint is exhausted before streaming starts.</span>
<h3 class="flex whitespace-pre-wrap group font-semibold" id="mid-stream-errors"><div class="absolute" tabindex="-1"><a href="#mid-stream-errors" 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">Mid-stream errors</span></h3>
<span data-as="p">Once the first token has been written to the client, the HTTP <code>200 OK</code> status and headers are already committed — they can’t be changed. If the provider fails at this point, OpenRouter <strong>cannot</strong> silently fail over to another provider because partial content has already been delivered to your application. The error must arrive in-band as an SSE event.</span>
<span data-as="p">Common causes of mid-stream errors:</span>
<ul>
<li><strong>Provider disconnect</strong> — the upstream connection drops after partial output (network issue, provider crash, load balancer timeout)</li>
<li><strong>Provider timeout</strong> — the model stops responding mid-generation and the read deadline expires</li>
<li><strong>Token limit hit during generation</strong> — the model reaches <code>max_tokens</code> or the context window fills up while producing output</li>
<li><strong>Output content filter</strong> — a content moderation system flags generated text after some of it was already streamed</li>
<li><strong>Provider overload</strong> — the upstream returns a rate-limit or capacity error after beginning to stream</li>
</ul>
<div role="note" aria-label="Note" class="callout my-4 px-5 py-4 overflow-hidden rounded-2xl flex gap-3 border border-blue-200 bg-blue-50 dark:border-blue-900 dark:bg-blue-600/20" data-callout-type="note"><div class="mt-0.5 w-4" data-component-part="callout-icon"><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 text-blue-800 dark:text-blue-300"><path d="M 9 1.6714 C 13.0371 1.6714 16.3286 4.9629 16.3286 9 C 16.3286 13.0371 13.0371 16.3286 9 16.3286 C 7.0574 16.3252 5.1953 15.552 3.8217 14.1783 C 2.448 12.8047 1.6748 10.9426 1.6714 9 C 1.6714 4.9629 4.9629 1.6714 9 1.6714 Z M 9 0 C 4.0371 0 0 4.0371 0 9 C 0 13.9629 4.0371 18 9 18 C 13.9629 18 18 13.9629 18 9 C 18 4.0371 13.9629 0 9 0 Z M 10.2857 3.8571 H 7.7143 V 10.2857 H 10.2857 V 3.8571 Z M 10.2857 11.5714 H 7.7143 V 14.1429 H 10.2857 V 11.5714 Z" fill="currentColor" stroke="none" fill-rule="evenodd" clip-rule="evenodd"></path></svg></div><div class="text-sm prose dark:prose-invert min-w-0 w-full [&amp;_kbd]:bg-background-light dark:[&amp;_kbd]:bg-background-dark [&amp;_code]:text-current! [&amp;_kbd]:text-current! [&amp;_a]:text-current! [&amp;_a]:border-current [&amp;_strong]:text-current! text-blue-800 dark:text-blue-300" data-component-part="callout-content"><span data-as="p">If an error occurs before any tokens are written — even on a streaming request — OpenRouter can still retry with a backup provider transparently. Mid-stream errors only happen when partial content has already been committed to your stream, making failover impossible.</span></div></div>
<span data-as="p">Mid-stream errors are sent as Server-Sent Events (SSE) with a unified structure that includes both the error details and a completion choice:</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="21" 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_1taccllktbsnlhjiuasnpfiutb_" 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_1uaccllktbsnlhjiuasnpfiutb_" 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_1vaccllktbsnlhjiuasnpfiutb_" 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-type_MidStreamError_"><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_1iccllktbsnlhjiuasnpfiutb_-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="21"><span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">type</span><span style="color:#953800;--shiki-dark:#4EC9B0"> MidStreamError</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> =</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> {</span></span>
<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">  id</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">:</span><span style="color:#0550AE;--shiki-dark:#4EC9B0"> string</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">;</span></span>
<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">  object</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">:</span><span style="color:#0A3069;--shiki-dark:#CE9178"> &#x27;chat.completion.chunk&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">;</span></span>
<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">  created</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">:</span><span style="color:#0550AE;--shiki-dark:#4EC9B0"> number</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">;</span></span>
<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">  model</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">:</span><span style="color:#0550AE;--shiki-dark:#4EC9B0"> string</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">;</span></span>
<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">  provider</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">:</span><span style="color:#0550AE;--shiki-dark:#4EC9B0"> string</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">;</span></span>
<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">  error</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">:</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> {</span></span>
<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">    code</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">:</span><span style="color:#0550AE;--shiki-dark:#4EC9B0"> number</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">;       </span><span style="color:#6E7781;--shiki-dark:#6A9955">// HTTP status code (e.g. 400, 429, 502)</span></span>
<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">    message</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">:</span><span style="color:#0550AE;--shiki-dark:#4EC9B0"> string</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">;</span></span>
<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">    metadata</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">?:</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> {</span></span>
<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">      error_type</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">:</span><span style="color:#0550AE;--shiki-dark:#4EC9B0"> string</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">;     </span><span style="color:#6E7781;--shiki-dark:#6A9955">// Typed error code — see table below</span></span>
<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">      provider_code</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">?:</span><span style="color:#0550AE;--shiki-dark:#4EC9B0"> string</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">; </span><span style="color:#6E7781;--shiki-dark:#6A9955">// Original upstream error code (omitted on 500s)</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:#953800;--shiki-dark:#9CDCFE">  choices</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">:</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> [{</span></span>
<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">    index</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">:</span><span style="color:#0550AE;--shiki-dark:#B5CEA8"> 0</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">;</span></span>
<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">    delta</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">:</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> { </span><span style="color:#953800;--shiki-dark:#9CDCFE">content</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">:</span><span style="color:#0A3069;--shiki-dark:#CE9178"> &#x27;&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> };</span></span>
<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">    finish_reason</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">:</span><span style="color:#0A3069;--shiki-dark:#CE9178"> &#x27;error&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">;</span></span>
<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">    native_finish_reason</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">?:</span><span style="color:#0550AE;--shiki-dark:#4EC9B0"> string</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 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 21 lines</button></div></div>
<span data-as="p">Example SSE data:</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="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_1tacsllktbsnlhjiuasnpfiutb_" 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_1uacsllktbsnlhjiuasnpfiutb_" 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_1vacsllktbsnlhjiuasnpfiutb_" 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-data____id___gen-abc"><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_1icsllktbsnlhjiuasnpfiutb_-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="2"><span class="line"><span>data: {&quot;id&quot;:&quot;gen-abc123&quot;,&quot;object&quot;:&quot;chat.completion.chunk&quot;,&quot;created&quot;:1234567890,&quot;model&quot;:&quot;openai/gpt-4o&quot;,&quot;provider&quot;:&quot;OpenAI&quot;,&quot;error&quot;:{&quot;code&quot;:429,&quot;message&quot;:&quot;Rate limit exceeded&quot;,&quot;metadata&quot;:{&quot;error_type&quot;:&quot;rate_limit_exceeded&quot;}},&quot;choices&quot;:[{&quot;index&quot;:0,&quot;delta&quot;:{&quot;content&quot;:&quot;&quot;},&quot;finish_reason&quot;:&quot;error&quot;}]}</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">Key characteristics:</span>
<ul>
<li>The error appears at the <strong>top level</strong> alongside standard response fields</li>
<li><code>error.metadata.error_type</code> carries a typed code you can switch on programmatically — see <a href="#typed-error-codes" class="link">Typed Error Codes</a> for the full list</li>
<li>A <code>choices</code> array is included with <code>finish_reason: &quot;error&quot;</code> to properly terminate the stream</li>
<li>The HTTP status remains 200 OK since headers were already sent</li>
<li>The stream is terminated after this event</li>
<li>On 500-class errors, <code>error.message</code> is replaced with a generic string and <code>provider_code</code> is omitted to prevent leaking upstream details</li>
</ul>
<h2 class="flex whitespace-pre-wrap group font-semibold" id="typed-error-codes"><div class="absolute" tabindex="-1"><a href="#typed-error-codes" 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">Typed error codes</span></h2>
<span data-as="p">When a provider error reaches your application, OpenRouter tags it with a
canonical <code>error_type</code> string — both on the non-streaming response body and
on mid-stream SSE events. Use this value, not the HTTP status code alone, to
programmatically distinguish error categories. It is stable across all three
API skins even when the native protocol code is lossy.</span>
<span data-as="p">Where <code>error_type</code> appears depends on the skin and path:</span>
<ul>
<li><strong>Chat Completions</strong>: <code>error.metadata.error_type</code> — on the mid-stream error
chunk (see <a href="#mid-stream-errors" class="link">Mid-Stream Errors</a>) and on the non-streaming
response when a provider error interrupts generation.</li>
<li><strong>Anthropic Messages</strong>: <code>error.error_type</code> on the SSE <code>error</code> event and the
non-streaming error envelope.</li>
<li><strong>Responses</strong>: top-level <code>error_type</code> on the failed response, for both the
streaming <code>response.failed</code> event and the non-streaming JSON body.</li>
</ul>
<span data-as="p">The HTTP status each <code>error_type</code> maps to is listed in the tables below.</span>
<h3 class="flex whitespace-pre-wrap group font-semibold" id="token-and-length-limits"><div class="absolute" tabindex="-1"><a href="#token-and-length-limits" 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">Token and length limits</span></h3>
<!-- --><div role="presentation" style="position:relative;--scroll-area-corner-height:0px;--scroll-area-corner-width:0px" data-component-part="scroll-area" data-table-wrapper="true" class="min-w-0 [--page-padding:20px] flex w-[calc(100%+(var(--page-padding)*2))] my-[1em] py-[1em] -mx-(--page-padding) max-w-none [contain:inline-size]"><div role="region" data-id="base-ui-_R_f4llktbsnlhjiuasnpfiutb_-viewport" tabindex="-1" class="size-full rounded-[inherit] [--scroll-area-fade-size:32px] overflow-y-hidden! base-ui-disable-scrollbar" style="overflow:scroll" data-component-part="scroll-area-viewport" aria-label="Scrollable table"><div role="presentation" style="min-width:fit-content" data-component-part="scroll-area-content" class="flex"><div class="px-(--page-padding) grow max-w-none table"><table class="m-0 min-w-full w-full max-w-none table [&amp;_td]:min-w-[150px] [&amp;_th]:text-left [&amp;_td[data-numeric]]:tabular-nums"><thead><tr><th><code>error_type</code></th><th>HTTP Status</th><th>Description</th></tr></thead><tbody><tr><td><code>context_length_exceeded</code></td><td>The combined input and output tokens exceed the model’s context window.</td><td></td></tr><tr><td><code>max_tokens_exceeded</code></td><td>Generation stopped because <code>max_tokens</code> (or <code>max_completion_tokens</code>) was reached.</td><td></td></tr><tr><td><code>token_limit_exceeded</code></td><td>A token budget enforced by OpenRouter (e.g. credit-based cap) was exceeded.</td><td></td></tr><tr><td><code>string_too_long</code></td><td>A single string field in the request (system prompt, user message, etc.) exceeded the provider’s per-field character limit.</td><td></td></tr></tbody></table></div></div></div></div>
<h3 class="flex whitespace-pre-wrap group font-semibold" id="authentication-and-authorization"><div class="absolute" tabindex="-1"><a href="#authentication-and-authorization" 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">Authentication and authorization</span></h3>
<!-- --><div role="presentation" style="position:relative;--scroll-area-corner-height:0px;--scroll-area-corner-width:0px" data-component-part="scroll-area" data-table-wrapper="true" class="min-w-0 [--page-padding:20px] flex w-[calc(100%+(var(--page-padding)*2))] my-[1em] py-[1em] -mx-(--page-padding) max-w-none [contain:inline-size]"><div role="region" data-id="base-ui-_R_fkllktbsnlhjiuasnpfiutb_-viewport" tabindex="-1" class="size-full rounded-[inherit] [--scroll-area-fade-size:32px] overflow-y-hidden! base-ui-disable-scrollbar" style="overflow:scroll" data-component-part="scroll-area-viewport" aria-label="Scrollable table"><div role="presentation" style="min-width:fit-content" data-component-part="scroll-area-content" class="flex"><div class="px-(--page-padding) grow max-w-none table"><table class="m-0 min-w-full w-full max-w-none table [&amp;_td]:min-w-[150px] [&amp;_th]:text-left [&amp;_td[data-numeric]]:tabular-nums"><thead><tr><th><code>error_type</code></th><th>HTTP Status</th><th>Description</th></tr></thead><tbody><tr><td><code>authentication</code></td><td>The API key is missing, invalid, or revoked.</td><td></td></tr><tr><td><code>permission_denied</code></td><td>The key is valid but lacks the required permission or the request was blocked by a <a class="link" href="/docs/guides/features/guardrails">guardrail</a>.</td><td></td></tr><tr><td><code>payment_required</code></td><td>The account or API key has insufficient credits. <a href="https://openrouter.ai/credits" target="_blank" rel="noreferrer" class="link">Add credits</a> and retry.</td><td></td></tr></tbody></table></div></div></div></div>
<h3 class="flex whitespace-pre-wrap group font-semibold" id="rate-limiting-and-availability"><div class="absolute" tabindex="-1"><a href="#rate-limiting-and-availability" 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">Rate limiting and availability</span></h3>
<!-- --><div role="presentation" style="position:relative;--scroll-area-corner-height:0px;--scroll-area-corner-width:0px" data-component-part="scroll-area" data-table-wrapper="true" class="min-w-0 [--page-padding:20px] flex w-[calc(100%+(var(--page-padding)*2))] my-[1em] py-[1em] -mx-(--page-padding) max-w-none [contain:inline-size]"><div role="region" data-id="base-ui-_R_g4llktbsnlhjiuasnpfiutb_-viewport" tabindex="-1" class="size-full rounded-[inherit] [--scroll-area-fade-size:32px] overflow-y-hidden! base-ui-disable-scrollbar" style="overflow:scroll" data-component-part="scroll-area-viewport" aria-label="Scrollable table"><div role="presentation" style="min-width:fit-content" data-component-part="scroll-area-content" class="flex"><div class="px-(--page-padding) grow max-w-none table"><table class="m-0 min-w-full w-full max-w-none table [&amp;_td]:min-w-[150px] [&amp;_th]:text-left [&amp;_td[data-numeric]]:tabular-nums"><thead><tr><th><code>error_type</code></th><th>HTTP Status</th><th>Description</th></tr></thead><tbody><tr><td><code>rate_limit_exceeded</code></td><td>Request- or token-level rate limit hit. Respect the <code>Retry-After</code> header before retrying.</td><td></td></tr><tr><td><code>provider_overloaded</code></td><td>The upstream provider is temporarily overloaded. Retry after a short delay.</td><td></td></tr><tr><td><code>provider_unavailable</code></td><td>The upstream provider returned an invalid or empty response. OpenRouter may auto-retry with another provider if fallback routing is enabled.</td><td></td></tr></tbody></table></div></div></div></div>
<h3 class="flex whitespace-pre-wrap group font-semibold" id="request-validation"><div class="absolute" tabindex="-1"><a href="#request-validation" 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 validation</span></h3>
<!-- --><div role="presentation" style="position:relative;--scroll-area-corner-height:0px;--scroll-area-corner-width:0px" data-component-part="scroll-area" data-table-wrapper="true" class="min-w-0 [--page-padding:20px] flex w-[calc(100%+(var(--page-padding)*2))] my-[1em] py-[1em] -mx-(--page-padding) max-w-none [contain:inline-size]"><div role="region" data-id="base-ui-_R_gkllktbsnlhjiuasnpfiutb_-viewport" tabindex="-1" class="size-full rounded-[inherit] [--scroll-area-fade-size:32px] overflow-y-hidden! base-ui-disable-scrollbar" style="overflow:scroll" data-component-part="scroll-area-viewport" aria-label="Scrollable table"><div role="presentation" style="min-width:fit-content" data-component-part="scroll-area-content" class="flex"><div class="px-(--page-padding) grow max-w-none table"><table class="m-0 min-w-full w-full max-w-none table [&amp;_td]:min-w-[150px] [&amp;_th]:text-left [&amp;_td[data-numeric]]:tabular-nums"><thead><tr><th><code>error_type</code></th><th>HTTP Status</th><th>Description</th></tr></thead><tbody><tr><td><code>invalid_request</code></td><td>A request parameter is malformed or missing.</td><td></td></tr><tr><td><code>invalid_prompt</code></td><td>A specific message in the <code>messages</code> array is invalid (e.g. unsupported role, empty content).</td><td></td></tr><tr><td><code>not_found</code></td><td>The requested resource (model, file, etc.) does not exist.</td><td></td></tr><tr><td><code>precondition_failed</code></td><td>A precondition header (e.g. <code>If-Match</code>) was not satisfied.</td><td></td></tr><tr><td><code>payload_too_large</code></td><td>The request body exceeds the maximum allowed size.</td><td></td></tr><tr><td><code>unprocessable</code></td><td>The request is syntactically valid but semantically unprocessable.</td><td></td></tr></tbody></table></div></div></div></div>
<h3 class="flex whitespace-pre-wrap group font-semibold" id="content-policy"><div class="absolute" tabindex="-1"><a href="#content-policy" 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">Content policy</span></h3>
<!-- --><div role="presentation" style="position:relative;--scroll-area-corner-height:0px;--scroll-area-corner-width:0px" data-component-part="scroll-area" data-table-wrapper="true" class="min-w-0 [--page-padding:20px] flex w-[calc(100%+(var(--page-padding)*2))] my-[1em] py-[1em] -mx-(--page-padding) max-w-none [contain:inline-size]"><div role="region" data-id="base-ui-_R_h4llktbsnlhjiuasnpfiutb_-viewport" tabindex="-1" class="size-full rounded-[inherit] [--scroll-area-fade-size:32px] overflow-y-hidden! base-ui-disable-scrollbar" style="overflow:scroll" data-component-part="scroll-area-viewport" aria-label="Scrollable table"><div role="presentation" style="min-width:fit-content" data-component-part="scroll-area-content" class="flex"><div class="px-(--page-padding) grow max-w-none table"><table class="m-0 min-w-full w-full max-w-none table [&amp;_td]:min-w-[150px] [&amp;_th]:text-left [&amp;_td[data-numeric]]:tabular-nums"><thead><tr><th><code>error_type</code></th><th>HTTP Status</th><th>Description</th></tr></thead><tbody><tr><td><code>content_policy_violation</code></td><td>The input or output was flagged by a content filter (provider- or OpenRouter-level).</td><td></td></tr><tr><td><code>refusal</code></td><td>The model explicitly refused to comply with the request (e.g. safety refusal).</td><td></td></tr></tbody></table></div></div></div></div>
<h3 class="flex whitespace-pre-wrap group font-semibold" id="image-errors"><div class="absolute" tabindex="-1"><a href="#image-errors" 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">Image errors</span></h3>
<!-- --><div role="presentation" style="position:relative;--scroll-area-corner-height:0px;--scroll-area-corner-width:0px" data-component-part="scroll-area" data-table-wrapper="true" class="min-w-0 [--page-padding:20px] flex w-[calc(100%+(var(--page-padding)*2))] my-[1em] py-[1em] -mx-(--page-padding) max-w-none [contain:inline-size]"><div role="region" data-id="base-ui-_R_hkllktbsnlhjiuasnpfiutb_-viewport" tabindex="-1" class="size-full rounded-[inherit] [--scroll-area-fade-size:32px] overflow-y-hidden! base-ui-disable-scrollbar" style="overflow:scroll" data-component-part="scroll-area-viewport" aria-label="Scrollable table"><div role="presentation" style="min-width:fit-content" data-component-part="scroll-area-content" class="flex"><div class="px-(--page-padding) grow max-w-none table"><table class="m-0 min-w-full w-full max-w-none table [&amp;_td]:min-w-[150px] [&amp;_th]:text-left [&amp;_td[data-numeric]]:tabular-nums"><thead><tr><th><code>error_type</code></th><th>HTTP Status</th><th>Description</th></tr></thead><tbody><tr><td><code>invalid_image</code></td><td>An image in the request is corrupt or unreadable.</td><td></td></tr><tr><td><code>image_too_large</code></td><td>An image exceeds the provider’s maximum file size or pixel dimensions.</td><td></td></tr><tr><td><code>image_too_small</code></td><td>An image is below the provider’s minimum pixel dimensions.</td><td></td></tr><tr><td><code>unsupported_image_format</code></td><td>The image format is not supported by the provider.</td><td></td></tr><tr><td><code>image_not_found</code></td><td>The referenced image URL or file ID could not be resolved.</td><td></td></tr><tr><td><code>image_download_failed</code></td><td>OpenRouter could not download the image from the provided URL (DNS failure, timeout, non-200 response, etc.).</td><td></td></tr></tbody></table></div></div></div></div>
<h3 class="flex whitespace-pre-wrap group font-semibold" id="generic"><div class="absolute" tabindex="-1"><a href="#generic" 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="min-w-0 break-words cursor-pointer">Generic</span></h3>
<!-- --><div role="presentation" style="position:relative;--scroll-area-corner-height:0px;--scroll-area-corner-width:0px" data-component-part="scroll-area" data-table-wrapper="true" class="min-w-0 [--page-padding:20px] flex w-[calc(100%+(var(--page-padding)*2))] my-[1em] py-[1em] -mx-(--page-padding) max-w-none [contain:inline-size]"><div role="region" data-id="base-ui-_R_i4llktbsnlhjiuasnpfiutb_-viewport" tabindex="-1" class="size-full rounded-[inherit] [--scroll-area-fade-size:32px] overflow-y-hidden! base-ui-disable-scrollbar" style="overflow:scroll" data-component-part="scroll-area-viewport" aria-label="Scrollable table"><div role="presentation" style="min-width:fit-content" data-component-part="scroll-area-content" class="flex"><div class="px-(--page-padding) grow max-w-none table"><table class="m-0 min-w-full w-full max-w-none table [&amp;_td]:min-w-[150px] [&amp;_th]:text-left [&amp;_td[data-numeric]]:tabular-nums"><thead><tr><th><code>error_type</code></th><th>HTTP Status</th><th>Description</th></tr></thead><tbody><tr><td><code>server</code></td><td>An unexpected internal error. The upstream error message is masked on this type.</td><td></td></tr><tr><td><code>timeout</code></td><td>The provider did not respond within the allowed time.</td><td></td></tr><tr><td><code>unmapped</code></td><td>An upstream error that doesn’t map to any known category. <code>error.metadata.provider_code</code> may contain the original code.</td><td></td></tr></tbody></table></div></div></div></div>
<h2 class="flex whitespace-pre-wrap group font-semibold" id="model-availability-errors"><div class="absolute" tabindex="-1"><a href="#model-availability-errors" 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">Model availability errors</span></h2>
<span data-as="p">When a requested model cannot be served — it doesn’t exist, is deprecated, has no routable endpoints under your preferences, or all of its providers are at capacity — the error response carries an additional <code>error.availability</code> object. It is <strong>additive</strong>: <code>error_type</code>, <code>http_status</code>, and <code>message</code> keep their existing values, so existing error handling keeps working. Use <code>availability.code</code> — not the HTTP status or the message prose — to programmatically distinguish availability conditions.</span>
<span data-as="p">The same <code>availability</code> object is emitted on streaming error chunks for all three API skins (Chat Completions, Responses, Anthropic Messages).</span>
<h3 class="flex whitespace-pre-wrap group font-semibold" id="availability-codes"><div class="absolute" tabindex="-1"><a href="#availability-codes" 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">Availability codes</span></h3>
<span data-as="p">Every model-availability failure maps to exactly one code. Codes are stable forever; new codes may be added in the future, so treat an unrecognized code defensively and fall back to <code>retryable</code>.</span>
<!-- --><div role="presentation" style="position:relative;--scroll-area-corner-height:0px;--scroll-area-corner-width:0px" data-component-part="scroll-area" data-table-wrapper="true" class="min-w-0 [--page-padding:20px] flex w-[calc(100%+(var(--page-padding)*2))] my-[1em] py-[1em] -mx-(--page-padding) max-w-none [contain:inline-size]"><div role="region" data-id="base-ui-_R_jkllktbsnlhjiuasnpfiutb_-viewport" tabindex="-1" class="size-full rounded-[inherit] [--scroll-area-fade-size:32px] overflow-y-hidden! base-ui-disable-scrollbar" style="overflow:scroll" data-component-part="scroll-area-viewport" aria-label="Scrollable table"><div role="presentation" style="min-width:fit-content" data-component-part="scroll-area-content" class="flex"><div class="px-(--page-padding) grow max-w-none table"><table class="m-0 min-w-full w-full max-w-none table [&amp;_td]:min-w-[150px] [&amp;_th]:text-left [&amp;_td[data-numeric]]:tabular-nums"><thead><tr><th><code>availability.code</code></th><th>HTTP</th><th><code>error_type</code></th><th>Retryable</th><th>Meaning</th><th>Recommended client action</th></tr></thead><tbody><tr><td><code>model_not_found</code></td><td><code>invalid_request</code></td><td>No</td><td>The model id is unknown or invalid.</td><td>Do not retry. Check the slug for typos or a legacy alias; use <code>fallback_models</code> suggestions when present.</td><td></td></tr><tr><td><code>wrong_endpoint</code></td><td><code>invalid_request</code></td><td>No</td><td>The model exists but was called on the wrong endpoint (e.g. an embedding model on <code>/chat/completions</code>).</td><td>Retry on the endpoint named in <code>constraint.detail</code>.</td><td></td></tr><tr><td><code>no_endpoints</code></td><td><code>not_found</code></td><td>No</td><td>The model exists but has zero routable endpoints (none configured, all disabled/hidden, or all removed by your provider preferences).</td><td>Do not retry the identical request. Loosen provider routing preferences or choose another model.</td><td></td></tr><tr><td><code>model_deprecated</code></td><td><code>not_found</code></td><td>No</td><td>The model was deprecated or removed (sunset models, ended stealth alphas).</td><td>Migrate to the successor in <code>fallback_models</code>; see <code>docs_url</code> for the deprecation notice.</td><td></td></tr><tr><td><code>model_unavailable_upstream</code></td><td><code>not_found</code></td><td>No</td><td>Every endpoint for the model returns 404 upstream — the provider removed it.</td><td>Do not retry; pick another model (<code>fallback_models</code> when present).</td><td></td></tr><tr><td><code>capacity_exhausted</code></td><td><code>rate_limit_exceeded</code></td><td>Yes</td><td>All providers for the model are at capacity (all attempts returned 429).</td><td>Retry after <code>retry_after</code> seconds (also sent as the <code>Retry-After</code> header), or route to a <code>fallback_models</code> entry.</td><td></td></tr><tr><td><code>temporarily_unavailable</code></td><td><code>provider_overloaded</code></td><td>Yes</td><td>All attempts failed with transient upstream 5xx responses or timeouts.</td><td>Retry with backoff, honoring <code>retry_after</code> when present; consider <code>fallback_models</code> for latency-sensitive paths.</td><td></td></tr><tr><td><code>region_restricted</code></td><td><code>permission_denied</code></td><td>No</td><td>The model is geo-gated and not available in your region.</td><td>Do not retry from the same region. Adjust provider routing or serve traffic from an allowed region.</td><td></td></tr><tr><td><code>privacy_restricted</code></td><td><code>not_found</code></td><td>No</td><td>Your data-policy preferences (ZDR, training opt-out, free-model publication) eliminated every endpoint.</td><td>Relax the policy named in <code>excluded_by</code> (e.g. at <a href="https://openrouter.ai/settings/privacy" target="_blank" rel="noreferrer" class="link">privacy settings</a>) or choose another model.</td><td></td></tr><tr><td><code>constraint_filtered</code></td><td><code>not_found</code></td><td>No</td><td>A routing constraint — max price, context length, <code>require_parameters</code>, quantization, data region — eliminated every endpoint.</td><td>Relax the constraint named in <code>constraint.field</code> / <code>excluded_by</code> and retry.</td><td></td></tr><tr><td><code>free_variant_ended</code></td><td><code>not_found</code></td><td>No</td><td>The <code>:free</code> variant’s promotion ended; only paid endpoints remain.</td><td>Switch to the paid slug in <code>fallback_models</code> (normal pricing applies) or pick another model.</td><td></td></tr></tbody></table></div></div></div></div>
<div role="note" aria-label="Note" class="callout my-4 px-5 py-4 overflow-hidden rounded-2xl flex gap-3 border border-blue-200 bg-blue-50 dark:border-blue-900 dark:bg-blue-600/20" data-callout-type="note"><div class="mt-0.5 w-4" data-component-part="callout-icon"><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 text-blue-800 dark:text-blue-300"><path d="M 9 1.6714 C 13.0371 1.6714 16.3286 4.9629 16.3286 9 C 16.3286 13.0371 13.0371 16.3286 9 16.3286 C 7.0574 16.3252 5.1953 15.552 3.8217 14.1783 C 2.448 12.8047 1.6748 10.9426 1.6714 9 C 1.6714 4.9629 4.9629 1.6714 9 1.6714 Z M 9 0 C 4.0371 0 0 4.0371 0 9 C 0 13.9629 4.0371 18 9 18 C 13.9629 18 18 13.9629 18 9 C 18 4.0371 13.9629 0 9 0 Z M 10.2857 3.8571 H 7.7143 V 10.2857 H 10.2857 V 3.8571 Z M 10.2857 11.5714 H 7.7143 V 14.1429 H 10.2857 V 11.5714 Z" fill="currentColor" stroke="none" fill-rule="evenodd" clip-rule="evenodd"></path></svg></div><div class="text-sm prose dark:prose-invert min-w-0 w-full [&amp;_kbd]:bg-background-light dark:[&amp;_kbd]:bg-background-dark [&amp;_code]:text-current! [&amp;_kbd]:text-current! [&amp;_a]:text-current! [&amp;_a]:border-current [&amp;_strong]:text-current! text-blue-800 dark:text-blue-300" data-component-part="callout-content"><code>no_endpoints</code> and <code>model_unavailable_upstream</code> are non-retryable today, but the router may mark individual occurrences <code>retryable: true</code> when the underlying condition is transient. Always switch on <code>availability.retryable</code>, not just the code.</div></div>
<h3 class="flex whitespace-pre-wrap group font-semibold" id="the-availability-object"><div class="absolute" tabindex="-1"><a href="#the-availability-object" 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">The <code>availability</code> object</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="14" 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_1takcllktbsnlhjiuasnpfiutb_" 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_1uakcllktbsnlhjiuasnpfiutb_" 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_1vakcllktbsnlhjiuasnpfiutb_" 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-type_AvailabilityErr"><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_1ikcllktbsnlhjiuasnpfiutb_-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="14"><span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">type</span><span style="color:#953800;--shiki-dark:#4EC9B0"> AvailabilityError</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> =</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> {</span></span>
<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">  code</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">:</span><span style="color:#0550AE;--shiki-dark:#4EC9B0"> string</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">;                        </span><span style="color:#6E7781;--shiki-dark:#6A9955">// one of the codes above — the machine-readable discriminator</span></span>
<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">  retryable</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">:</span><span style="color:#0550AE;--shiki-dark:#4EC9B0"> boolean</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">;                  </span><span style="color:#6E7781;--shiki-dark:#6A9955">// would an identical retry plausibly succeed?</span></span>
<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">  retry_after</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">?:</span><span style="color:#0550AE;--shiki-dark:#4EC9B0"> number</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> |</span><span style="color:#0550AE;--shiki-dark:#4EC9B0"> null</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">;         </span><span style="color:#6E7781;--shiki-dark:#6A9955">// seconds to wait before retrying, when known (429/503 paths)</span></span>
<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">  requested_models</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">:</span><span style="color:#0550AE;--shiki-dark:#4EC9B0"> string</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">[];          </span><span style="color:#6E7781;--shiki-dark:#6A9955">// the raw model slugs you sent</span></span>
<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">  affected_providers</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">?:</span><span style="color:#0550AE;--shiki-dark:#4EC9B0"> string</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">[] </span><span style="color:#CF222E;--shiki-dark:#D4D4D4">|</span><span style="color:#0550AE;--shiki-dark:#4EC9B0"> null</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">; </span><span style="color:#6E7781;--shiki-dark:#6A9955">// providers whose endpoints were attempted or excluded</span></span>
<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">  excluded_by</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">?:</span><span style="color:#0550AE;--shiki-dark:#4EC9B0"> string</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">[];              </span><span style="color:#6E7781;--shiki-dark:#6A9955">// routing filter(s) that removed the last endpoints</span></span>
<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">  fallback_models</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">?:</span><span style="color:#0550AE;--shiki-dark:#4EC9B0"> string</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">[];          </span><span style="color:#6E7781;--shiki-dark:#6A9955">// suggested alternative model slugs; may be empty or omitted</span></span>
<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">  constraint</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">?:</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> {                       </span><span style="color:#6E7781;--shiki-dark:#6A9955">// present on constraint_filtered and wrong_endpoint</span></span>
<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">    field</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">:</span><span style="color:#0550AE;--shiki-dark:#4EC9B0"> string</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">;                     </span><span style="color:#6E7781;--shiki-dark:#6A9955">// e.g. &quot;max_price&quot;</span></span>
<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">    detail</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">:</span><span style="color:#0550AE;--shiki-dark:#4EC9B0"> string</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">;                    </span><span style="color:#6E7781;--shiki-dark:#6A9955">// human-readable explanation</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">  };</span></span>
<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">  docs_url</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">:</span><span style="color:#0550AE;--shiki-dark:#4EC9B0"> string</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">;                    </span><span style="color:#6E7781;--shiki-dark:#6A9955">// anchor for this code on this page</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>
<span data-as="p"><code>code</code>, <code>retryable</code>, <code>requested_models</code>, and <code>docs_url</code> are always present on an availability error. Other fields are omitted (never serialized as empty strings) when not applicable. <code>excluded_by</code> values are drawn from a fixed vocabulary: <code>geo</code>, <code>data_region</code>, <code>data_policy:zdr</code>, <code>data_policy:training</code>, <code>max_price</code>, <code>context_length</code>, <code>require_parameters</code>, <code>quantization</code>, <code>allowed_providers</code>.</span>
<span data-as="p">For debugging, <code>error.metadata.previous_errors</code> carries the per-provider attempt history in a slim, stable shape — <code>{ &quot;provider&quot;: &quot;...&quot;, &quot;code&quot;: &quot;...&quot;, &quot;status&quot;: 429 }</code> — and never includes raw upstream provider error bodies.</span>
<h3 class="flex whitespace-pre-wrap group font-semibold" id="retrying-with-retry_after"><div class="absolute" tabindex="-1"><a href="#retrying-with-retry_after" 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">Retrying with <code>retry_after</code></span></h3>
<span data-as="p">For <code>capacity_exhausted</code> and <code>temporarily_unavailable</code>, <code>availability.retry_after</code> mirrors the <code>Retry-After</code> response header in the body and is populated whenever any attempted endpoint supplied a retry hint (the minimum across attempts). Both are expressed in seconds:</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="11" 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_1talkllktbsnlhjiuasnpfiutb_" 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_1ualkllktbsnlhjiuasnpfiutb_" 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_1valkllktbsnlhjiuasnpfiutb_" 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_res___await_fe"><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_1ilkllktbsnlhjiuasnpfiutb_-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="11"><span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">const</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> res</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;https://openrouter.ai/api/v1/chat/completions&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, { </span><span style="color:#CF222E;--shiki-dark:#D4D4D4">...</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"> body</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"> res</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#8250DF;--shiki-dark:#DCDCAA">json</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"> availability</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> =</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> body</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">error</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">?.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">availability</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">availability</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">?.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">retryable</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"> waitSeconds</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> =</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">    availability</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">retry_after</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> ??</span></span>
<span class="line"><span style="color:#8250DF;--shiki-dark:#DCDCAA">    Number</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">res</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">headers</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#8250DF;--shiki-dark:#DCDCAA">get</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#0A3069;--shiki-dark:#CE9178">&#x27;Retry-After&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">)) </span><span style="color:#CF222E;--shiki-dark:#D4D4D4">||</span></span>
<span class="line"><span style="color:#0550AE;--shiki-dark:#B5CEA8">    2</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> **</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> attempt</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">; </span><span style="color:#6E7781;--shiki-dark:#6A9955">// exponential backoff fallback when no hint is given</span></span>
<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">  await</span><span style="color:#CF222E;--shiki-dark:#569CD6"> new</span><span style="color:#0550AE;--shiki-dark:#4EC9B0"> Promise</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">((</span><span style="color:#953800;--shiki-dark:#9CDCFE">r</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">) </span><span style="color:#CF222E;--shiki-dark:#569CD6">=&gt;</span><span style="color:#8250DF;--shiki-dark:#DCDCAA"> setTimeout</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">r</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#1F2328;--shiki-dark:#9CDCFE">waitSeconds</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> *</span><span style="color:#0550AE;--shiki-dark:#B5CEA8"> 1000</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">));</span></span>
<span class="line"><span style="color:#6E7781;--shiki-dark:#6A9955">  // retry the identical request</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>
<span data-as="p">The OpenAI, Anthropic, Vercel AI, and OpenRouter SDKs already honor the <code>Retry-After</code> header; <code>availability.retry_after</code> exposes the same signal to clients that inspect bodies rather than headers.</span>
<h3 class="flex whitespace-pre-wrap group font-semibold" id="using-fallback_models-suggestions"><div class="absolute" tabindex="-1"><a href="#using-fallback_models-suggestions" 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">Using <code>fallback_models</code> suggestions</span></h3>
<span data-as="p"><code>fallback_models</code> contains suggested alternative slugs the router can point to cheaply — the paid variant after a <code>:free</code> promotion ends, the successor of a deprecated model, or same-family alternatives. It is omitted when no suggestion is available and never delays the error response.</span>
<span data-as="p">Suggestions are hints, not guarantees: a fallback may differ in price, context window, or capabilities, and it may be unavailable under your own routing preferences. Validate the slug against your requirements (or surface it to your user) before silently switching models.</span>
<h3 class="flex whitespace-pre-wrap group font-semibold" id="example-availability-error-payloads"><div class="absolute" tabindex="-1"><a href="#example-availability-error-payloads" 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 availability error payloads</span></h3>
<span data-as="p"><strong>All providers at capacity — <code>capacity_exhausted</code> (retryable):</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="22" 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_1tancllktbsnlhjiuasnpfiutb_" 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_1uancllktbsnlhjiuasnpfiutb_" 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_1vancllktbsnlhjiuasnpfiutb_" 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-_____error__________"><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_1incllktbsnlhjiuasnpfiutb_-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="22"><span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">{</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">  &quot;error&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">    &quot;message&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;All providers for anthropic/claude-sonnet-4.5 are at capacity. Retry after 40 seconds.&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">    &quot;error_type&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;rate_limit_exceeded&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">    &quot;http_status&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0550AE;--shiki-dark:#B5CEA8">429</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">    &quot;availability&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;code&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;capacity_exhausted&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;retryable&quot;</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:#116329;--shiki-dark:#9CDCFE">      &quot;retry_after&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0550AE;--shiki-dark:#B5CEA8">40</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;requested_models&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;affected_providers&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: [</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;anthropic&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;amazon-bedrock&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;google-vertex&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">],</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;fallback_models&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: [</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;anthropic/claude-haiku-4.5&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">],</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;docs_url&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;https://openrouter.ai/docs/errors#capacity_exhausted&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;metadata&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;previous_errors&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: [</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">        { </span><span style="color:#116329;--shiki-dark:#9CDCFE">&quot;provider&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;anthropic&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#116329;--shiki-dark:#9CDCFE">&quot;code&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;capacity_exhausted&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#116329;--shiki-dark:#9CDCFE">&quot;status&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0550AE;--shiki-dark:#B5CEA8">429</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> },</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">        { </span><span style="color:#116329;--shiki-dark:#9CDCFE">&quot;provider&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;amazon-bedrock&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#116329;--shiki-dark:#9CDCFE">&quot;code&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;capacity_exhausted&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#116329;--shiki-dark:#9CDCFE">&quot;status&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0550AE;--shiki-dark:#B5CEA8">429</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 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>Deprecated stealth model — <code>model_deprecated</code>:</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="14" 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_1tansllktbsnlhjiuasnpfiutb_" 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_1uansllktbsnlhjiuasnpfiutb_" 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_1vansllktbsnlhjiuasnpfiutb_" 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-_____error__________"><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_1insllktbsnlhjiuasnpfiutb_-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="14"><span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">{</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">  &quot;error&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">    &quot;message&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;Quasar Alpha was a stealth model, revealed on April 14th as an early testing version of GPT-4.1.&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">    &quot;error_type&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;not_found&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">    &quot;http_status&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0550AE;--shiki-dark:#B5CEA8">404</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">    &quot;availability&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;code&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;model_deprecated&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;retryable&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>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;requested_models&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: [</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;openrouter/quasar-alpha&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">],</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;fallback_models&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: [</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;openai/gpt-4.1&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">],</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;docs_url&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;https://openrouter.ai/docs/errors#model_deprecated&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>
</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>Privacy restriction eliminated all endpoints — <code>privacy_restricted</code>:</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="15" 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_1taocllktbsnlhjiuasnpfiutb_" 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_1uaocllktbsnlhjiuasnpfiutb_" 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_1vaocllktbsnlhjiuasnpfiutb_" 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-_____error__________"><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_1iocllktbsnlhjiuasnpfiutb_-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="15"><span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">{</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">  &quot;error&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">    &quot;message&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;No endpoints for openai/gpt-5.2 match your data policy (zero data retention). Adjust at https://openrouter.ai/settings/privacy.&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">    &quot;error_type&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;not_found&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">    &quot;http_status&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0550AE;--shiki-dark:#B5CEA8">404</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">    &quot;availability&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;code&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;privacy_restricted&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;retryable&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>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;requested_models&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: [</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;openai/gpt-5.2&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">],</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;affected_providers&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: [</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;openai&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;azure&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">],</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;excluded_by&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: [</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;data_policy:zdr&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">],</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;docs_url&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;https://openrouter.ai/docs/errors#privacy_restricted&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>
</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>Unknown model id — <code>model_not_found</code>:</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="13" 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_1taosllktbsnlhjiuasnpfiutb_" 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_1uaosllktbsnlhjiuasnpfiutb_" 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_1vaosllktbsnlhjiuasnpfiutb_" 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-_____error__________"><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_1iosllktbsnlhjiuasnpfiutb_-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="13"><span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">{</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">  &quot;error&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">    &quot;message&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;acme/fake-1.0 is not a valid model ID&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">    &quot;error_type&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;invalid_request&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">    &quot;http_status&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0550AE;--shiki-dark:#B5CEA8">400</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">    &quot;availability&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;code&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;model_not_found&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;retryable&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>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;requested_models&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: [</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;acme/fake-1.0&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">],</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;docs_url&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;https://openrouter.ai/docs/errors#model_not_found&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>
</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>
<h2 class="flex whitespace-pre-wrap group font-semibold" id="skin-specific-error-formats"><div class="absolute" tabindex="-1"><a href="#skin-specific-error-formats" 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">Skin-specific error formats</span></h2>
<span data-as="p">OpenRouter exposes three API skins. Each translates the same internal provider error types into its own wire format, for non-streaming responses and in-stream errors alike. In every case <code>error_type</code> is the stable field; the wire location differs per skin.</span>
<h3 class="flex whitespace-pre-wrap group font-semibold" id="chat-completions-/api/v1/chat/completions"><div class="absolute" tabindex="-1"><a href="#chat-completions-/api/v1/chat/completions" 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">Chat Completions (<code>/api/v1/chat/completions</code>)</span></h3>
<span data-as="p">Mid-stream errors appear as a <code>chat.completion.chunk</code> with a top-level <code>error</code> object (shape shown <a href="#mid-stream-errors" class="link">above</a>). The <code>error.metadata.error_type</code> field carries the typed code.</span>
<span data-as="p">For non-streaming requests where a provider error occurs, the error is embedded in the final response alongside any partial content:</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="11" 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_1taqcllktbsnlhjiuasnpfiutb_" 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_1uaqcllktbsnlhjiuasnpfiutb_" 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_1vaqcllktbsnlhjiuasnpfiutb_" 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-_____choices________"><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_1iqcllktbsnlhjiuasnpfiutb_-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="11"><span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">{</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">  &quot;choices&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: [{</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">    &quot;message&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: { </span><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 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;partial output...&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> },</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">    &quot;finish_reason&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;error&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">    &quot;error&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;code&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0550AE;--shiki-dark:#B5CEA8">502</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;message&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;Provider disconnected mid-stream&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;metadata&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: { </span><span style="color:#116329;--shiki-dark:#9CDCFE">&quot;error_type&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;provider_unavailable&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>
</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="responses-api-/api/v1/responses"><div class="absolute" tabindex="-1"><a href="#responses-api-/api/v1/responses" 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">Responses API (<code>/api/v1/responses</code>)</span></h3>
<span data-as="p">The Responses API maps internal error types to the OpenAI Responses error code set. The mapping is narrower — many distinct internal types collapse to <code>server_error</code> — so the precise reason is preserved in a top-level <code>error_type</code> field on the response, outside the native <code>error</code> object:</span>
<!-- --><div role="presentation" style="position:relative;--scroll-area-corner-height:0px;--scroll-area-corner-width:0px" data-component-part="scroll-area" data-table-wrapper="true" class="min-w-0 [--page-padding:20px] flex w-[calc(100%+(var(--page-padding)*2))] my-[1em] py-[1em] -mx-(--page-padding) max-w-none [contain:inline-size]"><div role="region" data-id="base-ui-_R_r4llktbsnlhjiuasnpfiutb_-viewport" tabindex="-1" class="size-full rounded-[inherit] [--scroll-area-fade-size:32px] overflow-y-hidden! base-ui-disable-scrollbar" style="overflow:scroll" data-component-part="scroll-area-viewport" aria-label="Scrollable table"><div role="presentation" style="min-width:fit-content" data-component-part="scroll-area-content" class="flex"><div class="px-(--page-padding) grow max-w-none table"><table class="m-0 min-w-full w-full max-w-none table [&amp;_td]:min-w-[150px] [&amp;_th]:text-left [&amp;_td[data-numeric]]:tabular-nums"><thead><tr><th>Internal <code>error_type</code></th><th>Responses API <code>code</code></th></tr></thead><tbody><tr><td><code>rate_limit_exceeded</code></td><td><code>rate_limit_exceeded</code></td></tr><tr><td><code>context_length_exceeded</code>, <code>invalid_request</code></td><td><code>invalid_prompt</code></td></tr><tr><td><code>content_policy_violation</code></td><td><code>image_content_policy_violation</code></td></tr><tr><td><code>authentication</code>, <code>provider_overloaded</code>, <code>provider_unavailable</code>, <code>timeout</code>, <code>server</code></td><td><code>server_error</code></td></tr><tr><td>All others (including <code>invalid_prompt</code>)</td><td><code>server_error</code></td></tr></tbody></table></div></div></div></div>
<span data-as="p">Both the streaming terminal event and the non-streaming JSON body carry the canonical <code>error_type</code> at the top level of the response object. For example, an authentication failure collapses to the native <code>server_error</code> code but keeps <code>error_type: &quot;authentication&quot;</code>:</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="6" 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_1tarkllktbsnlhjiuasnpfiutb_" 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_1uarkllktbsnlhjiuasnpfiutb_" 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_1varkllktbsnlhjiuasnpfiutb_" 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-_____id____resp_abc1"><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_1irkllktbsnlhjiuasnpfiutb_-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="6"><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;resp_abc123&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">  &quot;status&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;failed&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">  &quot;error&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: { </span><span style="color:#116329;--shiki-dark:#9CDCFE">&quot;code&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;server_error&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#116329;--shiki-dark:#9CDCFE">&quot;message&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;Invalid credentials&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> },</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">  &quot;error_type&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;authentication&quot;</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>
<span data-as="p">Streaming errors surface as one of three SSE event types, each wrapping the same response object:</span>
<ol>
<li>
<span data-as="p"><strong><code>response.failed</code></strong> — terminal event when the response could not complete:</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="9" 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_3qm4s4llktbsnlhjiuasnpfiutb_" 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_3sm4s4llktbsnlhjiuasnpfiutb_" 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_3um4s4llktbsnlhjiuasnpfiutb_" 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-_____type____respons"><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_364s4llktbsnlhjiuasnpfiutb_-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="9"><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;response.failed&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">  &quot;response&quot;</span><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;resp_abc123&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">    &quot;status&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;failed&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">    &quot;error&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: { </span><span style="color:#116329;--shiki-dark:#9CDCFE">&quot;code&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;server_error&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#116329;--shiki-dark:#9CDCFE">&quot;message&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;Internal server error&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> },</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">    &quot;error_type&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;server&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>
</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>
</li>
<li>
<span data-as="p"><strong><code>response.error</code></strong> — error during response generation:</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="4" 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_3qm8s4llktbsnlhjiuasnpfiutb_" 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_3sm8s4llktbsnlhjiuasnpfiutb_" 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_3um8s4llktbsnlhjiuasnpfiutb_" 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-_____type____respons"><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_368s4llktbsnlhjiuasnpfiutb_-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="4"><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;response.error&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">  &quot;error&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: { </span><span style="color:#116329;--shiki-dark:#9CDCFE">&quot;code&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;rate_limit_exceeded&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#116329;--shiki-dark:#9CDCFE">&quot;message&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;Rate limit exceeded&quot;</span><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>
</li>
<li>
<span data-as="p"><strong><code>error</code></strong> — plain error event (matches upstream OpenAI behavior):</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="4" 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_3qmcs4llktbsnlhjiuasnpfiutb_" 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_3smcs4llktbsnlhjiuasnpfiutb_" 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_3umcs4llktbsnlhjiuasnpfiutb_" 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-_____type____error__"><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_36cs4llktbsnlhjiuasnpfiutb_-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="4"><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;error&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">  &quot;error&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: { </span><span style="color:#116329;--shiki-dark:#9CDCFE">&quot;code&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;invalid_api_key&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#116329;--shiki-dark:#9CDCFE">&quot;message&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;Invalid API key provided&quot;</span><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>
</li>
</ol>
<h4 class="flex whitespace-pre-wrap group font-semibold" id="error-code-transformations"><div class="absolute" tabindex="-1"><a href="#error-code-transformations" 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">Error code transformations</span></h4>
<span data-as="p">Certain token/length errors are transformed into successful completions instead of failures:</span>
<!-- --><div role="presentation" style="position:relative;--scroll-area-corner-height:0px;--scroll-area-corner-width:0px" data-component-part="scroll-area" data-table-wrapper="true" class="min-w-0 [--page-padding:20px] flex w-[calc(100%+(var(--page-padding)*2))] my-[1em] py-[1em] -mx-(--page-padding) max-w-none [contain:inline-size]"><div role="region" data-id="base-ui-_R_ssllktbsnlhjiuasnpfiutb_-viewport" tabindex="-1" class="size-full rounded-[inherit] [--scroll-area-fade-size:32px] overflow-y-hidden! base-ui-disable-scrollbar" style="overflow:scroll" data-component-part="scroll-area-viewport" aria-label="Scrollable table"><div role="presentation" style="min-width:fit-content" data-component-part="scroll-area-content" class="flex"><div class="px-(--page-padding) grow max-w-none table"><table class="m-0 min-w-full w-full max-w-none table [&amp;_td]:min-w-[150px] [&amp;_th]:text-left [&amp;_td[data-numeric]]:tabular-nums"><thead><tr><th><code>error_type</code></th><th>Transformed To</th><th>Finish Reason</th></tr></thead><tbody><tr><td><code>context_length_exceeded</code></td><td>Success</td><td><code>length</code></td></tr><tr><td><code>max_tokens_exceeded</code></td><td>Success</td><td><code>length</code></td></tr><tr><td><code>token_limit_exceeded</code></td><td>Success</td><td><code>length</code></td></tr><tr><td><code>string_too_long</code></td><td>Success</td><td><code>length</code></td></tr></tbody></table></div></div></div></div>
<span data-as="p">This allows graceful handling of limit-based errors without treating them as failures.</span>
<h3 class="flex whitespace-pre-wrap group font-semibold" id="anthropic-messages-/api/v1/messages"><div class="absolute" tabindex="-1"><a href="#anthropic-messages-/api/v1/messages" 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">Anthropic Messages (<code>/api/v1/messages</code>)</span></h3>
<span data-as="p">The Anthropic Messages skin maps internal types to Anthropic-native error type strings:</span>
<!-- --><div role="presentation" style="position:relative;--scroll-area-corner-height:0px;--scroll-area-corner-width:0px" data-component-part="scroll-area" data-table-wrapper="true" class="min-w-0 [--page-padding:20px] flex w-[calc(100%+(var(--page-padding)*2))] my-[1em] py-[1em] -mx-(--page-padding) max-w-none [contain:inline-size]"><div role="region" data-id="base-ui-_R_tsllktbsnlhjiuasnpfiutb_-viewport" tabindex="-1" class="size-full rounded-[inherit] [--scroll-area-fade-size:32px] overflow-y-hidden! base-ui-disable-scrollbar" style="overflow:scroll" data-component-part="scroll-area-viewport" aria-label="Scrollable table"><div role="presentation" style="min-width:fit-content" data-component-part="scroll-area-content" class="flex"><div class="px-(--page-padding) grow max-w-none table"><table class="m-0 min-w-full w-full max-w-none table [&amp;_td]:min-w-[150px] [&amp;_th]:text-left [&amp;_td[data-numeric]]:tabular-nums"><thead><tr><th>Internal <code>error_type</code></th><th>Anthropic <code>error.type</code></th></tr></thead><tbody><tr><td><code>authentication</code></td><td><code>authentication_error</code></td></tr><tr><td><code>permission_denied</code></td><td><code>permission_error</code></td></tr><tr><td><code>payment_required</code></td><td><code>billing_error</code></td></tr><tr><td><code>not_found</code>, <code>image_not_found</code></td><td><code>not_found_error</code></td></tr><tr><td><code>rate_limit_exceeded</code></td><td><code>rate_limit_error</code></td></tr><tr><td><code>provider_overloaded</code></td><td><code>overloaded_error</code></td></tr><tr><td><code>timeout</code></td><td><code>timeout_error</code></td></tr><tr><td><code>context_length_exceeded</code>, <code>content_policy_violation</code>, <code>invalid_request</code>, …</td><td><code>invalid_request_error</code></td></tr><tr><td><code>provider_unavailable</code>, <code>server</code>, <code>unmapped</code>, …</td><td><code>api_error</code></td></tr></tbody></table></div></div></div></div>
<span data-as="p">Because the native <code>error.type</code> is lossy (many internal types collapse to <code>api_error</code>), the canonical <code>error_type</code> is added inside the <code>error</code> object alongside it. This holds for both the non-streaming error envelope and mid-stream SSE <code>error</code> events.</span>
<span data-as="p">Non-streaming error envelope (pre-Router errors such as authentication failures carry a <code>null</code> <code>request_id</code>; post-Router errors carry the <code>gen-</code> generation ID):</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="9" 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_1taukllktbsnlhjiuasnpfiutb_" 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_1uaukllktbsnlhjiuasnpfiutb_" 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_1vaukllktbsnlhjiuasnpfiutb_" 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-_____type____error__"><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_1iukllktbsnlhjiuasnpfiutb_-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="9"><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;error&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">  &quot;error&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;authentication_error&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">    &quot;message&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;Invalid credentials&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">    &quot;error_type&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;authentication&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;request_id&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0550AE;--shiki-dark:#569CD6">null</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>
<span data-as="p">Mid-stream errors are emitted as an SSE <code>error</code> event with the same shape:</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="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_1tav4llktbsnlhjiuasnpfiutb_" 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_1uav4llktbsnlhjiuasnpfiutb_" 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_1vav4llktbsnlhjiuasnpfiutb_" 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-_____type____error__"><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_1iv4llktbsnlhjiuasnpfiutb_-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="8"><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;error&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">  &quot;error&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;overloaded_error&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">    &quot;message&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;Provider is temporarily overloaded&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">    &quot;error_type&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;provider_overloaded&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>
</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>
<h2 class="flex whitespace-pre-wrap group font-semibold" id="debugging"><div class="absolute" tabindex="-1"><a href="#debugging" 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="min-w-0 break-words cursor-pointer">Debugging</span></h2>
<span data-as="p">OpenRouter provides a <code>debug</code> option that allows you to inspect the exact request body that was sent to the upstream provider. This works with both the Chat Completions API (<code>/api/v1/chat/completions</code>) and the Responses API (<code>/api/v1/responses</code>). Useful for understanding how OpenRouter transforms your request parameters for different providers.</span>
<h3 class="flex whitespace-pre-wrap group font-semibold" id="debug-option-shape"><div class="absolute" tabindex="-1"><a href="#debug-option-shape" 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">Debug option shape</span></h3>
<span data-as="p">The debug option is an object with the following shape:</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="3" 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_1tb0cllktbsnlhjiuasnpfiutb_" 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_1ub0cllktbsnlhjiuasnpfiutb_" 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_1vb0cllktbsnlhjiuasnpfiutb_" 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-type_DebugOptions___"><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_1j0cllktbsnlhjiuasnpfiutb_-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="3"><span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">type</span><span style="color:#953800;--shiki-dark:#4EC9B0"> DebugOptions</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> =</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> {</span></span>
<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">  echo_upstream_body</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">?:</span><span style="color:#0550AE;--shiki-dark:#4EC9B0"> boolean</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">; </span><span style="color:#6E7781;--shiki-dark:#6A9955">// If true, returns the transformed request body sent to the provider</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="usage"><div class="absolute" tabindex="-1"><a href="#usage" 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="min-w-0 break-words cursor-pointer">Usage</span></h3>
<span data-as="p">To enable debug output, include the <code>debug</code> parameter in your request:</span>
<h4 class="flex whitespace-pre-wrap group font-semibold" id="chat-completions"><div class="absolute" tabindex="-1"><a href="#chat-completions" 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">Chat Completions</span></h4>
<div data-orientation="horizontal" data-activation-direction="none" class="code-group p-0.5 mt-5 mb-8 flex flex-col not-prose relative rounded-2xl border border-gray-950/10 dark:border-white/10 min-w-0 bg-gray-50 dark:bg-white/5 dark:codeblock-dark text-gray-950 dark:text-gray-50 codeblock-light"><div class="flex items-center justify-between gap-2 relative pr-2.5" data-component-part="code-group-tab-bar"><div role="presentation" style="position:relative;--scroll-area-corner-height:0px;--scroll-area-corner-width:0px" data-component-part="scroll-area" class="min-w-0 flex-1 w-0 rounded-tl-xl"><div role="presentation" data-id="base-ui-_R_1b1cllktbsnlhjiuasnpfiutb_-viewport" tabindex="-1" class="size-full rounded-[inherit] [--scroll-area-fade-size:32px] 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"><div data-orientation="horizontal" data-activation-direction="none" role="tablist" aria-label="Code examples" class="text-xs leading-6 gap-1 flex"><button type="button" data-active="" data-orientation="horizontal" data-activation-direction="none" aria-disabled="false" tabindex="-1" role="tab" aria-selected="true" id="base-ui-_R_5lb1cllktbsnlhjiuasnpfiutb_" data-composite-item-active="" class="group flex items-center relative gap-1.5 my-1 mb-1.5 outline-0 whitespace-nowrap font-medium ml-0! first:ml-2.5! focus-visible:outline-hidden text-primary dark:text-primary-light"><div class="peer/title flex items-center gap-1.5 px-1.5 rounded-lg z-10 group-focus-visible:outline-1 group-focus-visible:outline-primary dark:group-focus-visible:outline-primary-light group-hover:bg-gray-200/50 dark:group-hover:bg-gray-700/70 group-hover:text-primary dark:group-hover:text-primary-light">TypeScript</div><div class="absolute -bottom-1.5 left-0 right-0 h-0.5 rounded-full bg-primary dark:bg-primary-light peer-empty/title:hidden"></div></button><button type="button" data-orientation="horizontal" data-activation-direction="none" aria-disabled="false" tabindex="-1" role="tab" aria-selected="false" id="base-ui-_R_9lb1cllktbsnlhjiuasnpfiutb_" class="group flex items-center relative gap-1.5 my-1 mb-1.5 outline-0 whitespace-nowrap font-medium ml-0! first:ml-2.5! focus-visible:outline-hidden text-gray-500 dark:text-gray-400"><div class="peer/title flex items-center gap-1.5 px-1.5 rounded-lg z-10 group-focus-visible:outline-1 group-focus-visible:outline-primary dark:group-focus-visible:outline-primary-light group-hover:bg-gray-200/50 dark:group-hover:bg-gray-700/70 group-hover:text-primary dark:group-hover:text-primary-light">Python</div></button></div></div></div></div><div class="flex items-center justify-end shrink-0 gap-1.5"><div class="z-10 select-none" id="base-ui-_R_fab1cllktbsnlhjiuasnpfiutb_" 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_feb1cllktbsnlhjiuasnpfiutb_" 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_fib1cllktbsnlhjiuasnpfiutb_" 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-fetch__https___openr"><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><div class="flex flex-1 overflow-hidden"><div data-orientation="horizontal" data-activation-direction="none" id="base-ui-_R_1j1cllktbsnlhjiuasnpfiutb_" role="tabpanel" tabindex="0" data-index="-1" class="w-full min-w-full max-w-full h-full max-h-full relative focus-visible:outline-hidden before:content-[&#x27;&#x27;] before:absolute before:inset-0 before:z-10 before:pointer-events-none before:rounded-xt focus-visible:before:outline focus-visible:before:outline-1 focus-visible:before:-outline-offset-2 focus-visible:before:outline-primary dark:focus-visible:before:outline-primary-light data-hidden:hidden [&amp;_[data-component-part=code-block-root]]:rounded-xt!"><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-xt bg-white has-line-numbers"><div role="presentation" data-id="base-ui-_R_dj1cllktbsnlhjiuasnpfiutb_-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 flex-none text-sm h-full leading-6" data-component-part="code-group-tab-content"><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="35"><span class="line"><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;https://openrouter.ai/api/v1/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>
<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">    Authorization:</span><span style="color:#0A3069;--shiki-dark:#CE9178"> &#x27;Bearer &lt;OPENROUTER_API_KEY&gt;&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><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:#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-haiku-4.5&#x27;</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 style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#6E7781;--shiki-dark:#6A9955">// Debug only works with streaming</span></span>
<span class="line"><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:#D4D4D4">      { </span><span style="color:#1F2328;--shiki-dark:#9CDCFE">role:</span><span style="color:#0A3069;--shiki-dark:#CE9178"> &#x27;system&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#1F2328;--shiki-dark:#9CDCFE">content:</span><span style="color:#0A3069;--shiki-dark:#CE9178"> &#x27;You are a helpful assistant.&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> },</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">      { </span><span style="color:#1F2328;--shiki-dark:#9CDCFE">role:</span><span style="color:#0A3069;--shiki-dark:#CE9178"> &#x27;user&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#1F2328;--shiki-dark:#9CDCFE">content:</span><span style="color:#0A3069;--shiki-dark:#CE9178"> &#x27;Hello!&#x27;</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:#9CDCFE">    debug:</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> {</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">      echo_upstream_body:</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:#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>
<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">const</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> text</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"> response</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#8250DF;--shiki-dark:#DCDCAA">text</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"> text</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>
<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">  if</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> (</span><span style="color:#CF222E;--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 style="color:#CF222E;--shiki-dark:#C586C0">continue</span><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"> data</span><span style="color:#CF222E;--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 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:#CF222E;--shiki-dark:#D4D4D4"> ===</span><span style="color:#0A3069;--shiki-dark:#CE9178"> &#x27;[DONE]&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">) </span><span style="color:#CF222E;--shiki-dark:#C586C0">break</span><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"> parsed</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">data</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">parsed</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">debug</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">?.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">echo_upstream_body</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">) {</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">    console</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#8250DF;--shiki-dark:#DCDCAA">log</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">Debug:&#x27;</span><span style="color:#1F2328;--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">stringify</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">parsed</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">debug</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">echo_upstream_body</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 style="color:#0550AE;--shiki-dark:#B5CEA8">2</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:#1F2328;--shiki-dark:#9CDCFE">  process</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">stdout</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#8250DF;--shiki-dark:#DCDCAA">write</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">parsed</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">content</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> ??</span><span style="color:#0A3069;--shiki-dark:#CE9178"> &#x27;&#x27;</span><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 35 lines</button></div></div><div data-hidden="" data-orientation="horizontal" data-activation-direction="none" hidden="" id="base-ui-_R_2j1cllktbsnlhjiuasnpfiutb_" role="tabpanel" tabindex="0" inert="" data-index="-1" class="w-full min-w-full max-w-full h-full max-h-full relative focus-visible:outline-hidden before:content-[&#x27;&#x27;] before:absolute before:inset-0 before:z-10 before:pointer-events-none before:rounded-xt focus-visible:before:outline focus-visible:before:outline-1 focus-visible:before:-outline-offset-2 focus-visible:before:outline-primary dark:focus-visible:before:outline-primary-light data-hidden:hidden [&amp;_[data-component-part=code-block-root]]:rounded-xt!"><div role="presentation" style="position:relative;--scroll-area-corner-height:0px;--scroll-area-corner-width:0px;font-variant-ligatures:none;height:100%;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-xt bg-white has-line-numbers"><div role="presentation" data-id="base-ui-_R_ej1cllktbsnlhjiuasnpfiutb_-viewport" tabindex="-1" class="size-full rounded-[inherit] [--scroll-area-fade-size:32px] py-3.5 px-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-full! h-full children:my-0! children:shadow-none! children:bg-transparent!"><div class="font-mono whitespace-pre flex-none text-sm h-full leading-6" data-component-part="code-group-tab-content"><pre class="shiki shiki-themes github-light-default dark-plus" style="background-color:#ffffff;--shiki-dark-bg:#0B0C0E;color:#1f2328;--shiki-dark:#D4D4D4" language="python"><code language="python" numberOfLines="28"><span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">import</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> requests</span></span>
<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">import</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> json</span></span>
<span class="line"></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">response </span><span style="color:#CF222E;--shiki-dark:#D4D4D4">=</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> requests.post(</span></span>
<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">  url</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">=</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;https://openrouter.ai/api/v1/chat/completions&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">  headers</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">=</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">{</span></span>
<span class="line"><span style="color:#0A3069;--shiki-dark:#CE9178">    &quot;Authorization&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;Bearer &lt;OPENROUTER_API_KEY&gt;&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#0A3069;--shiki-dark:#CE9178">    &quot;Content-Type&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;application/json&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:#953800;--shiki-dark:#9CDCFE">  data</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">=</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">json.dumps({</span></span>
<span class="line"><span style="color:#0A3069;--shiki-dark:#CE9178">    &quot;model&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;anthropic/claude-haiku-4.5&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#0A3069;--shiki-dark:#CE9178">    &quot;stream&quot;</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:#0A3069;--shiki-dark:#CE9178">    &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 style="color:#0A3069;--shiki-dark:#CE9178">&quot;role&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;system&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;content&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;You are a helpful assistant.&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> },</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">      { </span><span style="color:#0A3069;--shiki-dark:#CE9178">&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 style="color:#0A3069;--shiki-dark:#CE9178">&quot;content&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;Hello!&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:#0A3069;--shiki-dark:#CE9178">    &quot;debug&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span></span>
<span class="line"><span style="color:#0A3069;--shiki-dark:#CE9178">      &quot;echo_upstream_body&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </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 style="color:#953800;--shiki-dark:#9CDCFE">  stream</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">=</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>
<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">for</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> line </span><span style="color:#CF222E;--shiki-dark:#C586C0">in</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> response.iter_lines():</span></span>
<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">  if</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> line:</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    text </span><span style="color:#CF222E;--shiki-dark:#D4D4D4">=</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> line.decode(</span><span style="color:#0A3069;--shiki-dark:#CE9178">&#x27;utf-8&#x27;</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:#0A3069;--shiki-dark:#CE9178"> &#x27;echo_upstream_body&#x27;</span><span style="color:#CF222E;--shiki-dark:#569CD6"> in</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> text:</span></span>
<span class="line"><span style="color:#0550AE;--shiki-dark:#DCDCAA">      print</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(text)</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></div>
<h4 class="flex whitespace-pre-wrap group font-semibold" id="responses-api"><div class="absolute" tabindex="-1"><a href="#responses-api" 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">Responses API</span></h4>
<div data-orientation="horizontal" data-activation-direction="none" class="code-group p-0.5 mt-5 mb-8 flex flex-col not-prose relative rounded-2xl border border-gray-950/10 dark:border-white/10 min-w-0 bg-gray-50 dark:bg-white/5 dark:codeblock-dark text-gray-950 dark:text-gray-50 codeblock-light"><div class="flex items-center justify-between gap-2 relative pr-2.5" data-component-part="code-group-tab-bar"><div role="presentation" style="position:relative;--scroll-area-corner-height:0px;--scroll-area-corner-width:0px" data-component-part="scroll-area" class="min-w-0 flex-1 w-0 rounded-tl-xl"><div role="presentation" data-id="base-ui-_R_1b1sllktbsnlhjiuasnpfiutb_-viewport" tabindex="-1" class="size-full rounded-[inherit] [--scroll-area-fade-size:32px] 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"><div data-orientation="horizontal" data-activation-direction="none" role="tablist" aria-label="Code examples" class="text-xs leading-6 gap-1 flex"><button type="button" data-active="" data-orientation="horizontal" data-activation-direction="none" aria-disabled="false" tabindex="-1" role="tab" aria-selected="true" id="base-ui-_R_5lb1sllktbsnlhjiuasnpfiutb_" data-composite-item-active="" class="group flex items-center relative gap-1.5 my-1 mb-1.5 outline-0 whitespace-nowrap font-medium ml-0! first:ml-2.5! focus-visible:outline-hidden text-primary dark:text-primary-light"><div class="peer/title flex items-center gap-1.5 px-1.5 rounded-lg z-10 group-focus-visible:outline-1 group-focus-visible:outline-primary dark:group-focus-visible:outline-primary-light group-hover:bg-gray-200/50 dark:group-hover:bg-gray-700/70 group-hover:text-primary dark:group-hover:text-primary-light">TypeScript</div><div class="absolute -bottom-1.5 left-0 right-0 h-0.5 rounded-full bg-primary dark:bg-primary-light peer-empty/title:hidden"></div></button><button type="button" data-orientation="horizontal" data-activation-direction="none" aria-disabled="false" tabindex="-1" role="tab" aria-selected="false" id="base-ui-_R_9lb1sllktbsnlhjiuasnpfiutb_" class="group flex items-center relative gap-1.5 my-1 mb-1.5 outline-0 whitespace-nowrap font-medium ml-0! first:ml-2.5! focus-visible:outline-hidden text-gray-500 dark:text-gray-400"><div class="peer/title flex items-center gap-1.5 px-1.5 rounded-lg z-10 group-focus-visible:outline-1 group-focus-visible:outline-primary dark:group-focus-visible:outline-primary-light group-hover:bg-gray-200/50 dark:group-hover:bg-gray-700/70 group-hover:text-primary dark:group-hover:text-primary-light">Python</div></button></div></div></div></div><div class="flex items-center justify-end shrink-0 gap-1.5"><div class="z-10 select-none" id="base-ui-_R_fab1sllktbsnlhjiuasnpfiutb_" 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_feb1sllktbsnlhjiuasnpfiutb_" 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_fib1sllktbsnlhjiuasnpfiutb_" 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-fetch__https___openr"><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><div class="flex flex-1 overflow-hidden"><div data-orientation="horizontal" data-activation-direction="none" id="base-ui-_R_1j1sllktbsnlhjiuasnpfiutb_" role="tabpanel" tabindex="0" data-index="-1" class="w-full min-w-full max-w-full h-full max-h-full relative focus-visible:outline-hidden before:content-[&#x27;&#x27;] before:absolute before:inset-0 before:z-10 before:pointer-events-none before:rounded-xt focus-visible:before:outline focus-visible:before:outline-1 focus-visible:before:-outline-offset-2 focus-visible:before:outline-primary dark:focus-visible:before:outline-primary-light data-hidden:hidden [&amp;_[data-component-part=code-block-root]]:rounded-xt!"><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-xt bg-white has-line-numbers"><div role="presentation" data-id="base-ui-_R_dj1sllktbsnlhjiuasnpfiutb_-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 flex-none text-sm h-full leading-6" data-component-part="code-group-tab-content"><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="30"><span class="line"><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;https://openrouter.ai/api/v1/responses&#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>
<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">    Authorization:</span><span style="color:#0A3069;--shiki-dark:#CE9178"> &#x27;Bearer &lt;OPENROUTER_API_KEY&gt;&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><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:#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-haiku-4.5&#x27;</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 style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">    input:</span><span style="color:#0A3069;--shiki-dark:#CE9178"> &#x27;Hello!&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">    debug:</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> {</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">      echo_upstream_body:</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:#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>
<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">const</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> text</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"> response</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#8250DF;--shiki-dark:#DCDCAA">text</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"> text</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>
<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">  if</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> (</span><span style="color:#CF222E;--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 style="color:#CF222E;--shiki-dark:#C586C0">continue</span><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"> data</span><span style="color:#CF222E;--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 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:#CF222E;--shiki-dark:#D4D4D4"> ===</span><span style="color:#0A3069;--shiki-dark:#CE9178"> &#x27;[DONE]&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">) </span><span style="color:#CF222E;--shiki-dark:#C586C0">break</span><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"> parsed</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">data</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">parsed</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">type</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> ===</span><span style="color:#0A3069;--shiki-dark:#CE9178"> &#x27;response.debug&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">) {</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">    console</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#8250DF;--shiki-dark:#DCDCAA">log</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">Debug:&#x27;</span><span style="color:#1F2328;--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">stringify</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">parsed</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">debug</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 style="color:#0550AE;--shiki-dark:#B5CEA8">2</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 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 30 lines</button></div></div><div data-hidden="" data-orientation="horizontal" data-activation-direction="none" hidden="" id="base-ui-_R_2j1sllktbsnlhjiuasnpfiutb_" role="tabpanel" tabindex="0" inert="" data-index="-1" class="w-full min-w-full max-w-full h-full max-h-full relative focus-visible:outline-hidden before:content-[&#x27;&#x27;] before:absolute before:inset-0 before:z-10 before:pointer-events-none before:rounded-xt focus-visible:before:outline focus-visible:before:outline-1 focus-visible:before:-outline-offset-2 focus-visible:before:outline-primary dark:focus-visible:before:outline-primary-light data-hidden:hidden [&amp;_[data-component-part=code-block-root]]:rounded-xt!"><div role="presentation" style="position:relative;--scroll-area-corner-height:0px;--scroll-area-corner-width:0px;font-variant-ligatures:none;height:100%;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-xt bg-white has-line-numbers"><div role="presentation" data-id="base-ui-_R_ej1sllktbsnlhjiuasnpfiutb_-viewport" tabindex="-1" class="size-full rounded-[inherit] [--scroll-area-fade-size:32px] py-3.5 px-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-full! h-full children:my-0! children:shadow-none! children:bg-transparent!"><div class="font-mono whitespace-pre flex-none text-sm h-full leading-6" data-component-part="code-group-tab-content"><pre class="shiki shiki-themes github-light-default dark-plus" style="background-color:#ffffff;--shiki-dark-bg:#0B0C0E;color:#1f2328;--shiki-dark:#D4D4D4" language="python"><code language="python" numberOfLines="25"><span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">import</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> requests</span></span>
<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">import</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> json</span></span>
<span class="line"></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">response </span><span style="color:#CF222E;--shiki-dark:#D4D4D4">=</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> requests.post(</span></span>
<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">  url</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">=</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;https://openrouter.ai/api/v1/responses&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">  headers</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">=</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">{</span></span>
<span class="line"><span style="color:#0A3069;--shiki-dark:#CE9178">    &quot;Authorization&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;Bearer &lt;OPENROUTER_API_KEY&gt;&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#0A3069;--shiki-dark:#CE9178">    &quot;Content-Type&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;application/json&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:#953800;--shiki-dark:#9CDCFE">  data</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">=</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">json.dumps({</span></span>
<span class="line"><span style="color:#0A3069;--shiki-dark:#CE9178">    &quot;model&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;anthropic/claude-haiku-4.5&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#0A3069;--shiki-dark:#CE9178">    &quot;stream&quot;</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:#0A3069;--shiki-dark:#CE9178">    &quot;input&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;Hello!&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#0A3069;--shiki-dark:#CE9178">    &quot;debug&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span></span>
<span class="line"><span style="color:#0A3069;--shiki-dark:#CE9178">      &quot;echo_upstream_body&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </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 style="color:#953800;--shiki-dark:#9CDCFE">  stream</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">=</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>
<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">for</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> line </span><span style="color:#CF222E;--shiki-dark:#C586C0">in</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> response.iter_lines():</span></span>
<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">  if</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> line:</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    text </span><span style="color:#CF222E;--shiki-dark:#D4D4D4">=</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> line.decode(</span><span style="color:#0A3069;--shiki-dark:#CE9178">&#x27;utf-8&#x27;</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:#0A3069;--shiki-dark:#CE9178"> &#x27;response.debug&#x27;</span><span style="color:#CF222E;--shiki-dark:#569CD6"> in</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> text:</span></span>
<span class="line"><span style="color:#0550AE;--shiki-dark:#DCDCAA">      print</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(text)</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></div>
<h3 class="flex whitespace-pre-wrap group font-semibold" id="debug-response-format"><div class="absolute" tabindex="-1"><a href="#debug-response-format" 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">Debug response format</span></h3>
<h4 class="flex whitespace-pre-wrap group font-semibold" id="chat-completions-2"><div class="absolute" tabindex="-1"><a href="#chat-completions-2" 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">Chat Completions</span></h4>
<span data-as="p">When <code>debug.echo_upstream_body</code> is set to <code>true</code>, OpenRouter sends a debug chunk as the <strong>first chunk</strong> in the streaming response. This chunk has an empty <code>choices</code> array and includes a <code>debug</code> field with the transformed request body:</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="22" 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_1tb2sllktbsnlhjiuasnpfiutb_" 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_1ub2sllktbsnlhjiuasnpfiutb_" 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_1vb2sllktbsnlhjiuasnpfiutb_" 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-_____id____gen-xxxxx"><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_1j2sllktbsnlhjiuasnpfiutb_-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="22"><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;gen-xxxxx&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">  &quot;provider&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;Anthropic&quot;</span><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-haiku-4.5&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">  &quot;object&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;chat.completion.chunk&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">  &quot;created&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0550AE;--shiki-dark:#B5CEA8">1234567890</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">  &quot;choices&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: [],</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">  &quot;debug&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">    &quot;echo_upstream_body&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;system&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: [</span></span>
<span class="line"><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;text&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#116329;--shiki-dark:#9CDCFE">&quot;text&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;You are a helpful assistant.&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;messages&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: [</span></span>
<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">        { </span><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 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;Hello!&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;model&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;claude-haiku-4-5-20251001&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;stream&quot;</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:#116329;--shiki-dark:#9CDCFE">      &quot;max_tokens&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0550AE;--shiki-dark:#B5CEA8">64000</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;temperature&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0550AE;--shiki-dark:#B5CEA8">1</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 22 lines</button></div></div>
<h4 class="flex whitespace-pre-wrap group font-semibold" id="responses-api-2"><div class="absolute" tabindex="-1"><a href="#responses-api-2" 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">Responses API</span></h4>
<span data-as="p">On the Responses API, debug data arrives as a <code>response.debug</code> SSE event:</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="15" 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_1tb3kllktbsnlhjiuasnpfiutb_" 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_1ub3kllktbsnlhjiuasnpfiutb_" 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_1vb3kllktbsnlhjiuasnpfiutb_" 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-_____type____respons"><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_1j3kllktbsnlhjiuasnpfiutb_-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="15"><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;response.debug&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">  &quot;debug&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">    &quot;echo_upstream_body&quot;</span><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;claude-haiku-4-5-20251001&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 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 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;Hello!&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;stream&quot;</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:#116329;--shiki-dark:#9CDCFE">      &quot;max_tokens&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0550AE;--shiki-dark:#B5CEA8">64000</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
<span class="line"><span style="color:#116329;--shiki-dark:#9CDCFE">      &quot;temperature&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0550AE;--shiki-dark:#B5CEA8">1</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;sequence_number&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0550AE;--shiki-dark:#B5CEA8">0</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="important-notes"><div class="absolute" tabindex="-1"><a href="#important-notes" 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">Important notes</span></h3>
<div role="note" aria-label="Warning" class="callout my-4 px-5 py-4 overflow-hidden rounded-2xl flex gap-3 border border-yellow-200 bg-yellow-50 dark:border-yellow-900 dark:bg-yellow-600/20 [&amp;_[data-component-part=&#x27;callout-icon&#x27;]]:mt-px" data-callout-type="warning"><div class="mt-0.5 w-4" data-component-part="callout-icon"><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="flex-none size-5 text-yellow-800 dark:text-yellow-300"><path d="M 9 6.75 v 1.5 m 0 3 h 0.0075 m -5.2035 3 h 10.392 c 1.155 0 1.8765 -1.2503 1.299 -2.25 L 10.299 3 c -0.5775 -0.9997 -2.0205 -0.9997 -2.598 0 L 2.505 12 c -0.5775 0.9997 0.144 2.25 1.299 2.25 z" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path></svg></div><div class="text-sm prose dark:prose-invert min-w-0 w-full [&amp;_kbd]:bg-background-light dark:[&amp;_kbd]:bg-background-dark [&amp;_code]:text-current! [&amp;_kbd]:text-current! [&amp;_a]:text-current! [&amp;_a]:border-current [&amp;_strong]:text-current! text-yellow-800 dark:text-yellow-300" data-component-part="callout-content"><span data-as="p"><strong>Streaming Only</strong></span><span data-as="p">The debug option <strong>only works with streaming mode</strong> (<code>stream: true</code>). Non-streaming requests will ignore the debug parameter.</span></div></div>
<div role="note" aria-label="Warning" class="callout my-4 px-5 py-4 overflow-hidden rounded-2xl flex gap-3 border border-yellow-200 bg-yellow-50 dark:border-yellow-900 dark:bg-yellow-600/20 [&amp;_[data-component-part=&#x27;callout-icon&#x27;]]:mt-px" data-callout-type="warning"><div class="mt-0.5 w-4" data-component-part="callout-icon"><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="flex-none size-5 text-yellow-800 dark:text-yellow-300"><path d="M 9 6.75 v 1.5 m 0 3 h 0.0075 m -5.2035 3 h 10.392 c 1.155 0 1.8765 -1.2503 1.299 -2.25 L 10.299 3 c -0.5775 -0.9997 -2.0205 -0.9997 -2.598 0 L 2.505 12 c -0.5775 0.9997 0.144 2.25 1.299 2.25 z" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path></svg></div><div class="text-sm prose dark:prose-invert min-w-0 w-full [&amp;_kbd]:bg-background-light dark:[&amp;_kbd]:bg-background-dark [&amp;_code]:text-current! [&amp;_kbd]:text-current! [&amp;_a]:text-current! [&amp;_a]:border-current [&amp;_strong]:text-current! text-yellow-800 dark:text-yellow-300" data-component-part="callout-content"><span data-as="p"><strong>Not for Production</strong></span><span data-as="p">The debug flag should <strong>not be used in production environments</strong>. It is intended for development and debugging purposes only, as it may potentially return sensitive information included in the request that was not intended to be visible elsewhere.</span></div></div>
<h3 class="flex whitespace-pre-wrap group font-semibold" id="use-cases"><div class="absolute" tabindex="-1"><a href="#use-cases" 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">Use cases</span></h3>
<span data-as="p">The debug output is particularly useful for:</span>
<ol>
<li>
<span data-as="p"><strong>Understanding Parameter Transformations</strong>: See how OpenRouter maps your parameters to provider-specific formats (e.g., how <code>max_tokens</code> is set, how <code>temperature</code> is handled).</span>
</li>
<li>
<span data-as="p"><strong>Verifying Message Formatting</strong>: Check how OpenRouter combines and formats your messages for different providers (e.g., how system messages are concatenated, how user messages are merged).</span>
</li>
<li>
<span data-as="p"><strong>Checking Applied Defaults</strong>: See what default values OpenRouter applies when parameters are not specified in your request.</span>
</li>
<li>
<span data-as="p"><strong>Debugging Provider Fallbacks</strong>: When using provider fallbacks, a debug chunk will be sent for <strong>each attempted provider</strong>, allowing you to see which providers were tried and what parameters were sent to each.</span>
</li>
</ol>
<h3 class="flex whitespace-pre-wrap group font-semibold" id="privacy-and-redaction"><div class="absolute" tabindex="-1"><a href="#privacy-and-redaction" 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">Privacy and redaction</span></h3>
<span data-as="p">OpenRouter will make a best effort to automatically redact potentially sensitive or noisy data from debug output. Remember that the debug option is not intended for production.</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: Parameters" 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/api_reference/parameters"><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">Parameters</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/api_reference/responses/overview"><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\",\"api_reference\",\"errors-and-debugging\"],\"i\":false,\"f\":[[[\"\",{\"children\":[\"%5Fsites\",{\"children\":[[\"subdomain\",\"openrouter-d02e98a0\",\"d\"],{\"children\":[\"(multitenant)\",{\"children\":[[\"slug\",\"api_reference/errors-and-debugging\",\"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\",\"api_reference/errors-and-debugging\",\"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,"1c:{\"metadata\":[[\"$\",\"title\",\"0\",{\"children\":\"API Error Handling and Debugging - Complete Guide\"}],[\"$\",\"meta\",\"1\",{\"name\":\"description\",\"content\":\"API Errors and Debugging\"}],[\"$\",\"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/api_reference/errors-and-debugging\"}],[\"$\",\"link\",\"8\",{\"rel\":\"alternate\",\"type\":\"application/xml\",\"href\":\"/docs/sitemap.xml\"}],[\"$\",\"link\",\"9\",{\"rel\":\"alternate\",\"type\":\"text/markdown\",\"href\":\"/docs/api_reference/errors-and-debugging.md\"}],[\"$\",\"meta\",\"10\",{\"property\":\"og:title\",\"content\":\"API Error Handling and Debugging - Complete Guide\"}],[\"$\",\"meta\",\"11\",{\"property\":\"og:description\",\"content\":\"Learn how to handle errors and debug requests in OpenRouter API interactions. Comprehensive guide to error codes, messages, debugging options, and best practices.\"}],[\"$\",\"meta\",\"12\",{\"property\":\"og:url\",\"content\":\"https://openrouter.ai/docs/api_reference/errors-and-debugging\"}],[\"$\",\"meta\",\"13\",{\"property\":\"og:site_name\",\"content\":\"OpenRouter Documentation\"}],[\"$\",\"meta\",\"14\",{\"property\":\"og:image\",\"content\":\"https://openrouter.ai/dynamic-og?title=API%20Error%20Handling%20and%20Debugging\u0026description=Learn%20how%20to%20handle%20errors%20and%20debug%20requests%20in%20OpenRouter%20API%20interactions.\"}],[\"$\",\"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\":\"API Error Handling and Debugging - Complete Guide\"}],[\"$\",\"meta\",\"20\",{\"name\":\"twitter:description\",\"content\":\"Learn how to handle errors and debug requests in OpenRouter API interactions. Comprehensive guide to error codes, messages, debugging options, and best practices.\"}],[\"$\",\"meta\",\"21\",{\"name\":\"twitter:image\",\"content\":\"https://openrouter.ai/dynamic-og?title=API%20Error%20Handling%20and%20Debugging\u0026description=Learn%20how%20to%20handle%20errors%20and%20debug%20requests%20in%20OpenRouter%20API%20interactions.\"}],[\"$\",\"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)\"}],\"$L22\",\"$L23\",\"$L24\",\"$L25\"],\"error\":null,\"digest\":\"$undefined\"}\n"])</script><script>self.__next_f.push([1,"21:\"$1c:metadata\"\n"])</script><script>self.__next_f.push([1,"26:I[27201,[\"/docs/_next/static/chunks/19ae1768f166fab9.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\",\"/docs/_next/static/chunks/b664fc8bb1e7ab0d.js?dpl=dpl_DiH4JSspKRWUSpYuPX65YyMjrsgK\"],\"IconMark\"]\n22:[\"$\",\"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)\"}]\n23:[\"$\",\"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)\"}]\n24:[\"$\",\"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)\"}]\n25:[\"$\",\"$L26\",\"33\",{}]\n"])</script><script>self.__next_f.push([1,"27: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,"28: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,"29: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,"2a: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,"2b: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,"2c: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,"2d: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,"2e: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,[\"$\",\"$L27\",null,{\"subdomain\":\"openrouter-d02e98a0\"}],[\"$\",\"$L28\",null,{\"isLivePreviewRoute\":false,\"children\":[[\"$\",\"$L29\",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,[\"$\",\"$L2a\",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)\"}}],[\"$\",\"$L2b\",null,{\"appId\":\"$undefined\",\"autoBoot\":true,\"children\":[\"$\",\"$L2c\",null,{\"value\":{\"auth\":\"$undefined\",\"userAuth\":\"$undefined\"},\"children\":[\"$\",\"$L2d\",null,{\"value\":{\"subdomain\":\"openrouter-d02e98a0\",\"actualSubdomain\":\"openrouter-d02e98a0\",\"gitSource\":{\"type\":\"github\",\"owner\":\"openrouterteam\",\"repo\":\"docs\",\"deployBranch\":\"main\",\"contentDirectory\":\"\",\"isPrivate\":false,\"mountPath\":\"\",\"label\":\"\"},\"chroma\":{\"collectionId\":\"dc11a0e9-b1d5-4637-97c0-33856f152add\",\"liveDeploymentHistoryId\":\"6a8799a5798e682b30d8e238\",\"schemaVersion\":\"v3\",\"latestBuiltDeploymentHistoryId\":\"6a8799a5798e682b30d8e238\"},\"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\":[\"$\",\"$L2e\",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\":\"$L2f\"}]}]}]}]]}]]}]]\n"])</script><script>self.__next_f.push([1,"30: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,"31: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,"32: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,"33: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,"34: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,"35: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,"36: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,"37: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,"38: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,"39: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,"3a: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,"2f:[\"$\",\"$L30\",null,{\"children\":[\"$\",\"$L31\",null,{\"children\":[\"$\",\"$L32\",null,{\"children\":[\"$\",\"$L33\",null,{\"pageListDataMap\":{},\"children\":[\"$\",\"$L34\",null,{\"disabled\":\"$undefined\",\"children\":[\"$\",\"$L35\",null,{\"children\":[\"$\",\"$L36\",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\"}],[\"$\",\"$L37\",null,{\"fonts\":\"$17:2:props:children:1:props:children:6:props:children:props:children:props:children:props:value:docsConfig:fonts\",\"children\":[\"$\",\"$L38\",null,{\"bannersByLocale\":{},\"subdomain\":\"openrouter-d02e98a0\",\"children\":[[\"$\",\"$L39\",null,{\"theme\":\"mint\"}],[\"$\",\"$L2a\",null,{\"strategy\":\"beforeInteractive\",\"id\":\"_mintlify-scroll-margin-script\",\"dangerouslySetInnerHTML\":{\"__html\":\"$3a\"},\"suppressHydrationWarning\":true}],\"$L3b\"]}]}]]]}]}]}]}]}]}]}]\n"])</script><script>self.__next_f.push([1,"3c: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,"3d: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,"3e: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,"3b:[\"$\",\"$L3c\",null,{\"privacy\":\"$undefined\",\"children\":[\"$\",\"$L3d\",null,{\"subdomain\":\"openrouter-d02e98a0\",\"isAtlas\":false,\"children\":[\"$\",\"$L3e\",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\":\"$L3f\"}]}]}]\n"])</script><script>self.__next_f.push([1,"40: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,"41: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,"42: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,"43: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,"44: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,"3f:[\"$\",\"$L40\",null,{\"enabled\":true,\"isPreview\":false,\"children\":[\"$\",\"$L41\",null,{\"subdomain\":\"openrouter-d02e98a0\",\"hasChatPermissions\":true,\"isLoggedInCli\":false,\"assistantConfig\":{\"enableAskAiButton\":false,\"enableStarterQuestions\":false,\"enableContextualStarterQuestions\":false,\"enableAskAiSearchBar\":true},\"starterQuestions\":\"$undefined\",\"children\":[[\"$\",\"$L42\",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,[\"$\",\"$L43\",null,{\"children\":[[\"$\",\"$Ld\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$Lf\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[\"$\",\"$L44\",null,{\"source\":\"multitenant\"}],[]],\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}],\"$undefined\"]}]]}]}]\n"])</script><script>self.__next_f.push([1,"45: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,"46:T5ef,"])</script><script>self.__next_f.push([1,"Returns the top public apps on OpenRouter ranked by token usage inside the requested\ndate window, matching the public apps marketplace on openrouter.ai/apps. Token totals\nare `prompt_tokens + completion_tokens`; hidden and private apps are excluded and\ntraffic from related app aliases is merged into the canonical visible app.\n\n`sort=popular` (default) ranks by total token volume inside the window.\n`sort=trending` ranks by absolute excess token growth: window volume minus the average\nvolume of the three equal-length periods immediately preceding the window. Apps with\nno excess growth are omitted, so `trending` may return fewer than `limit` rows.\n\nFilter with `category` (marketplace category group, e.g. `coding`) or `subcategory`\n(e.g. `cli-agent`). Ranks are re-numbered 1..N after filtering. Page with `offset` —\n`rank` stays absolute, so the first row of `offset=50` is `rank: 51`.\n\nAuthenticate with any valid OpenRouter API key (same key used for inference).\nRate-limited to 30 requests/minute per key and 500 requests/day per account.\n\nWhen republishing or quoting this dataset, OpenRouter must be cited as:\n\"Source: OpenRouter (openrouter.ai/apps), as of {as_of}.\"\n\nToken counts come from each upstream provider's own tokenizer, so a token attributed\nto one app is not directly comparable to a token attributed to another app whose\ntraffic flows through a different provider.\n\nLicensed under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/): reuse and republish with attribution to OpenRouter."])</script><script>self.__next_f.push([1,"47:T677,"])</script><script>self.__next_f.push([1,"Returns the top 50 public models per day by total token usage on OpenRouter, plus a\nsingle aggregated `other` row per day that sums every model outside that top 50.\nToken totals are `prompt_tokens + completion_tokens`, matching the public rankings\nchart on openrouter.ai/rankings.\n\nEach row is a distinct `(date, model_permaslug)` pair. The `other` row uses the\nreserved permaslug `other` and is always returned last within its date, so callers\ncan compute `top-50 traffic / total daily traffic` without a second request.\n\nOptional filters slice the dataset. `period` (`day`/`week`/`month`) sets the time\ngrain. `modality` and `context_bucket` narrow the exact dataset by output/input\nmodality (or tool-calling activity) and request context length. `category` and\n`language_type` instead read a sampled, upsampled dataset whose `total_tokens` are\nweekly-grain estimates — they cannot be combined with each other or with the exact\nfilters, and reject `period=day` with a 400.\n\nAuthenticate with any valid OpenRouter API key (same key used for inference).\nRate-limited to 30 requests/minute per key and 500 requests/day per account.\n\nWhen republishing or quoting this dataset, OpenRouter must be cited as:\n\"Source: OpenRouter (openrouter.ai/rankings), as of {as_of}.\"\n\nToken counts come from each upstream provider's own tokenizer (Anthropic counts\nare as reported by Anthropic, OpenAI counts are as reported by OpenAI, etc.), so\na token in one row is not directly comparable to a token in another row from a\ndifferent provider.\n\nLicensed under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/): reuse and republish with attribution to OpenRouter."])</script><script>self.__next_f.push([1,"18:[\"$\",\"$L45\",null,{\"scopedNav\":{\"global\":null,\"tabs\":[{\"tab\":\"Docs\",\"icon\":\"book\",\"pages\":[{\"title\":\"Docs\",\"href\":\"/quickstart\"}]},{\"tab\":\"API Reference\",\"icon\":\"code\",\"groups\":[{\"group\":\"API Guides\",\"icon\":\"code\",\"pages\":[{\"title\":\"API Reference\",\"description\":\"An overview of OpenRouter's API\",\"seoTitle\":\"OpenRouter API Reference | Complete API Documentation\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"OpenRouter API Reference - Complete Documentation\",\"og:description\":\"Comprehensive guide to OpenRouter's API. Learn about request/response schemas, authentication, parameters, and integration with multiple AI model providers.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=OpenRouter%20API%20Reference\u0026description=Comprehensive%20guide%20to%20OpenRouter's%20API.\",\"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\":\"/api_reference/overview\"},{\"title\":\"Streaming\",\"seoTitle\":\"API Streaming | Real-time Model Responses in OpenRouter\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"API Streaming - Real-time Model Response Integration\",\"og:description\":\"Learn how to implement streaming responses with OpenRouter's API. Complete guide to Server-Sent Events (SSE) and real-time model outputs.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=API%20Streaming\u0026description=Real-time%20model%20response%20streaming\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"bars-staggered\",\"description\":null,\"href\":\"/api_reference/streaming\"},{\"title\":\"Embeddings\",\"description\":\"Generate vector embeddings from text and images\",\"seoTitle\":\"Embeddings API | Convert Text and Images to Vector Representations with OpenRouter\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Embeddings API - Generate Vector Embeddings from Text and Images\",\"og:description\":\"Generate vector embeddings from text and images using OpenRouter's unified embeddings API. Access multiple embedding models from different providers with a single interface.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Embeddings%20API\u0026description=Generate%20Vector%20Embeddings%20from%20Text%20and%20Images\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"draw-square\",\"href\":\"/api_reference/embeddings\"},{\"title\":\"Limits\",\"description\":\"Credit Limits and Rate Limits\",\"seoTitle\":\"API Credit \u0026 Rate Limits | Handle 402 and 429 Errors in OpenRouter\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"API Credit \u0026 Rate Limits - Handle 402 and 429 Errors\",\"og:description\":\"Learn about OpenRouter's credit limits (402) and rate limits (429), free-model quotas, and DDoS protection. Monitor usage and handle limit errors effectively.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=API%20Credit%20%26%20Rate%20Limits\u0026description=Handle%20402%20and%20429%20Errors\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"gauge-high\",\"href\":\"/api_reference/limits\"},{\"title\":\"Authentication\",\"description\":\"API Authentication\",\"seoTitle\":\"API Authentication | OpenRouter OAuth and API Keys\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"API Authentication - Secure Access to OpenRouter\",\"og:description\":\"Learn how to authenticate with OpenRouter using API keys and Bearer tokens. Complete guide to secure authentication methods and best practices.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=API%20Authentication\u0026description=Secure%20access%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\":\"/api_reference/authentication\"},{\"title\":\"Parameters\",\"seoTitle\":\"API Parameters | Configure OpenRouter API Requests\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"API Parameters - Complete Guide to Request Configuration\",\"og:description\":\"Learn about all available parameters for OpenRouter API requests. Configure temperature, max tokens, top_p, and other model-specific settings.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=API%20Parameters\u0026description=Complete%20guide%20to%20request%20configuration\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"gear\",\"description\":null,\"href\":\"/api_reference/parameters\"},{\"title\":\"Errors and Debugging\",\"description\":\"API Errors and Debugging\",\"seoTitle\":\"API Error Handling and Debugging | OpenRouter Documentation\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"API Error Handling and Debugging - Complete Guide\",\"og:description\":\"Learn how to handle errors and debug requests in OpenRouter API interactions. Comprehensive guide to error codes, messages, debugging options, and best practices.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=API%20Error%20Handling%20and%20Debugging\u0026description=Learn%20how%20to%20handle%20errors%20and%20debug%20requests%20in%20OpenRouter%20API%20interactions.\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"triangle-exclamation\",\"href\":\"/api_reference/errors-and-debugging\"},{\"group\":\"Responses API\",\"icon\":\"reply\",\"pages\":[{\"title\":\"Responses API\",\"sidebarTitle\":\"Overview\",\"description\":\"OpenAI-compatible Responses API\",\"seoTitle\":\"OpenRouter Responses API\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"OpenRouter Responses API - OpenAI-Compatible Documentation\",\"og:description\":\"OpenRouter's OpenAI-compatible Responses API. Stateless transformation layer with support for reasoning, tool calling, and web search.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Responses%20API\u0026description=OpenAI-compatible%20stateless%20API\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"compass\",\"href\":\"/api_reference/responses/overview\"},{\"title\":\"Basic Usage\",\"description\":\"Getting started with the Responses API\",\"seoTitle\":\"Responses API Basic Usage | Simple Text Requests\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Responses API Basic Usage - Simple Text Requests\",\"og:description\":\"Learn the basics of OpenRouter's Responses API with simple text input examples and response handling.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Responses%20API%20Basic%20Usage\u0026description=Simple%20text%20requests%20and%20responses\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"play\",\"href\":\"/api_reference/responses/basic-usage\"},{\"title\":\"Reasoning\",\"description\":\"Advanced reasoning capabilities with the Responses API\",\"seoTitle\":\"Responses API Reasoning | Advanced AI Reasoning Capabilities\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Responses API Reasoning - Advanced AI Reasoning\",\"og:description\":\"Access advanced reasoning capabilities with configurable effort levels and encrypted reasoning chains using OpenRouter's Responses API.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Responses%20API%20Reasoning\u0026description=Advanced%20AI%20reasoning%20capabilities\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"lightbulb\",\"href\":\"/api_reference/responses/reasoning\"},{\"title\":\"Tool Calling\",\"description\":\"Function calling and tool integration with the Responses API\",\"seoTitle\":\"Responses API Tool Calling | Function Calling Integration\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Responses API Tool Calling - Function Calling Integration\",\"og:description\":\"Integrate function calling with support for parallel execution and complex tool interactions using OpenRouter's Responses API.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Responses%20API%20Tool%20Calling\u0026description=Function%20calling%20integration\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"toolbox\",\"href\":\"/api_reference/responses/tool-calling\"},{\"title\":\"Web Search\",\"description\":\"Real-time web search integration with the Responses API\",\"seoTitle\":\"Responses API Web Search | Real-time Information Retrieval\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Responses API Web Search - Real-time Information Retrieval\",\"og:description\":\"Enable web search capabilities with real-time information retrieval and citation annotations using OpenRouter's Responses API.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Responses%20API%20Web%20Search\u0026description=Real-time%20information%20retrieval\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"globe-pointer\",\"href\":\"/api_reference/responses/web-search\"},{\"title\":\"Error Handling\",\"description\":\"Understanding and handling errors in the Responses API\",\"seoTitle\":\"Responses API Error Handling | Basic Error Guide\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"Responses API Error Handling - Basic Error Guide\",\"og:description\":\"Learn how to handle errors in OpenRouter's Responses API with the basic error response format.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=Responses%20API%20Error%20Handling\u0026description=Basic%20error%20handling%20guide\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"triangle-exclamation\",\"href\":\"/api_reference/responses/error-handling\"}]}]},{\"group\":\"Versioning\",\"icon\":\"code-branch\",\"pages\":[{\"title\":\"API Versioning\",\"description\":\"How the OpenRouter API is versioned, what we consider a breaking change, and how deprecations are communicated.\",\"icon\":\"code-branch\",\"href\":\"/api_reference/versioning\"},{\"title\":\"API Changelog\",\"description\":\"Changes to the OpenRouter API, generated from the OpenAPI specification on every release.\",\"icon\":\"clock-rotate-left\",\"rss\":true,\"href\":\"/changelog\"}]},{\"group\":\"API Reference\",\"icon\":\"code\",\"pages\":[{\"group\":\"Analytics\",\"pages\":[{\"title\":\"Get user activity grouped by endpoint\",\"description\":\"Returns user activity data grouped by endpoint for the last 30 (completed) UTC days. Pass `workspace_id` to scope the response to a single workspace. Pass `group_by=workspace` to split each row per workspace and include `workspace_id` on every item; by default rows are aggregated across workspaces and `workspace_id` is not returned. Activity recorded before workspace resolution existed is permanently attributed to the account default workspace (no backfill is possible). [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml get /activity\",\"href\":\"/api/api-reference/analytics/get-user-activity-grouped-by-endpoint\",\"autogeneratedByOpenApi\":true},{\"title\":\"Get available analytics metrics and dimensions\",\"description\":\"Returns the available metrics, dimensions, filter operators, and granularities for the analytics query endpoint. [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml get /analytics/meta\",\"href\":\"/api/api-reference/analytics/get-available-analytics-metrics-and-dimensions\",\"autogeneratedByOpenApi\":true},{\"title\":\"Query analytics data\",\"description\":\"Execute an analytics query with specified metrics, dimensions, filters, and time range. [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml post /analytics/query\",\"href\":\"/api/api-reference/analytics/query-analytics-data\",\"autogeneratedByOpenApi\":true}]},{\"group\":\"TTS\",\"pages\":[{\"title\":\"Create speech\",\"description\":\"Synthesizes audio from the input text. Returns a raw audio bytestream in the requested format (e.g. mp3, pcm, wav).\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml post /audio/speech\",\"href\":\"/api/api-reference/tts/create-speech\",\"autogeneratedByOpenApi\":true}]},{\"group\":\"STT\",\"pages\":[{\"title\":\"Create transcription\",\"description\":\"Transcribes audio into text. Accepts base64-encoded audio input as JSON or an OpenAI-style multipart/form-data file upload, and returns the transcribed text.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml post /audio/transcriptions\",\"href\":\"/api/api-reference/stt/create-transcription\",\"autogeneratedByOpenApi\":true}]},{\"group\":\"OAuth\",\"pages\":[{\"title\":\"Exchange authorization code for API key\",\"description\":\"Exchange an authorization code from the PKCE flow for a user-controlled API key\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml post /auth/keys\",\"href\":\"/api/api-reference/oauth/exchange-authorization-code-for-api-key\",\"autogeneratedByOpenApi\":true},{\"title\":\"Create authorization code\",\"description\":\"Create an authorization code for the PKCE flow to generate a user-controlled API key\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml post /auth/keys/code\",\"href\":\"/api/api-reference/oauth/create-authorization-code\",\"autogeneratedByOpenApi\":true}]},{\"group\":\"Benchmarks\",\"pages\":[{\"title\":\"List Benchmarks\",\"description\":\"Unified benchmark endpoint that aggregates scores from multiple benchmark sources (Artificial Analysis, Design Arena, and OpenRouter's own tau-bench, GPQA, and web-search evals). Filter by source to reproduce the exact shapes from the legacy per-source endpoints, or use task_type to find models suited for specific workloads. Use task_type=search (or a search_* benchmark_type) for OpenRouter's search benchmarks, which publish each model's highest-scoring eligible evaluation configuration with same-configuration runs combined by task-weighted mean. Authenticate with any valid OpenRouter API key. Rate-limited to 30 requests/minute per key and 500 requests/day per account.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml get /benchmarks\",\"href\":\"/api/api-reference/benchmarks/list-benchmarks\",\"autogeneratedByOpenApi\":true}]},{\"group\":\"BYOK\",\"pages\":[{\"title\":\"List BYOK provider credentials\",\"description\":\"List the bring-your-own-key (BYOK) provider credentials for the authenticated entity's default workspace. Use the `workspace_id` query parameter to scope the result to a different workspace, or the `provider` query parameter to filter by upstream provider. [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml get /byok\",\"href\":\"/api/api-reference/byok/list-byok-provider-credentials\",\"autogeneratedByOpenApi\":true},{\"title\":\"Create a BYOK provider credential\",\"description\":\"Create a new bring-your-own-key (BYOK) provider credential. The raw key is encrypted at rest and never returned in API responses. When `workspace_id` is omitted, the credential is created in the default workspace; if that default has been deleted, the request returns a 400 and you must pass `workspace_id` explicitly. Treat the raw key as write-only; it is never returned after creation. [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml post /byok\",\"href\":\"/api/api-reference/byok/create-a-byok-provider-credential\",\"autogeneratedByOpenApi\":true},{\"title\":\"Get a BYOK provider credential\",\"description\":\"Get a single bring-your-own-key (BYOK) provider credential by its `id`. [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml get /byok/{id}\",\"href\":\"/api/api-reference/byok/get-a-byok-provider-credential\",\"autogeneratedByOpenApi\":true},{\"title\":\"Delete a BYOK provider credential\",\"description\":\"Delete (soft-delete) a bring-your-own-key (BYOK) provider credential by its `id`. The encrypted key material is wiped and the record is marked as deleted. [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml delete /byok/{id}\",\"href\":\"/api/api-reference/byok/delete-a-byok-provider-credential\",\"autogeneratedByOpenApi\":true},{\"title\":\"Update a BYOK provider credential\",\"description\":\"Update an existing bring-your-own-key (BYOK) provider credential by its `id`. Include the `key` field to rotate the raw provider API key in-place (the previous key material is overwritten). [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml patch /byok/{id}\",\"href\":\"/api/api-reference/byok/update-a-byok-provider-credential\",\"autogeneratedByOpenApi\":true}]},{\"group\":\"Chat\",\"pages\":[{\"title\":\"Create a chat completion\",\"description\":\"Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml post /chat/completions\",\"href\":\"/api/api-reference/chat/create-a-chat-completion\",\"autogeneratedByOpenApi\":true}]},{\"group\":\"Classifications\",\"pages\":[{\"title\":\"Task classification market share\",\"description\":\"Returns the market-share breakdown of OpenRouter traffic by task classification\\n(e.g. code generation, web search, summarization) over a trailing time window.\\n\\nEach classification reports its share of classified sampled requests (`usage_share`)\\nand classified sampled token volume (`token_share`) as fractions between 0 and 1.\\nThe unclassified `other` bucket is excluded. Absolute volumes are not exposed\\nbecause the underlying data is sampled.\\n\\nEach classification also includes a `models` array listing the top models by\\nrequest volume within that classification, with their within-tag usage and token shares.\\n\\nClassifications are grouped into macro-categories (Code, Data, Agent, General)\\nwith aggregate shares provided for each.\\n\\nAuthenticate with any valid OpenRouter API key (same key used for inference).\\nRate-limited to 30 requests/minute per key and 500 requests/day per account.\\n\\nWhen republishing or quoting this data, cite as:\\n\\\"Source: OpenRouter (openrouter.ai/rankings), as of {as_of}.\\\"\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml get /classifications/task\",\"href\":\"/api/api-reference/classifications/task-classification-market-share\",\"autogeneratedByOpenApi\":true}]},{\"group\":\"Credits\",\"pages\":[{\"title\":\"Get remaining credits\",\"description\":\"Get total credits purchased and used for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml get /credits\",\"href\":\"/api/api-reference/credits/get-remaining-credits\",\"autogeneratedByOpenApi\":true},{\"title\":\"Deprecated Coinbase Commerce charge endpoint\",\"description\":\"Deprecated. The Coinbase APIs used by this endpoint have been deprecated, so Coinbase Commerce charges have been removed. Use the web credits purchase flow instead.\",\"deprecated\":true,\"version\":null,\"openapi\":\"/openapi/openapi.yaml post /credits/coinbase\",\"href\":\"/api/api-reference/credits/deprecated-coinbase-commerce-charge-endpoint\",\"autogeneratedByOpenApi\":true}]},{\"group\":\"Datasets\",\"pages\":[{\"title\":\"Top apps by token usage\",\"description\":\"$46\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml get /datasets/app-rankings\",\"href\":\"/api/api-reference/datasets/top-apps-by-token-usage\",\"autogeneratedByOpenApi\":true},{\"title\":\"Daily token totals for top 50 models\",\"description\":\"$47\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml get /datasets/rankings-daily\",\"href\":\"/api/api-reference/datasets/daily-token-totals-for-top-50-models\",\"autogeneratedByOpenApi\":true},{\"title\":\"Cost per session by harness and model\",\"description\":\"Returns weekly refreshed, aggregated cost-per-session cells for the published harnesses.\\nSessions are never pooled across apps. Medians are of per-session USD spend, and\\nprivacy-preserving aggregation never exposes clerk_user_id values or per-session rows.\\n\\nFilter by `app_slug`, `model`, or `turn_range`. Filtering by `model` alone works across apps\\nfor harness-vs-harness comparison at a fixed model. Results refresh weekly and include the source snapshot\\nwindow in `meta`.\\n\\nLicensed under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/): reuse and republish with attribution to OpenRouter.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml get /datasets/session-cost\",\"href\":\"/api/api-reference/datasets/cost-per-session-by-harness-and-model\",\"autogeneratedByOpenApi\":true}]},{\"group\":\"Embeddings\",\"pages\":[{\"title\":\"Submit an embedding request\",\"description\":\"Submits an embedding request to the embeddings router\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml post /embeddings\",\"href\":\"/api/api-reference/embeddings/submit-an-embedding-request\",\"autogeneratedByOpenApi\":true},{\"title\":\"List all embeddings models\",\"description\":\"Returns a list of all available embeddings models and their properties\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml get /embeddings/models\",\"href\":\"/api/api-reference/embeddings/list-all-embeddings-models\",\"autogeneratedByOpenApi\":true}]},{\"group\":\"Endpoints\",\"pages\":[{\"title\":\"Preview the impact of ZDR on the available endpoints\",\"description\":null,\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml get /endpoints/zdr\",\"href\":\"/api/api-reference/endpoints/preview-the-impact-of-zdr-on-the-available-endpoints\",\"autogeneratedByOpenApi\":true},{\"title\":\"List all endpoints for a model\",\"description\":null,\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml get /models/{author}/{slug}/endpoints\",\"href\":\"/api/api-reference/endpoints/list-all-endpoints-for-a-model\",\"autogeneratedByOpenApi\":true}]},{\"group\":\"Files\",\"pages\":[]},{\"group\":\"Generations\",\"pages\":[{\"title\":\"Get request \u0026 usage metadata for a generation\",\"description\":null,\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml get /generation\",\"href\":\"/api/api-reference/generations/get-request-\u0026-usage-metadata-for-a-generation\",\"autogeneratedByOpenApi\":true},{\"title\":\"Get stored prompt, completion, and error content for a generation\",\"description\":null,\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml get /generation/content\",\"href\":\"/api/api-reference/generations/get-stored-prompt-completion-and-error-content-for-a-generation\",\"autogeneratedByOpenApi\":true},{\"title\":\"Submit feedback for a generation\",\"description\":\"Submit structured feedback on a generation the authenticated user made. [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml post /generation/feedback\",\"href\":\"/api/api-reference/generations/submit-feedback-for-a-generation\",\"autogeneratedByOpenApi\":true}]},{\"group\":\"Guardrails\",\"pages\":[{\"title\":\"List guardrails\",\"description\":\"List all guardrails for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml get /guardrails\",\"href\":\"/api/api-reference/guardrails/list-guardrails\",\"autogeneratedByOpenApi\":true},{\"title\":\"Create a guardrail\",\"description\":\"Create a new guardrail for the authenticated user. A newly created guardrail enforces nothing until it is assigned to API keys or organization members; `workspace_id` places the guardrail in a workspace but does not apply it to that workspace's traffic. To restrict all traffic in a workspace, update the workspace's default guardrail instead. [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml post /guardrails\",\"href\":\"/api/api-reference/guardrails/create-a-guardrail\",\"autogeneratedByOpenApi\":true},{\"title\":\"Get a guardrail\",\"description\":\"Get a single guardrail by ID. [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml get /guardrails/{id}\",\"href\":\"/api/api-reference/guardrails/get-a-guardrail\",\"autogeneratedByOpenApi\":true},{\"title\":\"Delete a guardrail\",\"description\":\"Delete an existing guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml delete /guardrails/{id}\",\"href\":\"/api/api-reference/guardrails/delete-a-guardrail\",\"autogeneratedByOpenApi\":true},{\"title\":\"Update a guardrail\",\"description\":\"Update an existing guardrail, or materialize an unconfigured workspace default guardrail. Collection fields use replace semantics: send the full desired set on every update. [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml patch /guardrails/{id}\",\"href\":\"/api/api-reference/guardrails/update-a-guardrail\",\"autogeneratedByOpenApi\":true},{\"title\":\"List key assignments for a guardrail\",\"description\":\"List all API key assignments for a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml get /guardrails/{id}/assignments/keys\",\"href\":\"/api/api-reference/guardrails/list-key-assignments-for-a-guardrail\",\"autogeneratedByOpenApi\":true},{\"title\":\"Bulk assign keys to a guardrail\",\"description\":\"Assign multiple API keys to a specific guardrail. A key may hold at most one guardrail; assigning replaces any existing assignment. [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml post /guardrails/{id}/assignments/keys\",\"href\":\"/api/api-reference/guardrails/bulk-assign-keys-to-a-guardrail\",\"autogeneratedByOpenApi\":true},{\"title\":\"Bulk unassign keys from a guardrail\",\"description\":\"Unassign multiple API keys from a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml post /guardrails/{id}/assignments/keys/remove\",\"href\":\"/api/api-reference/guardrails/bulk-unassign-keys-from-a-guardrail\",\"autogeneratedByOpenApi\":true},{\"title\":\"List member assignments for a guardrail\",\"description\":\"List all organization member assignments for a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml get /guardrails/{id}/assignments/members\",\"href\":\"/api/api-reference/guardrails/list-member-assignments-for-a-guardrail\",\"autogeneratedByOpenApi\":true},{\"title\":\"Bulk assign members to a guardrail\",\"description\":\"Assign multiple organization members to a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml post /guardrails/{id}/assignments/members\",\"href\":\"/api/api-reference/guardrails/bulk-assign-members-to-a-guardrail\",\"autogeneratedByOpenApi\":true},{\"title\":\"Bulk unassign members from a guardrail\",\"description\":\"Unassign multiple organization members from a specific guardrail. [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml post /guardrails/{id}/assignments/members/remove\",\"href\":\"/api/api-reference/guardrails/bulk-unassign-members-from-a-guardrail\",\"autogeneratedByOpenApi\":true},{\"title\":\"List all key assignments\",\"description\":\"List all API key guardrail assignments for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml get /guardrails/assignments/keys\",\"href\":\"/api/api-reference/guardrails/list-all-key-assignments\",\"autogeneratedByOpenApi\":true},{\"title\":\"List all member assignments\",\"description\":\"List all organization member guardrail assignments for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml get /guardrails/assignments/members\",\"href\":\"/api/api-reference/guardrails/list-all-member-assignments\",\"autogeneratedByOpenApi\":true}]},{\"group\":\"Images\",\"pages\":[{\"title\":\"Generate an image\",\"description\":\"Generates an image from a text prompt via the image generation router\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml post /images\",\"href\":\"/api/api-reference/images/generate-an-image\",\"autogeneratedByOpenApi\":true},{\"title\":\"List image generation models\",\"description\":\"Lists every image generation model with its top-level supported-parameter superset and a URL to its full per-endpoint records.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml get /images/models\",\"href\":\"/api/api-reference/images/list-image-generation-models\",\"autogeneratedByOpenApi\":true},{\"title\":\"List endpoints for an image model\",\"description\":\"Returns the full per-endpoint records for an image model: each endpoint's definitive supported parameters, pricing, and passthrough allowlist.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml get /images/models/{author}/{slug}/endpoints\",\"href\":\"/api/api-reference/images/list-endpoints-for-an-image-model\",\"autogeneratedByOpenApi\":true}]},{\"group\":\"API Keys\",\"pages\":[{\"title\":\"Get current API key\",\"description\":\"Get information on the API key associated with the current authentication session\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml get /key\",\"href\":\"/api/api-reference/api-keys/get-current-api-key\",\"autogeneratedByOpenApi\":true},{\"title\":\"List API keys\",\"description\":\"List all API keys for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml get /keys\",\"href\":\"/api/api-reference/api-keys/list-api-keys\",\"autogeneratedByOpenApi\":true},{\"title\":\"Create a new API key\",\"description\":\"Create a new API key for the authenticated user. The plaintext `key` is returned only in this response. Treat it as a write-only, sensitive value; it cannot be retrieved later. [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml post /keys\",\"href\":\"/api/api-reference/api-keys/create-a-new-api-key\",\"autogeneratedByOpenApi\":true},{\"title\":\"Get a single API key\",\"description\":\"Get a single API key by hash. [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml get /keys/{hash}\",\"href\":\"/api/api-reference/api-keys/get-a-single-api-key\",\"autogeneratedByOpenApi\":true},{\"title\":\"Delete an API key\",\"description\":\"Delete an existing API key. [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml delete /keys/{hash}\",\"href\":\"/api/api-reference/api-keys/delete-an-api-key\",\"autogeneratedByOpenApi\":true},{\"title\":\"Update an API key\",\"description\":\"Update an existing API key. [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml patch /keys/{hash}\",\"href\":\"/api/api-reference/api-keys/update-an-api-key\",\"autogeneratedByOpenApi\":true}]},{\"group\":\"Anthropic Messages\",\"pages\":[{\"title\":\"Create a message\",\"description\":\"Creates a message using the Anthropic Messages API format. Supports text, images, PDFs, tools, and extended thinking.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml post /messages\",\"href\":\"/api/api-reference/anthropic-messages/create-a-message\",\"autogeneratedByOpenApi\":true}]},{\"group\":\"Models\",\"pages\":[{\"title\":\"Get a model by its slug\",\"description\":\"Returns full details for a single model identified by its author and slug (e.g. openai/gpt-4). Supports variant suffixes (e.g. openai/gpt-4:free) and resolves known slug aliases.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml get /model/{author}/{slug}\",\"href\":\"/api/api-reference/models/get-a-model-by-its-slug\",\"autogeneratedByOpenApi\":true},{\"title\":\"List all models and their properties\",\"description\":null,\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml get /models\",\"href\":\"/api/api-reference/models/list-all-models-and-their-properties\",\"autogeneratedByOpenApi\":true},{\"title\":\"Get total count of available models\",\"description\":null,\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml get /models/count\",\"href\":\"/api/api-reference/models/get-total-count-of-available-models\",\"autogeneratedByOpenApi\":true},{\"title\":\"List models filtered by user provider preferences, privacy settings, and guardrails\",\"description\":\"List models filtered by user provider preferences, [privacy settings](https://openrouter.ai/docs/guides/privacy/provider-logging), and [guardrails](https://openrouter.ai/docs/guides/features/guardrails). If requesting through a regional hostname, the results will be filtered to models that satisfy in-region routing for that region.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml get /models/user\",\"href\":\"/api/api-reference/models/list-models-filtered-by-user-provider-preferences-privacy-settings-and-guardrails\",\"autogeneratedByOpenApi\":true}]},{\"group\":\"Observability\",\"pages\":[{\"title\":\"List observability destinations\",\"description\":\"List the observability destinations configured for the authenticated entity's default workspace. Use the `workspace_id` query parameter to scope the result to a different workspace. Only destinations with stable release status are surfaced — destinations of other types are excluded. [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml get /observability/destinations\",\"href\":\"/api/api-reference/observability/list-observability-destinations\",\"autogeneratedByOpenApi\":true},{\"title\":\"Create an observability destination\",\"description\":\"Create a new observability destination. A maximum of 5 destinations per type is allowed. Defaults to the authenticated entity's default workspace; use the `workspace_id` body field to scope to a different workspace. [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml post /observability/destinations\",\"href\":\"/api/api-reference/observability/create-an-observability-destination\",\"autogeneratedByOpenApi\":true},{\"title\":\"Get an observability destination\",\"description\":\"Fetch a single observability destination by its UUID. [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml get /observability/destinations/{id}\",\"href\":\"/api/api-reference/observability/get-an-observability-destination\",\"autogeneratedByOpenApi\":true},{\"title\":\"Delete an observability destination\",\"description\":\"Delete an existing observability destination. This performs a soft delete. [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml delete /observability/destinations/{id}\",\"href\":\"/api/api-reference/observability/delete-an-observability-destination\",\"autogeneratedByOpenApi\":true},{\"title\":\"Update an observability destination\",\"description\":\"Update an existing observability destination. Only the fields provided in the request body are updated. [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml patch /observability/destinations/{id}\",\"href\":\"/api/api-reference/observability/update-an-observability-destination\",\"autogeneratedByOpenApi\":true}]},{\"group\":\"Organization\",\"pages\":[{\"title\":\"List organization members\",\"description\":\"List all members of the organization associated with the authenticated management key. [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml get /organization/members\",\"href\":\"/api/api-reference/organization/list-organization-members\",\"autogeneratedByOpenApi\":true}]},{\"group\":\"Presets\",\"pages\":[{\"title\":\"List presets\",\"description\":\"Lists all presets for the authenticated user, ordered by most recently updated first.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml get /presets\",\"href\":\"/api/api-reference/presets/list-presets\",\"autogeneratedByOpenApi\":true},{\"title\":\"Get a preset\",\"description\":\"Retrieves a preset by its slug with its currently designated version inline.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml get /presets/{slug}\",\"href\":\"/api/api-reference/presets/get-a-preset\",\"autogeneratedByOpenApi\":true},{\"title\":\"Create a preset from a chat-completions request body\",\"description\":\"Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml post /presets/{slug}/chat/completions\",\"href\":\"/api/api-reference/presets/create-a-preset-from-a-chat-completions-request-body\",\"autogeneratedByOpenApi\":true},{\"title\":\"Create a preset from a messages request body\",\"description\":\"Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml post /presets/{slug}/messages\",\"href\":\"/api/api-reference/presets/create-a-preset-from-a-messages-request-body\",\"autogeneratedByOpenApi\":true},{\"title\":\"Create a preset from a responses request body\",\"description\":\"Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. `messages`, `stream`, `prompt`) are silently ignored.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml post /presets/{slug}/responses\",\"href\":\"/api/api-reference/presets/create-a-preset-from-a-responses-request-body\",\"autogeneratedByOpenApi\":true},{\"title\":\"List versions of a preset\",\"description\":\"Lists all versions of a preset, ordered by version number ascending (oldest first).\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml get /presets/{slug}/versions\",\"href\":\"/api/api-reference/presets/list-versions-of-a-preset\",\"autogeneratedByOpenApi\":true},{\"title\":\"Get a specific version of a preset\",\"description\":\"Retrieves a specific version of a preset by its slug and version number.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml get /presets/{slug}/versions/{version}\",\"href\":\"/api/api-reference/presets/get-a-specific-version-of-a-preset\",\"autogeneratedByOpenApi\":true}]},{\"group\":\"Providers\",\"pages\":[{\"title\":\"List all providers\",\"description\":null,\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml get /providers\",\"href\":\"/api/api-reference/providers/list-all-providers\",\"autogeneratedByOpenApi\":true}]},{\"group\":\"Rerank\",\"pages\":[{\"title\":\"Submit a rerank request\",\"description\":\"Submits a rerank request to the rerank router\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml post /rerank\",\"href\":\"/api/api-reference/rerank/submit-a-rerank-request\",\"autogeneratedByOpenApi\":true}]},{\"group\":\"Responses\",\"pages\":[{\"title\":\"Create a response\",\"description\":\"Creates a streaming or non-streaming response using OpenResponses API format\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml post /responses\",\"href\":\"/api/api-reference/responses/create-a-response\",\"autogeneratedByOpenApi\":true}]},{\"group\":\"SCIM\",\"pages\":[{\"title\":\"List SCIM group mappings\",\"description\":\"List SCIM group-to-workspace mappings for the organization. [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml get /scim/group-mappings\",\"href\":\"/api/api-reference/scim/list-scim-group-mappings\",\"autogeneratedByOpenApi\":true},{\"title\":\"Create a SCIM group mapping\",\"description\":\"Create a SCIM group-to-workspace role mapping. [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml post /scim/group-mappings\",\"href\":\"/api/api-reference/scim/create-a-scim-group-mapping\",\"autogeneratedByOpenApi\":true},{\"title\":\"Get a SCIM group mapping\",\"description\":\"Get a SCIM group-to-workspace mapping. [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml get /scim/group-mappings/{id}\",\"href\":\"/api/api-reference/scim/get-a-scim-group-mapping\",\"autogeneratedByOpenApi\":true},{\"title\":\"Delete a SCIM group mapping\",\"description\":\"Delete a SCIM group-to-workspace mapping. [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml delete /scim/group-mappings/{id}\",\"href\":\"/api/api-reference/scim/delete-a-scim-group-mapping\",\"autogeneratedByOpenApi\":true},{\"title\":\"Update a SCIM group mapping\",\"description\":\"Update a SCIM group mapping role. [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml patch /scim/group-mappings/{id}\",\"href\":\"/api/api-reference/scim/update-a-scim-group-mapping\",\"autogeneratedByOpenApi\":true},{\"title\":\"List SCIM groups\",\"description\":\"List SCIM groups for the organization. [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml get /scim/groups\",\"href\":\"/api/api-reference/scim/list-scim-groups\",\"autogeneratedByOpenApi\":true}]},{\"group\":\"Video Generation\",\"pages\":[{\"title\":\"Submit a video generation request\",\"description\":\"Submits a video generation request and returns a polling URL to check status\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml post /videos\",\"href\":\"/api/api-reference/video-generation/submit-a-video-generation-request\",\"autogeneratedByOpenApi\":true},{\"title\":\"Poll video generation status\",\"description\":\"Returns job status and content URLs when completed\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml get /videos/{jobId}\",\"href\":\"/api/api-reference/video-generation/poll-video-generation-status\",\"autogeneratedByOpenApi\":true},{\"title\":\"Download generated video content\",\"description\":\"Streams the generated video content from the upstream provider\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml get /videos/{jobId}/content\",\"href\":\"/api/api-reference/video-generation/download-generated-video-content\",\"autogeneratedByOpenApi\":true},{\"title\":\"List all video generation models\",\"description\":\"Returns a list of all available video generation models and their properties\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml get /videos/models\",\"href\":\"/api/api-reference/video-generation/list-all-video-generation-models\",\"autogeneratedByOpenApi\":true}]},{\"group\":\"Workspaces\",\"pages\":[{\"title\":\"List workspaces\",\"description\":\"List all workspaces for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml get /workspaces\",\"href\":\"/api/api-reference/workspaces/list-workspaces\",\"autogeneratedByOpenApi\":true},{\"title\":\"Create a workspace\",\"description\":\"Create a new workspace for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml post /workspaces\",\"href\":\"/api/api-reference/workspaces/create-a-workspace\",\"autogeneratedByOpenApi\":true},{\"title\":\"Get a workspace\",\"description\":\"Get a single workspace by ID or slug. [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml get /workspaces/{id}\",\"href\":\"/api/api-reference/workspaces/get-a-workspace\",\"autogeneratedByOpenApi\":true},{\"title\":\"Delete a workspace\",\"description\":\"Delete an existing workspace. Workspaces with active API keys cannot be deleted; remove the keys first. Deleting the default workspace is not yet generally available; callers not enabled for it receive a 403 while the capability rolls out. Deleting any workspace permanently deletes its budgets and guardrails and disables its classifiers and broadcast destinations. [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml delete /workspaces/{id}\",\"href\":\"/api/api-reference/workspaces/delete-a-workspace\",\"autogeneratedByOpenApi\":true},{\"title\":\"Update a workspace\",\"description\":\"Update an existing workspace by ID or slug. [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml patch /workspaces/{id}\",\"href\":\"/api/api-reference/workspaces/update-a-workspace\",\"autogeneratedByOpenApi\":true},{\"title\":\"List workspace budgets\",\"description\":\"List all budgets configured for a workspace. [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml get /workspaces/{id}/budgets\",\"href\":\"/api/api-reference/workspaces/list-workspace-budgets\",\"autogeneratedByOpenApi\":true},{\"title\":\"Get a workspace budget\",\"description\":\"Retrieve the budget for a given interval. [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml get /workspaces/{id}/budgets/{interval}\",\"href\":\"/api/api-reference/workspaces/get-a-workspace-budget\",\"autogeneratedByOpenApi\":true},{\"title\":\"Create or update a workspace budget\",\"description\":\"Create or update the budget for a given interval. Budget limits must strictly decrease as the interval narrows (lifetime \u003e monthly \u003e weekly \u003e daily). The optional `include_byok_in_budgets` flag is a workspace-wide setting: when provided it applies to every budget interval for the workspace, not just the interval in this request. Note that a change made here is applied to budget enforcement immediately, but an already-open workspace settings page in the web dashboard may keep showing the previous value until it is reloaded. [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml put /workspaces/{id}/budgets/{interval}\",\"href\":\"/api/api-reference/workspaces/create-or-update-a-workspace-budget\",\"autogeneratedByOpenApi\":true},{\"title\":\"Delete a workspace budget\",\"description\":\"Remove the budget for a given interval. [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml delete /workspaces/{id}/budgets/{interval}\",\"href\":\"/api/api-reference/workspaces/delete-a-workspace-budget\",\"autogeneratedByOpenApi\":true},{\"title\":\"List workspace members\",\"description\":\"List all members of a workspace. Returns paginated results. For the default workspace, returns all organization members (implicit membership). [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml get /workspaces/{id}/members\",\"href\":\"/api/api-reference/workspaces/list-workspace-members\",\"autogeneratedByOpenApi\":true},{\"title\":\"Bulk add members to a workspace\",\"description\":\"Add multiple organization members to a workspace. Members are assigned the same role they hold in the organization. [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml post /workspaces/{id}/members/add\",\"href\":\"/api/api-reference/workspaces/bulk-add-members-to-a-workspace\",\"autogeneratedByOpenApi\":true},{\"title\":\"Bulk remove members from a workspace\",\"description\":\"Remove multiple members from a workspace. Members with active API keys in the workspace cannot be removed. SCIM-managed members cannot be removed; changes must be made in your identity provider. [Management key](/docs/guides/overview/auth/management-api-keys) required.\",\"deprecated\":null,\"version\":null,\"openapi\":\"/openapi/openapi.yaml post /workspaces/{id}/members/remove\",\"href\":\"/api/api-reference/workspaces/bulk-remove-members-from-a-workspace\",\"autogeneratedByOpenApi\":true}]}]}]},{\"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\":\"$L48\"}]\n"])</script><script>self.__next_f.push([1,"49: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,"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\"],\"ApiReferenceProvider\"]\n"])</script><script>self.__next_f.push([1,"4b: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,"48:[\"$\",\"$L49\",null,{\"theme\":\"mint\",\"pageMetadata\":{\"title\":\"Errors and Debugging\",\"description\":\"API Errors and Debugging\",\"seoTitle\":\"API Error Handling and Debugging | OpenRouter Documentation\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"API Error Handling and Debugging - Complete Guide\",\"og:description\":\"Learn how to handle errors and debug requests in OpenRouter API interactions. Comprehensive guide to error codes, messages, debugging options, and best practices.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=API%20Error%20Handling%20and%20Debugging\u0026description=Learn%20how%20to%20handle%20errors%20and%20debug%20requests%20in%20OpenRouter%20API%20interactions.\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"triangle-exclamation\",\"href\":\"/api_reference/errors-and-debugging\"},\"children\":[\"$\",\"$L4a\",null,{\"value\":{\"apiReferenceData\":{},\"graphqlReferenceData\":\"$undefined\"},\"children\":[\"$\",\"$L4b\",null,{\"value\":{\"pageMetadata\":\"$48:props:pageMetadata\",\"lastModified\":\"2026-08-20T02:29:13.005Z\",\"gitLastModified\":\"$undefined\",\"originalFileLocation\":\"api_reference/errors-and-debugging.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: \\\"API Errors and Debugging\\\"\\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\":\"Error codes\",\"slug\":\"error-codes\",\"depth\":2,\"children\":[]},{\"title\":\"Retry-After header\",\"slug\":\"retry-after-header\",\"depth\":2,\"children\":[]},{\"title\":\"Moderation errors\",\"slug\":\"moderation-errors\",\"depth\":2,\"children\":[]},{\"title\":\"Guardrail errors\",\"slug\":\"guardrail-errors\",\"depth\":2,\"children\":[]},{\"title\":\"Provider errors\",\"slug\":\"provider-errors\",\"depth\":2,\"children\":[{\"title\":\"Masking and raw provider details\",\"slug\":\"masking-and-raw-provider-details\",\"depth\":3,\"children\":[]}]},{\"title\":\"When no content is generated\",\"slug\":\"when-no-content-is-generated\",\"depth\":2,\"children\":[]},{\"title\":\"Streaming error formats\",\"slug\":\"streaming-error-formats\",\"depth\":2,\"children\":[{\"title\":\"Pre-stream errors\",\"slug\":\"pre-stream-errors\",\"depth\":3,\"children\":[]},{\"title\":\"Mid-stream errors\",\"slug\":\"mid-stream-errors\",\"depth\":3,\"children\":[]}]},{\"title\":\"Typed error codes\",\"slug\":\"typed-error-codes\",\"depth\":2,\"children\":[{\"title\":\"Token and length limits\",\"slug\":\"token-and-length-limits\",\"depth\":3,\"children\":[]},{\"title\":\"Authentication and authorization\",\"slug\":\"authentication-and-authorization\",\"depth\":3,\"children\":[]},{\"title\":\"Rate limiting and availability\",\"slug\":\"rate-limiting-and-availability\",\"depth\":3,\"children\":[]},{\"title\":\"Request validation\",\"slug\":\"request-validation\",\"depth\":3,\"children\":[]},{\"title\":\"Content policy\",\"slug\":\"content-policy\",\"depth\":3,\"children\":[]},{\"title\":\"Image errors\",\"slug\":\"image-errors\",\"depth\":3,\"children\":[]},{\"title\":\"Generic\",\"slug\":\"generic\",\"depth\":3,\"children\":[]}]},{\"title\":\"Model availability errors\",\"slug\":\"model-availability-errors\",\"depth\":2,\"children\":[{\"title\":\"Availability codes\",\"slug\":\"availability-codes\",\"depth\":3,\"children\":[]},{\"title\":\"The availability object\",\"slug\":\"the-availability-object\",\"depth\":3,\"children\":[]},{\"title\":\"Retrying with retry_after\",\"slug\":\"retrying-with-retry_after\",\"depth\":3,\"children\":[]},{\"title\":\"Using fallback_models suggestions\",\"slug\":\"using-fallback_models-suggestions\",\"depth\":3,\"children\":[]},{\"title\":\"Example availability error payloads\",\"slug\":\"example-availability-error-payloads\",\"depth\":3,\"children\":[]}]},{\"title\":\"Skin-specific error formats\",\"slug\":\"skin-specific-error-formats\",\"depth\":2,\"children\":[{\"title\":\"Chat Completions (/api/v1/chat/completions)\",\"slug\":\"chat-completions-/api/v1/chat/completions\",\"depth\":3,\"children\":[]},{\"title\":\"Responses API (/api/v1/responses)\",\"slug\":\"responses-api-/api/v1/responses\",\"depth\":3,\"children\":[]},{\"title\":\"Error code transformations\",\"slug\":\"error-code-transformations\",\"depth\":4,\"children\":[]},{\"title\":\"Anthropic Messages (/api/v1/messages)\",\"slug\":\"anthropic-messages-/api/v1/messages\",\"depth\":3,\"children\":[]}]},{\"title\":\"Debugging\",\"slug\":\"debugging\",\"depth\":2,\"children\":[{\"title\":\"Debug option shape\",\"slug\":\"debug-option-shape\",\"depth\":3,\"children\":[]},{\"title\":\"Usage\",\"slug\":\"usage\",\"depth\":3,\"children\":[]},{\"title\":\"Chat Completions\",\"slug\":\"chat-completions\",\"depth\":4,\"children\":[]},{\"title\":\"Responses API\",\"slug\":\"responses-api\",\"depth\":4,\"children\":[]},{\"title\":\"Debug response format\",\"slug\":\"debug-response-format\",\"depth\":3,\"children\":[]},{\"title\":\"Chat Completions\",\"slug\":\"chat-completions-2\",\"depth\":4,\"children\":[]},{\"title\":\"Responses API\",\"slug\":\"responses-api-2\",\"depth\":4,\"children\":[]},{\"title\":\"Important notes\",\"slug\":\"important-notes\",\"depth\":3,\"children\":[]},{\"title\":\"Use cases\",\"slug\":\"use-cases\",\"depth\":3,\"children\":[]},{\"title\":\"Privacy and redaction\",\"slug\":\"privacy-and-redaction\",\"depth\":3,\"children\":[]}]}],\"codeExamples\":{}},\"pageType\":\"$undefined\",\"panelMdxSource\":\"$undefined\",\"panelMdxSourceWithNoJs\":\"$undefined\",\"contextualStarterQuestions\":\"$undefined\",\"relatedPages\":\"$undefined\"},\"children\":\"$L4c\"}]}]}]\n"])</script><script>self.__next_f.push([1,"4d: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,"4e: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,"50: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,"51: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,"4f:T84e,"])</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/api_reference/errors-and-debugging#webpage\",\"url\":\"https://openrouter.ai/docs/api_reference/errors-and-debugging\",\"name\":\"Errors and Debugging\",\"description\":\"API Errors and Debugging\",\"dateModified\":\"2026-08-20T02:29:13.005Z\",\"isPartOf\":{\"@id\":\"https://openrouter.ai/docs#website\"},\"breadcrumb\":{\"@id\":\"https://openrouter.ai/docs/api_reference/errors-and-debugging#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://openrouter.ai/docs/api_reference/errors-and-debugging#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"API Guides\",\"item\":\"https://openrouter.ai/docs/api_reference/overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Errors and Debugging\",\"item\":\"https://openrouter.ai/docs/api_reference/errors-and-debugging\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://openrouter.ai/docs/api_reference/errors-and-debugging#article\",\"headline\":\"Errors and Debugging\",\"name\":\"Errors and Debugging\",\"description\":\"API Errors and Debugging\",\"url\":\"https://openrouter.ai/docs/api_reference/errors-and-debugging\",\"mainEntityOfPage\":{\"@id\":\"https://openrouter.ai/docs/api_reference/errors-and-debugging#webpage\"},\"image\":\"https://openrouter.ai/dynamic-og?title=API%20Error%20Handling%20and%20Debugging\u0026description=Learn%20how%20to%20handle%20errors%20and%20debug%20requests%20in%20OpenRouter%20API%20interactions.\",\"dateModified\":\"2026-08-20T02:29:13.005Z\",\"publisher\":{\"@id\":\"https://openrouter.ai/#organization\"},\"isPartOf\":{\"@id\":\"https://openrouter.ai/docs#website\"}}]}"])</script><script>self.__next_f.push([1,"52: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,"4c:[\"$\",\"$L4d\",null,{\"pageMetadata\":\"$48:props:pageMetadata\",\"mdxExtracts\":\"$48:props:children:props:children:props:value:mdxExtracts\",\"openApiReferenceData\":\"$undefined\",\"children\":[\"$\",\"$L4e\",null,{\"children\":[[\"$\",\"script\",null,{\"type\":\"application/ld+json\",\"dangerouslySetInnerHTML\":{\"__html\":\"$4f\"}}],[[\"$\",\"script\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"document.documentElement.setAttribute('data-page-mode', \\\"none\\\");\"}}],[\"$\",\"$L50\",null,{\"pageMetadata\":\"$48:props:pageMetadata\"}]],[\"$\",\"$L51\",null,{\"pageMetadata\":\"$48:props:pageMetadata\"}],[[\"$\",\"style\",\"0\",{\"data-custom-css-index\":0,\"data-custom-css-path\":\"style.css\",\"dangerouslySetInnerHTML\":{\"__html\":\"$52\"}}]],\"$L53\",\"$L54\"]}]}]\n"])</script><script>self.__next_f.push([1,"55: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,"57: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,"58: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,"56: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,"53:[\"$\",\"$L55\",null,{\"customJsDisabled\":false,\"jsFiles\":[{\"_id\":\"6a58359481eda2c0540fae86\",\"filePath\":\"anchor-scroll-fix.js\",\"subdomain\":\"openrouter-d02e98a0\",\"__v\":0,\"content\":\"$56\"}]}]\n59:T37ffe,"])</script><script>self.__next_f.push([1,"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];const HTTPStatus={S100_Continue:100,S101_Switching_Protocols:101,S102_Processing:102,S200_OK:200,S201_Created:201,S202_Accepted:202,S203_Non_Authoritative_Information:203,S204_No_Content:204,S205_Reset_Content:205,S206_Partial_Content:206,S207_Multi_Status:207,S208_Already_Reported:208,S300_Multiple_Choices:300,S301_Moved_Permanently:301,S302_Found:302,S303_See_Other:303,S304_Not_Modified:304,S305_Use_Proxy:305,S307_Temporary_Redirect:307,S308_Permanent_Redirect:308,S400_Bad_Request:400,S401_Unauthorized:401,S402_Payment_Required:402,S403_Forbidden:403,S404_Not_Found:404,S405_Method_Not_Allowed:405,S406_Not_Acceptable:406,S407_Proxy_Authentication_Required:407,S408_Request_Timeout:408,S409_Conflict:409,S410_Gone:410,S411_Length_Required:411,S412_Precondition_Failed:412,S413_Payload_Too_Large:413,S414_URI_Too_Long:414,S415_Unsupported_Media_Type:415,S416_Range_Not_Satisfiable:416,S417_Expectation_Failed:417,S418_Im_a_teapot:418,S421_Misdirected_Request:421,S422_Unprocessable_Entity:422,S423_Locked:423,S424_Failed_Dependency:424,S425_Too_Early:425,S426_Upgrade_Required:426,S428_Precondition_Required:428,S429_Too_Many_Requests:429,S431_Request_Header_Fields_Too_Large:431,S451_Unavailable_For_Legal_Reasons:451,S498_Invalid_Token:498,S499_Client_Closed_Request:499,S500_Internal_Server_Error:500,S501_Not_Implemented:501,S502_Bad_Gateway:502,S503_Service_Unavailable:503,S504_Gateway_Timeout:504,S505_HTTP_Version_Not_Supported:505,S506_Variant_Also_Negotiates:506,S507_Insufficient_Storage:507,S508_Loop_Detected:508,S510_Not_Extended:510,S511_Network_Authentication_Required:511,S520_Web_Server_Returned_Unknown_Error:520,S521_Web_Server_Is_Down:521,S522_Connection_Timed_Out:522,S523_Origin_Unreachable:523,S524_A_Timeout_Occurred:524,S525_SSL_Handshake_Failed:525,S526_Invalid_SSL_Certificate:526,S529_Overloaded:529,S530_Origin_DNS_Error:530};function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,CodeGroup,Heading,Note,Table,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!CodeGroup)_missingMdxReference(`CodeGroup`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Note)_missingMdxReference(`Note`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`For errors, OpenRouter returns a JSON response with the following shape:`}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`7`,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:`7`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`type`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` ErrorResponse`}),_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:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  error`}),_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:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`    code`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` number`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`    message`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`    metadata`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`?:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` Record`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`unknown`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`\u003e;`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  };`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`};`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`The HTTP Response will have the same status code as `,_jsx(_components.code,{children:`error.code`}),`, forming a request error if:`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Your original request is invalid`}),`\n`,_jsx(_components.li,{children:`Your API key/account is out of credits`}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`Otherwise, the returned HTTP response status will be `,_jsx(`code`,{children:HTTPStatus.S200_OK}),` and any error occurred while the LLM is producing the output will be emitted in the response body or as an SSE data event.`]}),`\n`,_jsx(_components.p,{children:`Example code for printing errors in JavaScript:`}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`5`,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:`5`,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`}),_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/...'`}),_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:`request`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`status`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`); `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Will be an error code unless the model started processing your request`})]}),`\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:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` request`}),_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:`error`}),_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:`error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`?.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`code`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`); `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Will be an error code`})]}),`\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:`error`}),_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:`error`}),_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`,_jsx(Heading,{level:`2`,id:`error-codes`,children:`Error codes`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:HTTPStatus.S400_Bad_Request}),`: Bad Request (invalid or missing params, CORS)`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:HTTPStatus.S401_Unauthorized}),`: Invalid credentials (OAuth session expired, disabled/invalid API key)`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:HTTPStatus.S402_Payment_Required}),`: Your account or API key has insufficient credits. Add more credits and retry the request.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:HTTPStatus.S403_Forbidden}),`: Forbidden (insufficient permissions, guardrail block, or moderation flag)`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:HTTPStatus.S408_Request_Timeout}),`: Your request timed out`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:HTTPStatus.S429_Too_Many_Requests}),`: You are being rate limited`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:HTTPStatus.S502_Bad_Gateway}),`: Your chosen model is down or we received an invalid response from it`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:HTTPStatus.S503_Service_Unavailable}),`: There is no available model provider that meets your routing requirements`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`retry-after-header`,children:`Retry-After header`}),`\n`,_jsxs(_components.p,{children:[`On `,_jsx(`code`,{children:HTTPStatus.S429_Too_Many_Requests}),` and `,_jsx(`code`,{children:HTTPStatus.S503_Service_Unavailable}),` responses, OpenRouter may include a standard HTTP `,_jsx(_components.code,{children:`Retry-After`}),` response header indicating how many seconds to wait before retrying.`]}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`2`,language:`http`,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:`http`,children:_jsxs(_components.code,{language:`http`,numberOfLines:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`HTTP`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`/`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1.1`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 429`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` Too Many Requests`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#569CD6`},children:`Retry-After`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 60`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`The OpenAI SDK, Anthropic SDK, Vercel AI SDK, and OpenRouter SDK already respect this header for backoff. If you’re using `,_jsx(_components.code,{children:`fetch`}),` directly, honor it before retrying:`]}),`\n`,_jsx(CodeBlock,{filename:``,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:` res`}),_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:`, { `}),_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:`if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`res`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`status`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ===`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 429`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ||`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` res`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`status`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ===`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 503`}),_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:` retryAfter`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` Number`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`res`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},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:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`get`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Retry-After'`}),_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:`Number`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`isFinite`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`retryAfter`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`\u0026\u0026`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` retryAfter`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` \u003e`}),_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\":`#C586C0`},children:`    await`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` Promise`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`((`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`r`}),_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:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` setTimeout`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`r`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`retryAfter`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` *`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1000`}),_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:`    // retry the request`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`moderation-errors`,children:`Moderation errors`}),`\n`,_jsxs(_components.p,{children:[`If your input was flagged, the `,_jsx(_components.code,{children:`error.metadata`}),` will contain information about the issue. The shape of the metadata is as follows:`]}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`6`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`6`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`type`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` ModerationErrorMetadata`}),_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:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  reasons`}),_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:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Why your input was flagged`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  flagged_input`}),_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:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// The text segment that was flagged, limited to 100 characters. If the flagged input is longer than 100 characters, it will be truncated in the middle and replaced with ...`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  provider_name`}),_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:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// The name of the provider that requested moderation`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  model_slug`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`};`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`guardrail-errors`,children:`Guardrail errors`}),`\n`,_jsxs(_components.p,{children:[`On inference endpoints (`,_jsx(_components.code,{children:`/chat/completions`}),`, `,_jsx(_components.code,{children:`/responses`}),`, `,_jsx(_components.code,{children:`/messages`}),`), a request can be blocked before it reaches a provider — for example by a content filter or prompt-injection detector configured via `,_jsx(_components.a,{href:`/guides/features/guardrails`,children:`guardrails`}),`. When this happens, the response is a `,_jsx(_components.code,{children:`403`}),` with a message describing the block reason. The OpenRouter-shaped body below applies to `,_jsx(_components.code,{children:`/chat/completions`}),` and `,_jsx(_components.code,{children:`/responses`}),`; on `,_jsx(_components.code,{children:`/messages`}),` the block is returned as an Anthropic `,_jsx(_components.code,{children:`permission_error`}),` envelope (see `,_jsx(_components.a,{href:`#anthropic-messages-apiv1messages`,children:`Anthropic Messages`}),` below), with `,_jsx(_components.code,{children:`openrouter_metadata`}),` still carried at the top level when opted in:`]}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`9`,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:`9`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"code\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`403`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Request blocked: prompt injection patterns detected\"`}),_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:`    \"metadata\"`}),_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:`      \"patterns\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"ignore all previous instructions\"`}),_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:[`When you opt in to `,_jsx(_components.a,{href:`/guides/features/router-metadata`,children:`router metadata`}),` via the `,_jsx(_components.code,{children:`X-OpenRouter-Experimental-Metadata: enabled`}),` header, the 403 response also includes the full `,_jsx(_components.code,{children:`openrouter_metadata`}),` object with routing context and a `,_jsx(_components.code,{children:`pipeline`}),` array detailing the guardrail stages that ran:`]}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,expandable:`true`,numberOfLines:`38`,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:`38`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"code\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`403`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Request blocked: prompt injection patterns detected\"`}),_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:`    \"metadata\"`}),_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:`      \"patterns\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"ignore all previous instructions\"`}),_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:`  \"openrouter_metadata\"`}),_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:`    \"requested\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"openai/gpt-4o\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"strategy\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"direct\"`}),_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:`    \"region\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"iad\"`}),_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:`    \"summary\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"available=1\"`}),_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:`    \"attempt\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--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:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"is_byok\"`}),_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`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"endpoints\"`}),_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:`      \"total\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--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:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"available\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`        { `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"provider\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"OpenAI\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},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:`\"openai/gpt-4o\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"selected\"`}),_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`,_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:`    \"pipeline\"`}),_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:`\"guardrail\"`}),_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:`\"regex_pi_detection\"`}),_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:`        \"guardrail_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"grd_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:`        \"guardrail_scope\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"api-key\"`}),_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:`        \"summary\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Blocked: prompt injection detected (1 pattern matched)\"`}),_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:`        \"data\"`}),_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:`          \"action\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"blocked\"`}),_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:`          \"detected\"`}),_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:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`          \"engines\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"regex\"`}),_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:`          \"patterns\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"ignore all previous instructions\"`}),_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:[`The `,_jsx(_components.code,{children:`openrouter_metadata`}),` object follows the same shape as on successful responses — see `,_jsx(_components.a,{href:`/guides/features/router-metadata#pipeline-stages`,children:`Pipeline Stages`}),` for the full stage type and field reference.`]}),`\n`,_jsx(Heading,{level:`2`,id:`provider-errors`,children:`Provider errors`}),`\n`,_jsxs(_components.p,{children:[`OpenRouter normalizes every upstream provider error into the stable, typed\n`,_jsx(_components.code,{children:`error_type`}),` vocabulary documented under `,_jsx(_components.a,{href:`#typed-error-codes`,children:`Typed Error Codes`}),`.\nThe same `,_jsx(_components.code,{children:`error_type`}),` values describe what went wrong whether the provider\nerror arrives in a non-streaming response body or as a mid-stream SSE event.\nNative protocol codes (the Anthropic `,_jsx(_components.code,{children:`error.type`}),`, the Responses `,_jsx(_components.code,{children:`error.code`}),`)\nare best-effort and can differ between formats — `,_jsx(_components.code,{children:`error_type`}),` is the field to\nrely on across all of them.`]}),`\n`,_jsxs(_components.p,{children:[`For Chat Completions, a provider error that interrupts generation carries\n`,_jsx(_components.code,{children:`error_type`}),` inside `,_jsx(_components.code,{children:`error.metadata`}),`:`]}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`10`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`10`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"code\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`429`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Rate limit exceeded\"`}),_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:`    \"metadata\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"error_type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"rate_limit_exceeded\"`}),_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:`      \"provider_code\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"rate_limited\"`})]}),`\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:[`The same value is carried on mid-stream errors and on the Anthropic and\nResponses skins — see `,_jsx(_components.a,{href:`#skin-specific-error-formats`,children:`Skin-Specific Error Formats`}),`\nfor the exact wire location in each format.`]}),`\n`,_jsx(Heading,{level:`3`,id:`masking-and-raw-provider-details`,children:`Masking and raw provider details`}),`\n`,_jsxs(_components.p,{children:[`When a request fails with a `,_jsx(_components.code,{children:`500`}),`, the `,_jsx(_components.code,{children:`message`}),` is replaced with a generic\nstring and `,_jsx(_components.code,{children:`provider_code`}),` and `,_jsx(_components.code,{children:`openrouter_metadata`}),` are omitted, but\n`,_jsx(_components.code,{children:`error_type`}),` is still present (`,_jsx(_components.code,{children:`server`}),`).`]}),`\n`,_jsxs(_components.p,{children:[`For non-500 errors, the upstream provider’s own error code is surfaced in\n`,_jsx(_components.code,{children:`error.metadata.provider_code`}),` when available. Opt-in routing context (which\nprovider was selected, fallback attempts, etc.) is carried in the\n`,_jsx(_components.code,{children:`openrouter_metadata`}),` object when the request sets `,_jsx(_components.code,{children:`X-OpenRouter-Metadata`}),`\n— it follows the same shape as on successful responses (routing-summary\nfields only; see\n`,_jsx(_components.a,{href:`/guides/features/router-metadata#pipeline-stages`,children:`Pipeline Stages`}),`).`]}),`\n`,_jsx(Heading,{level:`2`,id:`when-no-content-is-generated`,children:`When no content is generated`}),`\n`,_jsx(_components.p,{children:`Occasionally, the model may not generate any content. This typically occurs when:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`The model is warming up from a cold start`}),`\n`,_jsx(_components.li,{children:`The system is scaling up to handle more requests`}),`\n`]}),`\n`,_jsx(_components.p,{children:`Warm-up times usually range from a few seconds to a few minutes, depending on the model and provider.`}),`\n`,_jsx(_components.p,{children:`If you encounter persistent no-content issues, consider implementing a simple retry mechanism or trying again with a different provider or model that has more recent activity.`}),`\n`,_jsx(_components.p,{children:`In some cases, you may still be charged for the prompt processing cost by the upstream provider, even if no content is generated.`}),`\n`,_jsx(Heading,{level:`2`,id:`streaming-error-formats`,children:`Streaming error formats`}),`\n`,_jsxs(_components.p,{children:[`When using streaming mode (`,_jsx(_components.code,{children:`stream: true`}),`), errors are handled differently depending on when they occur:`]}),`\n`,_jsx(Heading,{level:`3`,id:`pre-stream-errors`,children:`Pre-stream errors`}),`\n`,_jsx(_components.p,{children:`Errors that occur before any tokens are sent follow the standard error format above, with appropriate HTTP status codes. At this stage the HTTP response hasn’t been committed yet, so OpenRouter can:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Return a proper HTTP error status (4xx/5xx)`}),`\n`,_jsxs(_components.li,{children:[`Silently retry with a different provider endpoint if `,_jsx(_components.a,{href:`/guides/routing/provider-selection`,children:`fallback routing`}),` is enabled`]}),`\n`,_jsx(_components.li,{children:`Apply rate-limit or auth checks before any work begins`}),`\n`]}),`\n`,_jsx(_components.p,{children:`You’ll see pre-stream errors for issues like invalid API keys, malformed requests, or when every available provider endpoint is exhausted before streaming starts.`}),`\n`,_jsx(Heading,{level:`3`,id:`mid-stream-errors`,children:`Mid-stream errors`}),`\n`,_jsxs(_components.p,{children:[`Once the first token has been written to the client, the HTTP `,_jsx(_components.code,{children:`200 OK`}),` status and headers are already committed — they can’t be changed. If the provider fails at this point, OpenRouter `,_jsx(_components.strong,{children:`cannot`}),` silently fail over to another provider because partial content has already been delivered to your application. The error must arrive in-band as an SSE event.`]}),`\n`,_jsx(_components.p,{children:`Common causes of mid-stream errors:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Provider disconnect`}),` — the upstream connection drops after partial output (network issue, provider crash, load balancer timeout)`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Provider timeout`}),` — the model stops responding mid-generation and the read deadline expires`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Token limit hit during generation`}),` — the model reaches `,_jsx(_components.code,{children:`max_tokens`}),` or the context window fills up while producing output`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Output content filter`}),` — a content moderation system flags generated text after some of it was already streamed`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Provider overload`}),` — the upstream returns a rate-limit or capacity error after beginning to stream`]}),`\n`]}),`\n`,_jsx(Note,{children:_jsx(_components.p,{children:`If an error occurs before any tokens are written — even on a streaming request — OpenRouter can still retry with a backup provider transparently. Mid-stream errors only happen when partial content has already been committed to your stream, making failover impossible.`})}),`\n`,_jsx(_components.p,{children:`Mid-stream errors are sent as Server-Sent Events (SSE) with a unified structure that includes both the error details and a completion choice:`}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,expandable:`true`,numberOfLines:`21`,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:`21`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`type`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` MidStreamError`}),_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:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  id`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  object`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'chat.completion.chunk'`}),_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:`  created`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` number`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_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:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` string`}),_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:`  provider`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  error`}),_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:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`    code`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` number`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;       `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// HTTP status code (e.g. 400, 429, 502)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`    message`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`    metadata`}),_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:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`      error_type`}),_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:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Typed error code — see table below`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`      provider_code`}),_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:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Original upstream error code (omitted on 500s)`})]}),`\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:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  choices`}),_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:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`    index`}),_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`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`    delta`}),_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:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`content`}),_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:` };`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--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:` 'error'`}),_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:`    native_finish_reason`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`?:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`,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:`Example SSE data:`}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`2`,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:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`data: {\"id\":\"gen-abc123\",\"object\":\"chat.completion.chunk\",\"created\":1234567890,\"model\":\"openai/gpt-4o\",\"provider\":\"OpenAI\",\"error\":{\"code\":429,\"message\":\"Rate limit exceeded\",\"metadata\":{\"error_type\":\"rate_limit_exceeded\"}},\"choices\":[{\"index\":0,\"delta\":{\"content\":\"\"},\"finish_reason\":\"error\"}]}`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:`Key characteristics:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`The error appears at the `,_jsx(_components.strong,{children:`top level`}),` alongside standard response fields`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`error.metadata.error_type`}),` carries a typed code you can switch on programmatically — see `,_jsx(_components.a,{href:`#typed-error-codes`,children:`Typed Error Codes`}),` for the full list`]}),`\n`,_jsxs(_components.li,{children:[`A `,_jsx(_components.code,{children:`choices`}),` array is included with `,_jsx(_components.code,{children:`finish_reason: \"error\"`}),` to properly terminate the stream`]}),`\n`,_jsx(_components.li,{children:`The HTTP status remains 200 OK since headers were already sent`}),`\n`,_jsx(_components.li,{children:`The stream is terminated after this event`}),`\n`,_jsxs(_components.li,{children:[`On 500-class errors, `,_jsx(_components.code,{children:`error.message`}),` is replaced with a generic string and `,_jsx(_components.code,{children:`provider_code`}),` is omitted to prevent leaking upstream details`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`typed-error-codes`,children:`Typed error codes`}),`\n`,_jsxs(_components.p,{children:[`When a provider error reaches your application, OpenRouter tags it with a\ncanonical `,_jsx(_components.code,{children:`error_type`}),` string — both on the non-streaming response body and\non mid-stream SSE events. Use this value, not the HTTP status code alone, to\nprogrammatically distinguish error categories. It is stable across all three\nAPI skins even when the native protocol code is lossy.`]}),`\n`,_jsxs(_components.p,{children:[`Where `,_jsx(_components.code,{children:`error_type`}),` appears depends on the skin and path:`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Chat Completions`}),`: `,_jsx(_components.code,{children:`error.metadata.error_type`}),` — on the mid-stream error\nchunk (see `,_jsx(_components.a,{href:`#mid-stream-errors`,children:`Mid-Stream Errors`}),`) and on the non-streaming\nresponse when a provider error interrupts generation.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Anthropic Messages`}),`: `,_jsx(_components.code,{children:`error.error_type`}),` on the SSE `,_jsx(_components.code,{children:`error`}),` event and the\nnon-streaming error envelope.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Responses`}),`: top-level `,_jsx(_components.code,{children:`error_type`}),` on the failed response, for both the\nstreaming `,_jsx(_components.code,{children:`response.failed`}),` event and the non-streaming JSON body.`]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`The HTTP status each `,_jsx(_components.code,{children:`error_type`}),` maps to is listed in the tables below.`]}),`\n`,_jsx(Heading,{level:`3`,id:`token-and-length-limits`,children:`Token and length limits`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:_jsx(_components.code,{children:`error_type`})}),_jsx(_components.th,{children:`HTTP Status`}),_jsx(_components.th,{children:`Description`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`context_length_exceeded`})}),_jsx(_components.td,{children:HTTPStatus.S400_Bad_Request}),_jsx(_components.td,{children:`The combined input and output tokens exceed the model’s context window.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`max_tokens_exceeded`})}),_jsx(_components.td,{children:HTTPStatus.S400_Bad_Request}),_jsxs(_components.td,{children:[`Generation stopped because `,_jsx(_components.code,{children:`max_tokens`}),` (or `,_jsx(_components.code,{children:`max_completion_tokens`}),`) was reached.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`token_limit_exceeded`})}),_jsx(_components.td,{children:HTTPStatus.S400_Bad_Request}),_jsx(_components.td,{children:`A token budget enforced by OpenRouter (e.g. credit-based cap) was exceeded.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`string_too_long`})}),_jsx(_components.td,{children:HTTPStatus.S400_Bad_Request}),_jsx(_components.td,{children:`A single string field in the request (system prompt, user message, etc.) exceeded the provider’s per-field character limit.`})]})]})]}),`\n`,_jsx(Heading,{level:`3`,id:`authentication-and-authorization`,children:`Authentication and authorization`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:_jsx(_components.code,{children:`error_type`})}),_jsx(_components.th,{children:`HTTP Status`}),_jsx(_components.th,{children:`Description`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`authentication`})}),_jsx(_components.td,{children:HTTPStatus.S401_Unauthorized}),_jsx(_components.td,{children:`The API key is missing, invalid, or revoked.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`permission_denied`})}),_jsx(_components.td,{children:HTTPStatus.S403_Forbidden}),_jsxs(_components.td,{children:[`The key is valid but lacks the required permission or the request was blocked by a `,_jsx(_components.a,{href:`/guides/features/guardrails`,children:`guardrail`}),`.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`payment_required`})}),_jsx(_components.td,{children:HTTPStatus.S402_Payment_Required}),_jsxs(_components.td,{children:[`The account or API key has insufficient credits. `,_jsx(_components.a,{href:`https://openrouter.ai/credits`,children:`Add credits`}),` and retry.`]})]})]})]}),`\n`,_jsx(Heading,{level:`3`,id:`rate-limiting-and-availability`,children:`Rate limiting and availability`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:_jsx(_components.code,{children:`error_type`})}),_jsx(_components.th,{children:`HTTP Status`}),_jsx(_components.th,{children:`Description`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`rate_limit_exceeded`})}),_jsx(_components.td,{children:HTTPStatus.S429_Too_Many_Requests}),_jsxs(_components.td,{children:[`Request- or token-level rate limit hit. Respect the `,_jsx(_components.code,{children:`Retry-After`}),` header before retrying.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`provider_overloaded`})}),_jsx(_components.td,{children:HTTPStatus.S503_Service_Unavailable}),_jsx(_components.td,{children:`The upstream provider is temporarily overloaded. Retry after a short delay.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`provider_unavailable`})}),_jsx(_components.td,{children:HTTPStatus.S502_Bad_Gateway}),_jsx(_components.td,{children:`The upstream provider returned an invalid or empty response. OpenRouter may auto-retry with another provider if fallback routing is enabled.`})]})]})]}),`\n`,_jsx(Heading,{level:`3`,id:`request-validation`,children:`Request validation`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:_jsx(_components.code,{children:`error_type`})}),_jsx(_components.th,{children:`HTTP Status`}),_jsx(_components.th,{children:`Description`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`invalid_request`})}),_jsx(_components.td,{children:HTTPStatus.S400_Bad_Request}),_jsx(_components.td,{children:`A request parameter is malformed or missing.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`invalid_prompt`})}),_jsx(_components.td,{children:HTTPStatus.S400_Bad_Request}),_jsxs(_components.td,{children:[`A specific message in the `,_jsx(_components.code,{children:`messages`}),` array is invalid (e.g. unsupported role, empty content).`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`not_found`})}),_jsx(_components.td,{children:HTTPStatus.S404_Not_Found}),_jsx(_components.td,{children:`The requested resource (model, file, etc.) does not exist.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`precondition_failed`})}),_jsx(_components.td,{children:HTTPStatus.S412_Precondition_Failed}),_jsxs(_components.td,{children:[`A precondition header (e.g. `,_jsx(_components.code,{children:`If-Match`}),`) was not satisfied.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`payload_too_large`})}),_jsx(_components.td,{children:HTTPStatus.S413_Payload_Too_Large}),_jsx(_components.td,{children:`The request body exceeds the maximum allowed size.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`unprocessable`})}),_jsx(_components.td,{children:HTTPStatus.S422_Unprocessable_Entity}),_jsx(_components.td,{children:`The request is syntactically valid but semantically unprocessable.`})]})]})]}),`\n`,_jsx(Heading,{level:`3`,id:`content-policy`,children:`Content policy`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:_jsx(_components.code,{children:`error_type`})}),_jsx(_components.th,{children:`HTTP Status`}),_jsx(_components.th,{children:`Description`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`content_policy_violation`})}),_jsx(_components.td,{children:HTTPStatus.S400_Bad_Request}),_jsx(_components.td,{children:`The input or output was flagged by a content filter (provider- or OpenRouter-level).`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`refusal`})}),_jsx(_components.td,{children:HTTPStatus.S400_Bad_Request}),_jsx(_components.td,{children:`The model explicitly refused to comply with the request (e.g. safety refusal).`})]})]})]}),`\n`,_jsx(Heading,{level:`3`,id:`image-errors`,children:`Image errors`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:_jsx(_components.code,{children:`error_type`})}),_jsx(_components.th,{children:`HTTP Status`}),_jsx(_components.th,{children:`Description`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`invalid_image`})}),_jsx(_components.td,{children:HTTPStatus.S400_Bad_Request}),_jsx(_components.td,{children:`An image in the request is corrupt or unreadable.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`image_too_large`})}),_jsx(_components.td,{children:HTTPStatus.S400_Bad_Request}),_jsx(_components.td,{children:`An image exceeds the provider’s maximum file size or pixel dimensions.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`image_too_small`})}),_jsx(_components.td,{children:HTTPStatus.S400_Bad_Request}),_jsx(_components.td,{children:`An image is below the provider’s minimum pixel dimensions.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`unsupported_image_format`})}),_jsx(_components.td,{children:HTTPStatus.S400_Bad_Request}),_jsx(_components.td,{children:`The image format is not supported by the provider.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`image_not_found`})}),_jsx(_components.td,{children:HTTPStatus.S404_Not_Found}),_jsx(_components.td,{children:`The referenced image URL or file ID could not be resolved.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`image_download_failed`})}),_jsx(_components.td,{children:HTTPStatus.S400_Bad_Request}),_jsx(_components.td,{children:`OpenRouter could not download the image from the provided URL (DNS failure, timeout, non-200 response, etc.).`})]})]})]}),`\n`,_jsx(Heading,{level:`3`,id:`generic`,children:`Generic`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:_jsx(_components.code,{children:`error_type`})}),_jsx(_components.th,{children:`HTTP Status`}),_jsx(_components.th,{children:`Description`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`server`})}),_jsx(_components.td,{children:HTTPStatus.S500_Internal_Server_Error}),_jsx(_components.td,{children:`An unexpected internal error. The upstream error message is masked on this type.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`timeout`})}),_jsx(_components.td,{children:HTTPStatus.S504_Gateway_Timeout}),_jsx(_components.td,{children:`The provider did not respond within the allowed time.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`unmapped`})}),_jsx(_components.td,{children:HTTPStatus.S500_Internal_Server_Error}),_jsxs(_components.td,{children:[`An upstream error that doesn’t map to any known category. `,_jsx(_components.code,{children:`error.metadata.provider_code`}),` may contain the original code.`]})]})]})]}),`\n`,_jsx(Heading,{level:`2`,id:`model-availability-errors`,children:`Model availability errors`}),`\n`,_jsxs(_components.p,{children:[`When a requested model cannot be served — it doesn’t exist, is deprecated, has no routable endpoints under your preferences, or all of its providers are at capacity — the error response carries an additional `,_jsx(_components.code,{children:`error.availability`}),` object. It is `,_jsx(_components.strong,{children:`additive`}),`: `,_jsx(_components.code,{children:`error_type`}),`, `,_jsx(_components.code,{children:`http_status`}),`, and `,_jsx(_components.code,{children:`message`}),` keep their existing values, so existing error handling keeps working. Use `,_jsx(_components.code,{children:`availability.code`}),` — not the HTTP status or the message prose — to programmatically distinguish availability conditions.`]}),`\n`,_jsxs(_components.p,{children:[`The same `,_jsx(_components.code,{children:`availability`}),` object is emitted on streaming error chunks for all three API skins (Chat Completions, Responses, Anthropic Messages).`]}),`\n`,_jsx(Heading,{level:`3`,id:`availability-codes`,children:`Availability codes`}),`\n`,_jsxs(_components.p,{children:[`Every model-availability failure maps to exactly one code. Codes are stable forever; new codes may be added in the future, so treat an unrecognized code defensively and fall back to `,_jsx(_components.code,{children:`retryable`}),`.`]}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:_jsx(_components.code,{children:`availability.code`})}),_jsx(_components.th,{children:`HTTP`}),_jsx(_components.th,{children:_jsx(_components.code,{children:`error_type`})}),_jsx(_components.th,{children:`Retryable`}),_jsx(_components.th,{children:`Meaning`}),_jsx(_components.th,{children:`Recommended client action`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`model_not_found`})}),_jsx(_components.td,{children:HTTPStatus.S400_Bad_Request}),_jsx(_components.td,{children:_jsx(_components.code,{children:`invalid_request`})}),_jsx(_components.td,{children:`No`}),_jsx(_components.td,{children:`The model id is unknown or invalid.`}),_jsxs(_components.td,{children:[`Do not retry. Check the slug for typos or a legacy alias; use `,_jsx(_components.code,{children:`fallback_models`}),` suggestions when present.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`wrong_endpoint`})}),_jsx(_components.td,{children:HTTPStatus.S400_Bad_Request}),_jsx(_components.td,{children:_jsx(_components.code,{children:`invalid_request`})}),_jsx(_components.td,{children:`No`}),_jsxs(_components.td,{children:[`The model exists but was called on the wrong endpoint (e.g. an embedding model on `,_jsx(_components.code,{children:`/chat/completions`}),`).`]}),_jsxs(_components.td,{children:[`Retry on the endpoint named in `,_jsx(_components.code,{children:`constraint.detail`}),`.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`no_endpoints`})}),_jsx(_components.td,{children:HTTPStatus.S404_Not_Found}),_jsx(_components.td,{children:_jsx(_components.code,{children:`not_found`})}),_jsx(_components.td,{children:`No`}),_jsx(_components.td,{children:`The model exists but has zero routable endpoints (none configured, all disabled/hidden, or all removed by your provider preferences).`}),_jsx(_components.td,{children:`Do not retry the identical request. Loosen provider routing preferences or choose another model.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`model_deprecated`})}),_jsx(_components.td,{children:HTTPStatus.S404_Not_Found}),_jsx(_components.td,{children:_jsx(_components.code,{children:`not_found`})}),_jsx(_components.td,{children:`No`}),_jsx(_components.td,{children:`The model was deprecated or removed (sunset models, ended stealth alphas).`}),_jsxs(_components.td,{children:[`Migrate to the successor in `,_jsx(_components.code,{children:`fallback_models`}),`; see `,_jsx(_components.code,{children:`docs_url`}),` for the deprecation notice.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`model_unavailable_upstream`})}),_jsx(_components.td,{children:HTTPStatus.S404_Not_Found}),_jsx(_components.td,{children:_jsx(_components.code,{children:`not_found`})}),_jsx(_components.td,{children:`No`}),_jsx(_components.td,{children:`Every endpoint for the model returns 404 upstream — the provider removed it.`}),_jsxs(_components.td,{children:[`Do not retry; pick another model (`,_jsx(_components.code,{children:`fallback_models`}),` when present).`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`capacity_exhausted`})}),_jsx(_components.td,{children:HTTPStatus.S429_Too_Many_Requests}),_jsx(_components.td,{children:_jsx(_components.code,{children:`rate_limit_exceeded`})}),_jsx(_components.td,{children:`Yes`}),_jsx(_components.td,{children:`All providers for the model are at capacity (all attempts returned 429).`}),_jsxs(_components.td,{children:[`Retry after `,_jsx(_components.code,{children:`retry_after`}),` seconds (also sent as the `,_jsx(_components.code,{children:`Retry-After`}),` header), or route to a `,_jsx(_components.code,{children:`fallback_models`}),` entry.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`temporarily_unavailable`})}),_jsx(_components.td,{children:HTTPStatus.S503_Service_Unavailable}),_jsx(_components.td,{children:_jsx(_components.code,{children:`provider_overloaded`})}),_jsx(_components.td,{children:`Yes`}),_jsx(_components.td,{children:`All attempts failed with transient upstream 5xx responses or timeouts.`}),_jsxs(_components.td,{children:[`Retry with backoff, honoring `,_jsx(_components.code,{children:`retry_after`}),` when present; consider `,_jsx(_components.code,{children:`fallback_models`}),` for latency-sensitive paths.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`region_restricted`})}),_jsx(_components.td,{children:HTTPStatus.S403_Forbidden}),_jsx(_components.td,{children:_jsx(_components.code,{children:`permission_denied`})}),_jsx(_components.td,{children:`No`}),_jsx(_components.td,{children:`The model is geo-gated and not available in your region.`}),_jsx(_components.td,{children:`Do not retry from the same region. Adjust provider routing or serve traffic from an allowed region.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`privacy_restricted`})}),_jsx(_components.td,{children:HTTPStatus.S404_Not_Found}),_jsx(_components.td,{children:_jsx(_components.code,{children:`not_found`})}),_jsx(_components.td,{children:`No`}),_jsx(_components.td,{children:`Your data-policy preferences (ZDR, training opt-out, free-model publication) eliminated every endpoint.`}),_jsxs(_components.td,{children:[`Relax the policy named in `,_jsx(_components.code,{children:`excluded_by`}),` (e.g. at `,_jsx(_components.a,{href:`https://openrouter.ai/settings/privacy`,children:`privacy settings`}),`) or choose another model.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`constraint_filtered`})}),_jsx(_components.td,{children:HTTPStatus.S404_Not_Found}),_jsx(_components.td,{children:_jsx(_components.code,{children:`not_found`})}),_jsx(_components.td,{children:`No`}),_jsxs(_components.td,{children:[`A routing constraint — max price, context length, `,_jsx(_components.code,{children:`require_parameters`}),`, quantization, data region — eliminated every endpoint.`]}),_jsxs(_components.td,{children:[`Relax the constraint named in `,_jsx(_components.code,{children:`constraint.field`}),` / `,_jsx(_components.code,{children:`excluded_by`}),` and retry.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`free_variant_ended`})}),_jsx(_components.td,{children:HTTPStatus.S404_Not_Found}),_jsx(_components.td,{children:_jsx(_components.code,{children:`not_found`})}),_jsx(_components.td,{children:`No`}),_jsxs(_components.td,{children:[`The `,_jsx(_components.code,{children:`:free`}),` variant’s promotion ended; only paid endpoints remain.`]}),_jsxs(_components.td,{children:[`Switch to the paid slug in `,_jsx(_components.code,{children:`fallback_models`}),` (normal pricing applies) or pick another model.`]})]})]})]}),`\n`,_jsxs(Note,{children:[_jsx(_components.code,{children:`no_endpoints`}),` and `,_jsx(_components.code,{children:`model_unavailable_upstream`}),` are non-retryable today, but the router may mark individual occurrences `,_jsx(_components.code,{children:`retryable: true`}),` when the underlying condition is transient. Always switch on `,_jsx(_components.code,{children:`availability.retryable`}),`, not just the code.`]}),`\n`,_jsxs(Heading,{level:`3`,id:`the-availability-object`,children:[`The `,_jsx(_components.code,{children:`availability`}),` object`]}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`14`,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:`14`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`type`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` AvailabilityError`}),_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:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  code`}),_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:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// one of the codes above — the machine-readable discriminator`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  retryable`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` boolean`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;                  `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// would an identical retry plausibly succeed?`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  retry_after`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`?:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` number`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` |`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` null`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;         `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// seconds to wait before retrying, when known (429/503 paths)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  requested_models`}),_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:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// the raw model slugs you sent`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  affected_providers`}),_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:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` null`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`; `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// providers whose endpoints were attempted or excluded`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  excluded_by`}),_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:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// routing filter(s) that removed the last endpoints`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  fallback_models`}),_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:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// suggested alternative model slugs; may be empty or omitted`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  constraint`}),_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:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// present on constraint_filtered and wrong_endpoint`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`    field`}),_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:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// e.g. \"max_price\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`    detail`}),_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:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// human-readable explanation`})]}),`\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:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  docs_url`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;                    `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// anchor for this code on this page`})]}),`\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.code,{children:`code`}),`, `,_jsx(_components.code,{children:`retryable`}),`, `,_jsx(_components.code,{children:`requested_models`}),`, and `,_jsx(_components.code,{children:`docs_url`}),` are always present on an availability error. Other fields are omitted (never serialized as empty strings) when not applicable. `,_jsx(_components.code,{children:`excluded_by`}),` values are drawn from a fixed vocabulary: `,_jsx(_components.code,{children:`geo`}),`, `,_jsx(_components.code,{children:`data_region`}),`, `,_jsx(_components.code,{children:`data_policy:zdr`}),`, `,_jsx(_components.code,{children:`data_policy:training`}),`, `,_jsx(_components.code,{children:`max_price`}),`, `,_jsx(_components.code,{children:`context_length`}),`, `,_jsx(_components.code,{children:`require_parameters`}),`, `,_jsx(_components.code,{children:`quantization`}),`, `,_jsx(_components.code,{children:`allowed_providers`}),`.`]}),`\n`,_jsxs(_components.p,{children:[`For debugging, `,_jsx(_components.code,{children:`error.metadata.previous_errors`}),` carries the per-provider attempt history in a slim, stable shape — `,_jsx(_components.code,{children:`{ \"provider\": \"...\", \"code\": \"...\", \"status\": 429 }`}),` — and never includes raw upstream provider error bodies.`]}),`\n`,_jsxs(Heading,{level:`3`,id:`retrying-with-retry_after`,children:[`Retrying with `,_jsx(_components.code,{children:`retry_after`})]}),`\n`,_jsxs(_components.p,{children:[`For `,_jsx(_components.code,{children:`capacity_exhausted`}),` and `,_jsx(_components.code,{children:`temporarily_unavailable`}),`, `,_jsx(_components.code,{children:`availability.retry_after`}),` mirrors the `,_jsx(_components.code,{children:`Retry-After`}),` response header in the body and is populated whenever any attempted endpoint supplied a retry hint (the minimum across attempts). Both are expressed in seconds:`]}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`11`,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:`11`,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:` res`}),_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:`, { `}),_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:` body`}),_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:` res`}),_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:` availability`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--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:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`?.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`availability`}),_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:`availability`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`?.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`retryable`}),_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:` waitSeconds`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    availability`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`retry_after`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ??`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`    Number`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`res`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},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:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`get`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Retry-After'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`||`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`    2`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` **`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` attempt`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`; `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// exponential backoff fallback when no hint is given`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`  await`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` Promise`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`((`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`r`}),_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:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` setTimeout`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`r`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`waitSeconds`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` *`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1000`}),_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:`  // retry the identical request`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`The OpenAI, Anthropic, Vercel AI, and OpenRouter SDKs already honor the `,_jsx(_components.code,{children:`Retry-After`}),` header; `,_jsx(_components.code,{children:`availability.retry_after`}),` exposes the same signal to clients that inspect bodies rather than headers.`]}),`\n`,_jsxs(Heading,{level:`3`,id:`using-fallback_models-suggestions`,children:[`Using `,_jsx(_components.code,{children:`fallback_models`}),` suggestions`]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`fallback_models`}),` contains suggested alternative slugs the router can point to cheaply — the paid variant after a `,_jsx(_components.code,{children:`:free`}),` promotion ends, the successor of a deprecated model, or same-family alternatives. It is omitted when no suggestion is available and never delays the error response.`]}),`\n`,_jsx(_components.p,{children:`Suggestions are hints, not guarantees: a fallback may differ in price, context window, or capabilities, and it may be unavailable under your own routing preferences. Validate the slug against your requirements (or surface it to your user) before silently switching models.`}),`\n`,_jsx(Heading,{level:`3`,id:`example-availability-error-payloads`,children:`Example availability error payloads`}),`\n`,_jsx(_components.p,{children:_jsxs(_components.strong,{children:[`All providers at capacity — `,_jsx(_components.code,{children:`capacity_exhausted`}),` (retryable):`]})}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`22`,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:`22`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"All providers for anthropic/claude-sonnet-4.5 are at capacity. Retry after 40 seconds.\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"error_type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"rate_limit_exceeded\"`}),_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:`    \"http_status\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`429`}),_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:`    \"availability\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"code\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"capacity_exhausted\"`}),_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:`      \"retryable\"`}),_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:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"retry_after\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`40`}),_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:`      \"requested_models\"`}),_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:`      \"affected_providers\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"anthropic\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"amazon-bedrock\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"google-vertex\"`}),_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:`      \"fallback_models\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"anthropic/claude-haiku-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:`      \"docs_url\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"https://openrouter.ai/docs/errors#capacity_exhausted\"`})]}),`\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:`    \"metadata\"`}),_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:`      \"previous_errors\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`        { `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"provider\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"anthropic\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"code\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"capacity_exhausted\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"status\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`429`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`        { `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"provider\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"amazon-bedrock\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"code\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"capacity_exhausted\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"status\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`429`}),_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:_jsxs(_components.strong,{children:[`Deprecated stealth model — `,_jsx(_components.code,{children:`model_deprecated`}),`:`]})}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`14`,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:`14`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Quasar Alpha was a stealth model, revealed on April 14th as an early testing version of GPT-4.1.\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"error_type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"not_found\"`}),_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:`    \"http_status\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`404`}),_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:`    \"availability\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"code\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"model_deprecated\"`}),_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:`      \"retryable\"`}),_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`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"requested_models\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"openrouter/quasar-alpha\"`}),_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:`      \"fallback_models\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"openai/gpt-4.1\"`}),_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:`      \"docs_url\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"https://openrouter.ai/docs/errors#model_deprecated\"`})]}),`\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:_jsxs(_components.strong,{children:[`Privacy restriction eliminated all endpoints — `,_jsx(_components.code,{children:`privacy_restricted`}),`:`]})}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`15`,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:`15`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"No endpoints for openai/gpt-5.2 match your data policy (zero data retention). Adjust at https://openrouter.ai/settings/privacy.\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"error_type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"not_found\"`}),_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:`    \"http_status\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`404`}),_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:`    \"availability\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"code\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"privacy_restricted\"`}),_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:`      \"retryable\"`}),_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`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"requested_models\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"openai/gpt-5.2\"`}),_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:`      \"affected_providers\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"openai\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"azure\"`}),_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:`      \"excluded_by\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"data_policy:zdr\"`}),_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:`      \"docs_url\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"https://openrouter.ai/docs/errors#privacy_restricted\"`})]}),`\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:_jsxs(_components.strong,{children:[`Unknown model id — `,_jsx(_components.code,{children:`model_not_found`}),`:`]})}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`13`,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:`13`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"acme/fake-1.0 is not a valid model ID\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"error_type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"invalid_request\"`}),_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:`    \"http_status\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`400`}),_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:`    \"availability\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"code\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"model_not_found\"`}),_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:`      \"retryable\"`}),_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`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"requested_models\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"acme/fake-1.0\"`}),_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:`      \"docs_url\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"https://openrouter.ai/docs/errors#model_not_found\"`})]}),`\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:`2`,id:`skin-specific-error-formats`,children:`Skin-specific error formats`}),`\n`,_jsxs(_components.p,{children:[`OpenRouter exposes three API skins. Each translates the same internal provider error types into its own wire format, for non-streaming responses and in-stream errors alike. In every case `,_jsx(_components.code,{children:`error_type`}),` is the stable field; the wire location differs per skin.`]}),`\n`,_jsxs(Heading,{level:`3`,id:`chat-completions-/api/v1/chat/completions`,children:[`Chat Completions (`,_jsx(_components.code,{children:`/api/v1/chat/completions`}),`)`]}),`\n`,_jsxs(_components.p,{children:[`Mid-stream errors appear as a `,_jsx(_components.code,{children:`chat.completion.chunk`}),` with a top-level `,_jsx(_components.code,{children:`error`}),` object (shape shown `,_jsx(_components.a,{href:`#mid-stream-errors`,children:`above`}),`). The `,_jsx(_components.code,{children:`error.metadata.error_type`}),` field carries the typed code.`]}),`\n`,_jsx(_components.p,{children:`For non-streaming requests where a provider error occurs, the error is embedded in the final response alongside any partial content:`}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`11`,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:`11`,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:`  \"choices\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [{`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: { `}),_jsx(_components.span,{style:{color:`#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:`, `}),_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:`\"partial output...\"`}),_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:`    \"finish_reason\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"code\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`502`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Provider disconnected mid-stream\"`}),_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:`      \"metadata\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: { `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"error_type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"provider_unavailable\"`}),_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(Heading,{level:`3`,id:`responses-api-/api/v1/responses`,children:[`Responses API (`,_jsx(_components.code,{children:`/api/v1/responses`}),`)`]}),`\n`,_jsxs(_components.p,{children:[`The Responses API maps internal error types to the OpenAI Responses error code set. The mapping is narrower — many distinct internal types collapse to `,_jsx(_components.code,{children:`server_error`}),` — so the precise reason is preserved in a top-level `,_jsx(_components.code,{children:`error_type`}),` field on the response, outside the native `,_jsx(_components.code,{children:`error`}),` object:`]}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsxs(_components.th,{children:[`Internal `,_jsx(_components.code,{children:`error_type`})]}),_jsxs(_components.th,{children:[`Responses API `,_jsx(_components.code,{children:`code`})]})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`rate_limit_exceeded`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`rate_limit_exceeded`})})]}),_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[_jsx(_components.code,{children:`context_length_exceeded`}),`, `,_jsx(_components.code,{children:`invalid_request`})]}),_jsx(_components.td,{children:_jsx(_components.code,{children:`invalid_prompt`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`content_policy_violation`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`image_content_policy_violation`})})]}),_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[_jsx(_components.code,{children:`authentication`}),`, `,_jsx(_components.code,{children:`provider_overloaded`}),`, `,_jsx(_components.code,{children:`provider_unavailable`}),`, `,_jsx(_components.code,{children:`timeout`}),`, `,_jsx(_components.code,{children:`server`})]}),_jsx(_components.td,{children:_jsx(_components.code,{children:`server_error`})})]}),_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[`All others (including `,_jsx(_components.code,{children:`invalid_prompt`}),`)`]}),_jsx(_components.td,{children:_jsx(_components.code,{children:`server_error`})})]})]})]}),`\n`,_jsxs(_components.p,{children:[`Both the streaming terminal event and the non-streaming JSON body carry the canonical `,_jsx(_components.code,{children:`error_type`}),` at the top level of the response object. For example, an authentication failure collapses to the native `,_jsx(_components.code,{children:`server_error`}),` code but keeps `,_jsx(_components.code,{children:`error_type: \"authentication\"`}),`:`]}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`6`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`6`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"resp_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:`  \"status\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"failed\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: { `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"code\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"server_error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Invalid credentials\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"error_type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"authentication\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Streaming errors surface as one of three SSE event types, each wrapping the same response object:`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`response.failed`})}),` — terminal event when the response could not complete:`]}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`9`,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:`9`,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:`  \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"response.failed\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"response\"`}),_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:`\"resp_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:`    \"status\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"failed\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: { `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"code\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"server_error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Internal server error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"error_type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"server\"`})]}),`\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`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`response.error`})}),` — error during response generation:`]}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`4`,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:`4`,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:`  \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"response.error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: { `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"code\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"rate_limit_exceeded\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Rate limit exceeded\"`}),_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`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`error`})}),` — plain error event (matches upstream OpenAI behavior):`]}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`4`,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:`4`,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:`  \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: { `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"code\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"invalid_api_key\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Invalid API key provided\"`}),_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`]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`error-code-transformations`,children:`Error code transformations`}),`\n`,_jsx(_components.p,{children:`Certain token/length errors are transformed into successful completions instead of failures:`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:_jsx(_components.code,{children:`error_type`})}),_jsx(_components.th,{children:`Transformed To`}),_jsx(_components.th,{children:`Finish Reason`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`context_length_exceeded`})}),_jsx(_components.td,{children:`Success`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`length`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`max_tokens_exceeded`})}),_jsx(_components.td,{children:`Success`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`length`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`token_limit_exceeded`})}),_jsx(_components.td,{children:`Success`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`length`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`string_too_long`})}),_jsx(_components.td,{children:`Success`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`length`})})]})]})]}),`\n`,_jsx(_components.p,{children:`This allows graceful handling of limit-based errors without treating them as failures.`}),`\n`,_jsxs(Heading,{level:`3`,id:`anthropic-messages-/api/v1/messages`,children:[`Anthropic Messages (`,_jsx(_components.code,{children:`/api/v1/messages`}),`)`]}),`\n`,_jsx(_components.p,{children:`The Anthropic Messages skin maps internal types to Anthropic-native error type strings:`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsxs(_components.th,{children:[`Internal `,_jsx(_components.code,{children:`error_type`})]}),_jsxs(_components.th,{children:[`Anthropic `,_jsx(_components.code,{children:`error.type`})]})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`authentication`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`authentication_error`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`permission_denied`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`permission_error`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`payment_required`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`billing_error`})})]}),_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[_jsx(_components.code,{children:`not_found`}),`, `,_jsx(_components.code,{children:`image_not_found`})]}),_jsx(_components.td,{children:_jsx(_components.code,{children:`not_found_error`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`rate_limit_exceeded`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`rate_limit_error`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`provider_overloaded`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`overloaded_error`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`timeout`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`timeout_error`})})]}),_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[_jsx(_components.code,{children:`context_length_exceeded`}),`, `,_jsx(_components.code,{children:`content_policy_violation`}),`, `,_jsx(_components.code,{children:`invalid_request`}),`, …`]}),_jsx(_components.td,{children:_jsx(_components.code,{children:`invalid_request_error`})})]}),_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[_jsx(_components.code,{children:`provider_unavailable`}),`, `,_jsx(_components.code,{children:`server`}),`, `,_jsx(_components.code,{children:`unmapped`}),`, …`]}),_jsx(_components.td,{children:_jsx(_components.code,{children:`api_error`})})]})]})]}),`\n`,_jsxs(_components.p,{children:[`Because the native `,_jsx(_components.code,{children:`error.type`}),` is lossy (many internal types collapse to `,_jsx(_components.code,{children:`api_error`}),`), the canonical `,_jsx(_components.code,{children:`error_type`}),` is added inside the `,_jsx(_components.code,{children:`error`}),` object alongside it. This holds for both the non-streaming error envelope and mid-stream SSE `,_jsx(_components.code,{children:`error`}),` events.`]}),`\n`,_jsxs(_components.p,{children:[`Non-streaming error envelope (pre-Router errors such as authentication failures carry a `,_jsx(_components.code,{children:`null`}),` `,_jsx(_components.code,{children:`request_id`}),`; post-Router errors carry the `,_jsx(_components.code,{children:`gen-`}),` generation ID):`]}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`9`,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:`9`,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:`  \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"authentication_error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Invalid credentials\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"error_type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"authentication\"`})]}),`\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:`  \"request_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`null`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Mid-stream errors are emitted as an SSE `,_jsx(_components.code,{children:`error`}),` event with the same shape:`]}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`8`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`8`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"overloaded_error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Provider is temporarily overloaded\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"error_type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"provider_overloaded\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`debugging`,children:`Debugging`}),`\n`,_jsxs(_components.p,{children:[`OpenRouter provides a `,_jsx(_components.code,{children:`debug`}),` option that allows you to inspect the exact request body that was sent to the upstream provider. This works with both the Chat Completions API (`,_jsx(_components.code,{children:`/api/v1/chat/completions`}),`) and the Responses API (`,_jsx(_components.code,{children:`/api/v1/responses`}),`). Useful for understanding how OpenRouter transforms your request parameters for different providers.`]}),`\n`,_jsx(Heading,{level:`3`,id:`debug-option-shape`,children:`Debug option shape`}),`\n`,_jsx(_components.p,{children:`The debug option is an object with the following shape:`}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`3`,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:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`type`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` DebugOptions`}),_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:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  echo_upstream_body`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`?:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` boolean`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`; `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// If true, returns the transformed request body sent to the provider`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`};`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`usage`,children:`Usage`}),`\n`,_jsxs(_components.p,{children:[`To enable debug output, include the `,_jsx(_components.code,{children:`debug`}),` parameter in your request:`]}),`\n`,_jsx(Heading,{level:`4`,id:`chat-completions`,children:`Chat Completions`}),`\n`,_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`TypeScript`,lines:`true`,expandable:`true`,numberOfLines:`35`,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:`35`,children:[_jsxs(_components.span,{className:`line`,children:[_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 \u003cOPENROUTER_API_KEY\u003e'`}),_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:` 'anthropic/claude-haiku-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:`    stream:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` true`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Debug only works with streaming`})]}),`\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`,_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:` 'user'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`content:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'Hello!'`}),_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:`    debug:`}),_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:`      echo_upstream_body:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` true`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  }),`})}),`\n`,_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:` text`}),_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:`text`}),_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:` text`}),_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:`)) {`})]}),`\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:`#CF222E`,\"--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:`)) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`continue`}),_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:`#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`,_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:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ===`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '[DONE]'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},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`}),`\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:` parsed`}),_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:`data`}),_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:`parsed`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`debug`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`?.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`echo_upstream_body`}),_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:`#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:`Debug:'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--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:`stringify`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`parsed`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`debug`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`echo_upstream_body`}),_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:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`2`}),_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:`  process`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`stdout`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`write`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`parsed`}),_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:`content`}),_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:`);`})]}),`\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:`28`,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:`28`,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:` requests`})]}),`\n`,_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`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\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.post(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  url`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#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:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  headers`}),_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:`    \"Authorization\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Bearer \u003cOPENROUTER_API_KEY\u003e\"`}),_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\":`#D4D4D4`},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:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  data`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`json.dumps({`})]}),`\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:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"anthropic/claude-haiku-4.5\"`}),_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:`    \"stream\"`}),_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:`#0A3069`,\"--shiki-dark\":`#CE9178`},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:`#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:`, `}),_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.\"`}),_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:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"role\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"user\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Hello!\"`}),_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:`    \"debug\"`}),_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:`      \"echo_upstream_body\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_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`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  stream`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_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`}),`\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:` line `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`in`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` response.iter_lines():`})]}),`\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:` line:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    text `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` line.decode(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'utf-8'`}),_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:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'echo_upstream_body'`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` in`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` text:`})]}),`\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:`(text)`})]}),`\n`]})})})]}),`\n`,_jsx(Heading,{level:`4`,id:`responses-api`,children:`Responses API`}),`\n`,_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`TypeScript`,lines:`true`,expandable:`true`,numberOfLines:`30`,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:`30`,children:[_jsxs(_components.span,{className:`line`,children:[_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/responses'`}),_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 \u003cOPENROUTER_API_KEY\u003e'`}),_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:` 'anthropic/claude-haiku-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:`    stream:`}),_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:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    input:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'Hello!'`}),_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:`    debug:`}),_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:`      echo_upstream_body:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` true`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  }),`})}),`\n`,_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:` text`}),_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:`text`}),_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:` text`}),_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:`)) {`})]}),`\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:`#CF222E`,\"--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:`)) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`continue`}),_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:`#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`,_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:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ===`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '[DONE]'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},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`}),`\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:` parsed`}),_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:`data`}),_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:`parsed`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`type`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ===`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'response.debug'`}),_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:`#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:`Debug:'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--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:`stringify`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`parsed`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`debug`}),_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:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`2`}),_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:`25`,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:`25`,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:` requests`})]}),`\n`,_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`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\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.post(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  url`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"https://openrouter.ai/api/v1/responses\"`}),_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:`  headers`}),_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:`    \"Authorization\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Bearer \u003cOPENROUTER_API_KEY\u003e\"`}),_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\":`#D4D4D4`},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:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  data`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`json.dumps({`})]}),`\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:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"anthropic/claude-haiku-4.5\"`}),_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:`    \"stream\"`}),_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:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`    \"input\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Hello!\"`}),_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:`    \"debug\"`}),_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:`      \"echo_upstream_body\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_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`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  stream`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_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`}),`\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:` line `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`in`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` response.iter_lines():`})]}),`\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:` line:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    text `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` line.decode(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'utf-8'`}),_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:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'response.debug'`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` in`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` text:`})]}),`\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:`(text)`})]}),`\n`]})})})]}),`\n`,_jsx(Heading,{level:`3`,id:`debug-response-format`,children:`Debug response format`}),`\n`,_jsx(Heading,{level:`4`,id:`chat-completions-2`,children:`Chat Completions`}),`\n`,_jsxs(_components.p,{children:[`When `,_jsx(_components.code,{children:`debug.echo_upstream_body`}),` is set to `,_jsx(_components.code,{children:`true`}),`, OpenRouter sends a debug chunk as the `,_jsx(_components.strong,{children:`first chunk`}),` in the streaming response. This chunk has an empty `,_jsx(_components.code,{children:`choices`}),` array and includes a `,_jsx(_components.code,{children:`debug`}),` field with the transformed request body:`]}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,expandable:`true`,numberOfLines:`22`,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:`22`,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:`  \"id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"gen-xxxxx\"`}),_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:`  \"provider\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Anthropic\"`}),_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-haiku-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:`  \"object\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"chat.completion.chunk\"`}),_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:`  \"created\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1234567890`}),_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:`  \"choices\"`}),_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:`  \"debug\"`}),_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:`    \"echo_upstream_body\"`}),_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:`      \"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\":`#D4D4D4`},children:`        { `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"text\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"text\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"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:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"messages\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},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:`, `}),_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:`\"Hello!\"`}),_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:`      \"model\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"claude-haiku-4-5-20251001\"`}),_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:`      \"stream\"`}),_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:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"max_tokens\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`64000`}),_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:`      \"temperature\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`})]}),`\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:`4`,id:`responses-api-2`,children:`Responses API`}),`\n`,_jsxs(_components.p,{children:[`On the Responses API, debug data arrives as a `,_jsx(_components.code,{children:`response.debug`}),` SSE event:`]}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`15`,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:`15`,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:`  \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"response.debug\"`}),_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:`  \"debug\"`}),_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:`    \"echo_upstream_body\"`}),_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:`\"claude-haiku-4-5-20251001\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"messages\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},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:`, `}),_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:`\"Hello!\"`}),_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:`      \"stream\"`}),_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:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"max_tokens\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`64000`}),_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:`      \"temperature\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`})]}),`\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:`  \"sequence_number\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`important-notes`,children:`Important notes`}),`\n`,_jsxs(Warning,{children:[_jsx(_components.p,{children:_jsx(_components.strong,{children:`Streaming Only`})}),_jsxs(_components.p,{children:[`The debug option `,_jsx(_components.strong,{children:`only works with streaming mode`}),` (`,_jsx(_components.code,{children:`stream: true`}),`). Non-streaming requests will ignore the debug parameter.`]})]}),`\n`,_jsxs(Warning,{children:[_jsx(_components.p,{children:_jsx(_components.strong,{children:`Not for Production`})}),_jsxs(_components.p,{children:[`The debug flag should `,_jsx(_components.strong,{children:`not be used in production environments`}),`. It is intended for development and debugging purposes only, as it may potentially return sensitive information included in the request that was not intended to be visible elsewhere.`]})]}),`\n`,_jsx(Heading,{level:`3`,id:`use-cases`,children:`Use cases`}),`\n`,_jsx(_components.p,{children:`The debug output is particularly useful for:`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Understanding Parameter Transformations`}),`: See how OpenRouter maps your parameters to provider-specific formats (e.g., how `,_jsx(_components.code,{children:`max_tokens`}),` is set, how `,_jsx(_components.code,{children:`temperature`}),` is handled).`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Verifying Message Formatting`}),`: Check how OpenRouter combines and formats your messages for different providers (e.g., how system messages are concatenated, how user messages are merged).`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Checking Applied Defaults`}),`: See what default values OpenRouter applies when parameters are not specified in your request.`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Debugging Provider Fallbacks`}),`: When using provider fallbacks, a debug chunk will be sent for `,_jsx(_components.strong,{children:`each attempted provider`}),`, allowing you to see which providers were tried and what parameters were sent to each.`]}),`\n`]}),`\n`]}),`\n`,_jsx(Heading,{level:`3`,id:`privacy-and-redaction`,children:`Privacy and redaction`}),`\n`,_jsx(_components.p,{children:`OpenRouter will make a best effort to automatically redact potentially sensitive or noisy data from debug output. Remember that the debug option is not intended for production.`})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{HTTPStatus,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,"5a:T3706e,"])</script><script>self.__next_f.push([1,"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];const HTTPStatus=undefined;function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,CodeGroup,Heading,Note,Table,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!CodeGroup)_missingMdxReference(`CodeGroup`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Note)_missingMdxReference(`Note`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`For errors, OpenRouter returns a JSON response with the following shape:`}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`7`,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:`7`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`type`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` ErrorResponse`}),_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:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  error`}),_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:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`    code`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` number`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`    message`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`    metadata`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`?:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` Record`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`unknown`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`\u003e;`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  };`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`};`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`The HTTP Response will have the same status code as `,_jsx(_components.code,{children:`error.code`}),`, forming a request error if:`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Your original request is invalid`}),`\n`,_jsx(_components.li,{children:`Your API key/account is out of credits`}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`Otherwise, the returned HTTP response status will be `,` and any error occurred while the LLM is producing the output will be emitted in the response body or as an SSE data event.`]}),`\n`,_jsx(_components.p,{children:`Example code for printing errors in JavaScript:`}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`5`,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:`5`,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`}),_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/...'`}),_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:`request`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`status`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`); `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Will be an error code unless the model started processing your request`})]}),`\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:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` request`}),_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:`error`}),_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:`error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`?.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`code`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`); `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Will be an error code`})]}),`\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:`error`}),_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:`error`}),_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`,_jsx(Heading,{level:`2`,id:`error-codes`,children:`Error codes`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`: Bad Request (invalid or missing params, CORS)`}),`\n`,_jsx(_components.li,{children:`: Invalid credentials (OAuth session expired, disabled/invalid API key)`}),`\n`,_jsx(_components.li,{children:`: Your account or API key has insufficient credits. Add more credits and retry the request.`}),`\n`,_jsx(_components.li,{children:`: Forbidden (insufficient permissions, guardrail block, or moderation flag)`}),`\n`,_jsx(_components.li,{children:`: Your request timed out`}),`\n`,_jsx(_components.li,{children:`: You are being rate limited`}),`\n`,_jsx(_components.li,{children:`: Your chosen model is down or we received an invalid response from it`}),`\n`,_jsx(_components.li,{children:`: There is no available model provider that meets your routing requirements`}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`retry-after-header`,children:`Retry-After header`}),`\n`,_jsxs(_components.p,{children:[`On `,` and `,` responses, OpenRouter may include a standard HTTP `,_jsx(_components.code,{children:`Retry-After`}),` response header indicating how many seconds to wait before retrying.`]}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`2`,language:`http`,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:`http`,children:_jsxs(_components.code,{language:`http`,numberOfLines:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`HTTP`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`/`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1.1`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 429`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` Too Many Requests`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#569CD6`},children:`Retry-After`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 60`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`The OpenAI SDK, Anthropic SDK, Vercel AI SDK, and OpenRouter SDK already respect this header for backoff. If you’re using `,_jsx(_components.code,{children:`fetch`}),` directly, honor it before retrying:`]}),`\n`,_jsx(CodeBlock,{filename:``,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:` res`}),_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:`, { `}),_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:`if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`res`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`status`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ===`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 429`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ||`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` res`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`status`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ===`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 503`}),_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:` retryAfter`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` Number`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`res`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},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:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`get`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Retry-After'`}),_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:`Number`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`isFinite`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`retryAfter`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`\u0026\u0026`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` retryAfter`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` \u003e`}),_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\":`#C586C0`},children:`    await`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` Promise`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`((`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`r`}),_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:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` setTimeout`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`r`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`retryAfter`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` *`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1000`}),_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:`    // retry the request`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`moderation-errors`,children:`Moderation errors`}),`\n`,_jsxs(_components.p,{children:[`If your input was flagged, the `,_jsx(_components.code,{children:`error.metadata`}),` will contain information about the issue. The shape of the metadata is as follows:`]}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`6`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`6`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`type`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` ModerationErrorMetadata`}),_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:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  reasons`}),_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:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Why your input was flagged`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  flagged_input`}),_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:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// The text segment that was flagged, limited to 100 characters. If the flagged input is longer than 100 characters, it will be truncated in the middle and replaced with ...`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  provider_name`}),_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:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// The name of the provider that requested moderation`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  model_slug`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`};`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`guardrail-errors`,children:`Guardrail errors`}),`\n`,_jsxs(_components.p,{children:[`On inference endpoints (`,_jsx(_components.code,{children:`/chat/completions`}),`, `,_jsx(_components.code,{children:`/responses`}),`, `,_jsx(_components.code,{children:`/messages`}),`), a request can be blocked before it reaches a provider — for example by a content filter or prompt-injection detector configured via `,_jsx(_components.a,{href:`/guides/features/guardrails`,children:`guardrails`}),`. When this happens, the response is a `,_jsx(_components.code,{children:`403`}),` with a message describing the block reason. The OpenRouter-shaped body below applies to `,_jsx(_components.code,{children:`/chat/completions`}),` and `,_jsx(_components.code,{children:`/responses`}),`; on `,_jsx(_components.code,{children:`/messages`}),` the block is returned as an Anthropic `,_jsx(_components.code,{children:`permission_error`}),` envelope (see `,_jsx(_components.a,{href:`#anthropic-messages-apiv1messages`,children:`Anthropic Messages`}),` below), with `,_jsx(_components.code,{children:`openrouter_metadata`}),` still carried at the top level when opted in:`]}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`9`,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:`9`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"code\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`403`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Request blocked: prompt injection patterns detected\"`}),_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:`    \"metadata\"`}),_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:`      \"patterns\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"ignore all previous instructions\"`}),_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:[`When you opt in to `,_jsx(_components.a,{href:`/guides/features/router-metadata`,children:`router metadata`}),` via the `,_jsx(_components.code,{children:`X-OpenRouter-Experimental-Metadata: enabled`}),` header, the 403 response also includes the full `,_jsx(_components.code,{children:`openrouter_metadata`}),` object with routing context and a `,_jsx(_components.code,{children:`pipeline`}),` array detailing the guardrail stages that ran:`]}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,expandable:`true`,numberOfLines:`38`,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:`38`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"code\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`403`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Request blocked: prompt injection patterns detected\"`}),_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:`    \"metadata\"`}),_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:`      \"patterns\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"ignore all previous instructions\"`}),_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:`  \"openrouter_metadata\"`}),_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:`    \"requested\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"openai/gpt-4o\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"strategy\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"direct\"`}),_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:`    \"region\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"iad\"`}),_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:`    \"summary\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"available=1\"`}),_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:`    \"attempt\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--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:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"is_byok\"`}),_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`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"endpoints\"`}),_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:`      \"total\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--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:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"available\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`        { `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"provider\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"OpenAI\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},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:`\"openai/gpt-4o\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"selected\"`}),_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`,_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:`    \"pipeline\"`}),_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:`\"guardrail\"`}),_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:`\"regex_pi_detection\"`}),_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:`        \"guardrail_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"grd_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:`        \"guardrail_scope\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"api-key\"`}),_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:`        \"summary\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Blocked: prompt injection detected (1 pattern matched)\"`}),_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:`        \"data\"`}),_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:`          \"action\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"blocked\"`}),_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:`          \"detected\"`}),_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:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`          \"engines\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"regex\"`}),_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:`          \"patterns\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"ignore all previous instructions\"`}),_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:[`The `,_jsx(_components.code,{children:`openrouter_metadata`}),` object follows the same shape as on successful responses — see `,_jsx(_components.a,{href:`/guides/features/router-metadata#pipeline-stages`,children:`Pipeline Stages`}),` for the full stage type and field reference.`]}),`\n`,_jsx(Heading,{level:`2`,id:`provider-errors`,children:`Provider errors`}),`\n`,_jsxs(_components.p,{children:[`OpenRouter normalizes every upstream provider error into the stable, typed\n`,_jsx(_components.code,{children:`error_type`}),` vocabulary documented under `,_jsx(_components.a,{href:`#typed-error-codes`,children:`Typed Error Codes`}),`.\nThe same `,_jsx(_components.code,{children:`error_type`}),` values describe what went wrong whether the provider\nerror arrives in a non-streaming response body or as a mid-stream SSE event.\nNative protocol codes (the Anthropic `,_jsx(_components.code,{children:`error.type`}),`, the Responses `,_jsx(_components.code,{children:`error.code`}),`)\nare best-effort and can differ between formats — `,_jsx(_components.code,{children:`error_type`}),` is the field to\nrely on across all of them.`]}),`\n`,_jsxs(_components.p,{children:[`For Chat Completions, a provider error that interrupts generation carries\n`,_jsx(_components.code,{children:`error_type`}),` inside `,_jsx(_components.code,{children:`error.metadata`}),`:`]}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`10`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`10`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"code\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`429`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Rate limit exceeded\"`}),_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:`    \"metadata\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"error_type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"rate_limit_exceeded\"`}),_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:`      \"provider_code\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"rate_limited\"`})]}),`\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:[`The same value is carried on mid-stream errors and on the Anthropic and\nResponses skins — see `,_jsx(_components.a,{href:`#skin-specific-error-formats`,children:`Skin-Specific Error Formats`}),`\nfor the exact wire location in each format.`]}),`\n`,_jsx(Heading,{level:`3`,id:`masking-and-raw-provider-details`,children:`Masking and raw provider details`}),`\n`,_jsxs(_components.p,{children:[`When a request fails with a `,_jsx(_components.code,{children:`500`}),`, the `,_jsx(_components.code,{children:`message`}),` is replaced with a generic\nstring and `,_jsx(_components.code,{children:`provider_code`}),` and `,_jsx(_components.code,{children:`openrouter_metadata`}),` are omitted, but\n`,_jsx(_components.code,{children:`error_type`}),` is still present (`,_jsx(_components.code,{children:`server`}),`).`]}),`\n`,_jsxs(_components.p,{children:[`For non-500 errors, the upstream provider’s own error code is surfaced in\n`,_jsx(_components.code,{children:`error.metadata.provider_code`}),` when available. Opt-in routing context (which\nprovider was selected, fallback attempts, etc.) is carried in the\n`,_jsx(_components.code,{children:`openrouter_metadata`}),` object when the request sets `,_jsx(_components.code,{children:`X-OpenRouter-Metadata`}),`\n— it follows the same shape as on successful responses (routing-summary\nfields only; see\n`,_jsx(_components.a,{href:`/guides/features/router-metadata#pipeline-stages`,children:`Pipeline Stages`}),`).`]}),`\n`,_jsx(Heading,{level:`2`,id:`when-no-content-is-generated`,children:`When no content is generated`}),`\n`,_jsx(_components.p,{children:`Occasionally, the model may not generate any content. This typically occurs when:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`The model is warming up from a cold start`}),`\n`,_jsx(_components.li,{children:`The system is scaling up to handle more requests`}),`\n`]}),`\n`,_jsx(_components.p,{children:`Warm-up times usually range from a few seconds to a few minutes, depending on the model and provider.`}),`\n`,_jsx(_components.p,{children:`If you encounter persistent no-content issues, consider implementing a simple retry mechanism or trying again with a different provider or model that has more recent activity.`}),`\n`,_jsx(_components.p,{children:`In some cases, you may still be charged for the prompt processing cost by the upstream provider, even if no content is generated.`}),`\n`,_jsx(Heading,{level:`2`,id:`streaming-error-formats`,children:`Streaming error formats`}),`\n`,_jsxs(_components.p,{children:[`When using streaming mode (`,_jsx(_components.code,{children:`stream: true`}),`), errors are handled differently depending on when they occur:`]}),`\n`,_jsx(Heading,{level:`3`,id:`pre-stream-errors`,children:`Pre-stream errors`}),`\n`,_jsx(_components.p,{children:`Errors that occur before any tokens are sent follow the standard error format above, with appropriate HTTP status codes. At this stage the HTTP response hasn’t been committed yet, so OpenRouter can:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Return a proper HTTP error status (4xx/5xx)`}),`\n`,_jsxs(_components.li,{children:[`Silently retry with a different provider endpoint if `,_jsx(_components.a,{href:`/guides/routing/provider-selection`,children:`fallback routing`}),` is enabled`]}),`\n`,_jsx(_components.li,{children:`Apply rate-limit or auth checks before any work begins`}),`\n`]}),`\n`,_jsx(_components.p,{children:`You’ll see pre-stream errors for issues like invalid API keys, malformed requests, or when every available provider endpoint is exhausted before streaming starts.`}),`\n`,_jsx(Heading,{level:`3`,id:`mid-stream-errors`,children:`Mid-stream errors`}),`\n`,_jsxs(_components.p,{children:[`Once the first token has been written to the client, the HTTP `,_jsx(_components.code,{children:`200 OK`}),` status and headers are already committed — they can’t be changed. If the provider fails at this point, OpenRouter `,_jsx(_components.strong,{children:`cannot`}),` silently fail over to another provider because partial content has already been delivered to your application. The error must arrive in-band as an SSE event.`]}),`\n`,_jsx(_components.p,{children:`Common causes of mid-stream errors:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Provider disconnect`}),` — the upstream connection drops after partial output (network issue, provider crash, load balancer timeout)`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Provider timeout`}),` — the model stops responding mid-generation and the read deadline expires`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Token limit hit during generation`}),` — the model reaches `,_jsx(_components.code,{children:`max_tokens`}),` or the context window fills up while producing output`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Output content filter`}),` — a content moderation system flags generated text after some of it was already streamed`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Provider overload`}),` — the upstream returns a rate-limit or capacity error after beginning to stream`]}),`\n`]}),`\n`,_jsx(Note,{children:_jsx(_components.p,{children:`If an error occurs before any tokens are written — even on a streaming request — OpenRouter can still retry with a backup provider transparently. Mid-stream errors only happen when partial content has already been committed to your stream, making failover impossible.`})}),`\n`,_jsx(_components.p,{children:`Mid-stream errors are sent as Server-Sent Events (SSE) with a unified structure that includes both the error details and a completion choice:`}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,expandable:`true`,numberOfLines:`21`,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:`21`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`type`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` MidStreamError`}),_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:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  id`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  object`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'chat.completion.chunk'`}),_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:`  created`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` number`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_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:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` string`}),_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:`  provider`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  error`}),_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:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`    code`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` number`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;       `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// HTTP status code (e.g. 400, 429, 502)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`    message`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`    metadata`}),_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:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`      error_type`}),_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:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Typed error code — see table below`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`      provider_code`}),_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:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Original upstream error code (omitted on 500s)`})]}),`\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:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  choices`}),_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:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`    index`}),_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`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`    delta`}),_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:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`content`}),_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:` };`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--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:` 'error'`}),_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:`    native_finish_reason`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`?:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`,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:`Example SSE data:`}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`2`,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:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`data: {\"id\":\"gen-abc123\",\"object\":\"chat.completion.chunk\",\"created\":1234567890,\"model\":\"openai/gpt-4o\",\"provider\":\"OpenAI\",\"error\":{\"code\":429,\"message\":\"Rate limit exceeded\",\"metadata\":{\"error_type\":\"rate_limit_exceeded\"}},\"choices\":[{\"index\":0,\"delta\":{\"content\":\"\"},\"finish_reason\":\"error\"}]}`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:`Key characteristics:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`The error appears at the `,_jsx(_components.strong,{children:`top level`}),` alongside standard response fields`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`error.metadata.error_type`}),` carries a typed code you can switch on programmatically — see `,_jsx(_components.a,{href:`#typed-error-codes`,children:`Typed Error Codes`}),` for the full list`]}),`\n`,_jsxs(_components.li,{children:[`A `,_jsx(_components.code,{children:`choices`}),` array is included with `,_jsx(_components.code,{children:`finish_reason: \"error\"`}),` to properly terminate the stream`]}),`\n`,_jsx(_components.li,{children:`The HTTP status remains 200 OK since headers were already sent`}),`\n`,_jsx(_components.li,{children:`The stream is terminated after this event`}),`\n`,_jsxs(_components.li,{children:[`On 500-class errors, `,_jsx(_components.code,{children:`error.message`}),` is replaced with a generic string and `,_jsx(_components.code,{children:`provider_code`}),` is omitted to prevent leaking upstream details`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`typed-error-codes`,children:`Typed error codes`}),`\n`,_jsxs(_components.p,{children:[`When a provider error reaches your application, OpenRouter tags it with a\ncanonical `,_jsx(_components.code,{children:`error_type`}),` string — both on the non-streaming response body and\non mid-stream SSE events. Use this value, not the HTTP status code alone, to\nprogrammatically distinguish error categories. It is stable across all three\nAPI skins even when the native protocol code is lossy.`]}),`\n`,_jsxs(_components.p,{children:[`Where `,_jsx(_components.code,{children:`error_type`}),` appears depends on the skin and path:`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Chat Completions`}),`: `,_jsx(_components.code,{children:`error.metadata.error_type`}),` — on the mid-stream error\nchunk (see `,_jsx(_components.a,{href:`#mid-stream-errors`,children:`Mid-Stream Errors`}),`) and on the non-streaming\nresponse when a provider error interrupts generation.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Anthropic Messages`}),`: `,_jsx(_components.code,{children:`error.error_type`}),` on the SSE `,_jsx(_components.code,{children:`error`}),` event and the\nnon-streaming error envelope.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Responses`}),`: top-level `,_jsx(_components.code,{children:`error_type`}),` on the failed response, for both the\nstreaming `,_jsx(_components.code,{children:`response.failed`}),` event and the non-streaming JSON body.`]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`The HTTP status each `,_jsx(_components.code,{children:`error_type`}),` maps to is listed in the tables below.`]}),`\n`,_jsx(Heading,{level:`3`,id:`token-and-length-limits`,children:`Token and length limits`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:_jsx(_components.code,{children:`error_type`})}),_jsx(_components.th,{children:`HTTP Status`}),_jsx(_components.th,{children:`Description`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`context_length_exceeded`})}),_jsx(_components.td,{children:`The combined input and output tokens exceed the model’s context window.`}),_jsx(_components.td,{})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`max_tokens_exceeded`})}),_jsxs(_components.td,{children:[`Generation stopped because `,_jsx(_components.code,{children:`max_tokens`}),` (or `,_jsx(_components.code,{children:`max_completion_tokens`}),`) was reached.`]}),_jsx(_components.td,{})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`token_limit_exceeded`})}),_jsx(_components.td,{children:`A token budget enforced by OpenRouter (e.g. credit-based cap) was exceeded.`}),_jsx(_components.td,{})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`string_too_long`})}),_jsx(_components.td,{children:`A single string field in the request (system prompt, user message, etc.) exceeded the provider’s per-field character limit.`}),_jsx(_components.td,{})]})]})]}),`\n`,_jsx(Heading,{level:`3`,id:`authentication-and-authorization`,children:`Authentication and authorization`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:_jsx(_components.code,{children:`error_type`})}),_jsx(_components.th,{children:`HTTP Status`}),_jsx(_components.th,{children:`Description`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`authentication`})}),_jsx(_components.td,{children:`The API key is missing, invalid, or revoked.`}),_jsx(_components.td,{})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`permission_denied`})}),_jsxs(_components.td,{children:[`The key is valid but lacks the required permission or the request was blocked by a `,_jsx(_components.a,{href:`/guides/features/guardrails`,children:`guardrail`}),`.`]}),_jsx(_components.td,{})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`payment_required`})}),_jsxs(_components.td,{children:[`The account or API key has insufficient credits. `,_jsx(_components.a,{href:`https://openrouter.ai/credits`,children:`Add credits`}),` and retry.`]}),_jsx(_components.td,{})]})]})]}),`\n`,_jsx(Heading,{level:`3`,id:`rate-limiting-and-availability`,children:`Rate limiting and availability`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:_jsx(_components.code,{children:`error_type`})}),_jsx(_components.th,{children:`HTTP Status`}),_jsx(_components.th,{children:`Description`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`rate_limit_exceeded`})}),_jsxs(_components.td,{children:[`Request- or token-level rate limit hit. Respect the `,_jsx(_components.code,{children:`Retry-After`}),` header before retrying.`]}),_jsx(_components.td,{})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`provider_overloaded`})}),_jsx(_components.td,{children:`The upstream provider is temporarily overloaded. Retry after a short delay.`}),_jsx(_components.td,{})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`provider_unavailable`})}),_jsx(_components.td,{children:`The upstream provider returned an invalid or empty response. OpenRouter may auto-retry with another provider if fallback routing is enabled.`}),_jsx(_components.td,{})]})]})]}),`\n`,_jsx(Heading,{level:`3`,id:`request-validation`,children:`Request validation`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:_jsx(_components.code,{children:`error_type`})}),_jsx(_components.th,{children:`HTTP Status`}),_jsx(_components.th,{children:`Description`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`invalid_request`})}),_jsx(_components.td,{children:`A request parameter is malformed or missing.`}),_jsx(_components.td,{})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`invalid_prompt`})}),_jsxs(_components.td,{children:[`A specific message in the `,_jsx(_components.code,{children:`messages`}),` array is invalid (e.g. unsupported role, empty content).`]}),_jsx(_components.td,{})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`not_found`})}),_jsx(_components.td,{children:`The requested resource (model, file, etc.) does not exist.`}),_jsx(_components.td,{})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`precondition_failed`})}),_jsxs(_components.td,{children:[`A precondition header (e.g. `,_jsx(_components.code,{children:`If-Match`}),`) was not satisfied.`]}),_jsx(_components.td,{})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`payload_too_large`})}),_jsx(_components.td,{children:`The request body exceeds the maximum allowed size.`}),_jsx(_components.td,{})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`unprocessable`})}),_jsx(_components.td,{children:`The request is syntactically valid but semantically unprocessable.`}),_jsx(_components.td,{})]})]})]}),`\n`,_jsx(Heading,{level:`3`,id:`content-policy`,children:`Content policy`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:_jsx(_components.code,{children:`error_type`})}),_jsx(_components.th,{children:`HTTP Status`}),_jsx(_components.th,{children:`Description`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`content_policy_violation`})}),_jsx(_components.td,{children:`The input or output was flagged by a content filter (provider- or OpenRouter-level).`}),_jsx(_components.td,{})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`refusal`})}),_jsx(_components.td,{children:`The model explicitly refused to comply with the request (e.g. safety refusal).`}),_jsx(_components.td,{})]})]})]}),`\n`,_jsx(Heading,{level:`3`,id:`image-errors`,children:`Image errors`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:_jsx(_components.code,{children:`error_type`})}),_jsx(_components.th,{children:`HTTP Status`}),_jsx(_components.th,{children:`Description`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`invalid_image`})}),_jsx(_components.td,{children:`An image in the request is corrupt or unreadable.`}),_jsx(_components.td,{})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`image_too_large`})}),_jsx(_components.td,{children:`An image exceeds the provider’s maximum file size or pixel dimensions.`}),_jsx(_components.td,{})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`image_too_small`})}),_jsx(_components.td,{children:`An image is below the provider’s minimum pixel dimensions.`}),_jsx(_components.td,{})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`unsupported_image_format`})}),_jsx(_components.td,{children:`The image format is not supported by the provider.`}),_jsx(_components.td,{})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`image_not_found`})}),_jsx(_components.td,{children:`The referenced image URL or file ID could not be resolved.`}),_jsx(_components.td,{})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`image_download_failed`})}),_jsx(_components.td,{children:`OpenRouter could not download the image from the provided URL (DNS failure, timeout, non-200 response, etc.).`}),_jsx(_components.td,{})]})]})]}),`\n`,_jsx(Heading,{level:`3`,id:`generic`,children:`Generic`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:_jsx(_components.code,{children:`error_type`})}),_jsx(_components.th,{children:`HTTP Status`}),_jsx(_components.th,{children:`Description`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`server`})}),_jsx(_components.td,{children:`An unexpected internal error. The upstream error message is masked on this type.`}),_jsx(_components.td,{})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`timeout`})}),_jsx(_components.td,{children:`The provider did not respond within the allowed time.`}),_jsx(_components.td,{})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`unmapped`})}),_jsxs(_components.td,{children:[`An upstream error that doesn’t map to any known category. `,_jsx(_components.code,{children:`error.metadata.provider_code`}),` may contain the original code.`]}),_jsx(_components.td,{})]})]})]}),`\n`,_jsx(Heading,{level:`2`,id:`model-availability-errors`,children:`Model availability errors`}),`\n`,_jsxs(_components.p,{children:[`When a requested model cannot be served — it doesn’t exist, is deprecated, has no routable endpoints under your preferences, or all of its providers are at capacity — the error response carries an additional `,_jsx(_components.code,{children:`error.availability`}),` object. It is `,_jsx(_components.strong,{children:`additive`}),`: `,_jsx(_components.code,{children:`error_type`}),`, `,_jsx(_components.code,{children:`http_status`}),`, and `,_jsx(_components.code,{children:`message`}),` keep their existing values, so existing error handling keeps working. Use `,_jsx(_components.code,{children:`availability.code`}),` — not the HTTP status or the message prose — to programmatically distinguish availability conditions.`]}),`\n`,_jsxs(_components.p,{children:[`The same `,_jsx(_components.code,{children:`availability`}),` object is emitted on streaming error chunks for all three API skins (Chat Completions, Responses, Anthropic Messages).`]}),`\n`,_jsx(Heading,{level:`3`,id:`availability-codes`,children:`Availability codes`}),`\n`,_jsxs(_components.p,{children:[`Every model-availability failure maps to exactly one code. Codes are stable forever; new codes may be added in the future, so treat an unrecognized code defensively and fall back to `,_jsx(_components.code,{children:`retryable`}),`.`]}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:_jsx(_components.code,{children:`availability.code`})}),_jsx(_components.th,{children:`HTTP`}),_jsx(_components.th,{children:_jsx(_components.code,{children:`error_type`})}),_jsx(_components.th,{children:`Retryable`}),_jsx(_components.th,{children:`Meaning`}),_jsx(_components.th,{children:`Recommended client action`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`model_not_found`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`invalid_request`})}),_jsx(_components.td,{children:`No`}),_jsx(_components.td,{children:`The model id is unknown or invalid.`}),_jsxs(_components.td,{children:[`Do not retry. Check the slug for typos or a legacy alias; use `,_jsx(_components.code,{children:`fallback_models`}),` suggestions when present.`]}),_jsx(_components.td,{})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`wrong_endpoint`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`invalid_request`})}),_jsx(_components.td,{children:`No`}),_jsxs(_components.td,{children:[`The model exists but was called on the wrong endpoint (e.g. an embedding model on `,_jsx(_components.code,{children:`/chat/completions`}),`).`]}),_jsxs(_components.td,{children:[`Retry on the endpoint named in `,_jsx(_components.code,{children:`constraint.detail`}),`.`]}),_jsx(_components.td,{})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`no_endpoints`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`not_found`})}),_jsx(_components.td,{children:`No`}),_jsx(_components.td,{children:`The model exists but has zero routable endpoints (none configured, all disabled/hidden, or all removed by your provider preferences).`}),_jsx(_components.td,{children:`Do not retry the identical request. Loosen provider routing preferences or choose another model.`}),_jsx(_components.td,{})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`model_deprecated`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`not_found`})}),_jsx(_components.td,{children:`No`}),_jsx(_components.td,{children:`The model was deprecated or removed (sunset models, ended stealth alphas).`}),_jsxs(_components.td,{children:[`Migrate to the successor in `,_jsx(_components.code,{children:`fallback_models`}),`; see `,_jsx(_components.code,{children:`docs_url`}),` for the deprecation notice.`]}),_jsx(_components.td,{})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`model_unavailable_upstream`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`not_found`})}),_jsx(_components.td,{children:`No`}),_jsx(_components.td,{children:`Every endpoint for the model returns 404 upstream — the provider removed it.`}),_jsxs(_components.td,{children:[`Do not retry; pick another model (`,_jsx(_components.code,{children:`fallback_models`}),` when present).`]}),_jsx(_components.td,{})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`capacity_exhausted`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`rate_limit_exceeded`})}),_jsx(_components.td,{children:`Yes`}),_jsx(_components.td,{children:`All providers for the model are at capacity (all attempts returned 429).`}),_jsxs(_components.td,{children:[`Retry after `,_jsx(_components.code,{children:`retry_after`}),` seconds (also sent as the `,_jsx(_components.code,{children:`Retry-After`}),` header), or route to a `,_jsx(_components.code,{children:`fallback_models`}),` entry.`]}),_jsx(_components.td,{})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`temporarily_unavailable`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`provider_overloaded`})}),_jsx(_components.td,{children:`Yes`}),_jsx(_components.td,{children:`All attempts failed with transient upstream 5xx responses or timeouts.`}),_jsxs(_components.td,{children:[`Retry with backoff, honoring `,_jsx(_components.code,{children:`retry_after`}),` when present; consider `,_jsx(_components.code,{children:`fallback_models`}),` for latency-sensitive paths.`]}),_jsx(_components.td,{})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`region_restricted`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`permission_denied`})}),_jsx(_components.td,{children:`No`}),_jsx(_components.td,{children:`The model is geo-gated and not available in your region.`}),_jsx(_components.td,{children:`Do not retry from the same region. Adjust provider routing or serve traffic from an allowed region.`}),_jsx(_components.td,{})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`privacy_restricted`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`not_found`})}),_jsx(_components.td,{children:`No`}),_jsx(_components.td,{children:`Your data-policy preferences (ZDR, training opt-out, free-model publication) eliminated every endpoint.`}),_jsxs(_components.td,{children:[`Relax the policy named in `,_jsx(_components.code,{children:`excluded_by`}),` (e.g. at `,_jsx(_components.a,{href:`https://openrouter.ai/settings/privacy`,children:`privacy settings`}),`) or choose another model.`]}),_jsx(_components.td,{})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`constraint_filtered`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`not_found`})}),_jsx(_components.td,{children:`No`}),_jsxs(_components.td,{children:[`A routing constraint — max price, context length, `,_jsx(_components.code,{children:`require_parameters`}),`, quantization, data region — eliminated every endpoint.`]}),_jsxs(_components.td,{children:[`Relax the constraint named in `,_jsx(_components.code,{children:`constraint.field`}),` / `,_jsx(_components.code,{children:`excluded_by`}),` and retry.`]}),_jsx(_components.td,{})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`free_variant_ended`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`not_found`})}),_jsx(_components.td,{children:`No`}),_jsxs(_components.td,{children:[`The `,_jsx(_components.code,{children:`:free`}),` variant’s promotion ended; only paid endpoints remain.`]}),_jsxs(_components.td,{children:[`Switch to the paid slug in `,_jsx(_components.code,{children:`fallback_models`}),` (normal pricing applies) or pick another model.`]}),_jsx(_components.td,{})]})]})]}),`\n`,_jsxs(Note,{children:[_jsx(_components.code,{children:`no_endpoints`}),` and `,_jsx(_components.code,{children:`model_unavailable_upstream`}),` are non-retryable today, but the router may mark individual occurrences `,_jsx(_components.code,{children:`retryable: true`}),` when the underlying condition is transient. Always switch on `,_jsx(_components.code,{children:`availability.retryable`}),`, not just the code.`]}),`\n`,_jsxs(Heading,{level:`3`,id:`the-availability-object`,children:[`The `,_jsx(_components.code,{children:`availability`}),` object`]}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`14`,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:`14`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`type`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` AvailabilityError`}),_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:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  code`}),_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:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// one of the codes above — the machine-readable discriminator`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  retryable`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` boolean`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;                  `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// would an identical retry plausibly succeed?`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  retry_after`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`?:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` number`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` |`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` null`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;         `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// seconds to wait before retrying, when known (429/503 paths)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  requested_models`}),_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:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// the raw model slugs you sent`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  affected_providers`}),_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:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` null`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`; `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// providers whose endpoints were attempted or excluded`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  excluded_by`}),_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:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// routing filter(s) that removed the last endpoints`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  fallback_models`}),_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:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// suggested alternative model slugs; may be empty or omitted`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  constraint`}),_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:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// present on constraint_filtered and wrong_endpoint`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`    field`}),_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:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// e.g. \"max_price\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`    detail`}),_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:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// human-readable explanation`})]}),`\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:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  docs_url`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;                    `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// anchor for this code on this page`})]}),`\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.code,{children:`code`}),`, `,_jsx(_components.code,{children:`retryable`}),`, `,_jsx(_components.code,{children:`requested_models`}),`, and `,_jsx(_components.code,{children:`docs_url`}),` are always present on an availability error. Other fields are omitted (never serialized as empty strings) when not applicable. `,_jsx(_components.code,{children:`excluded_by`}),` values are drawn from a fixed vocabulary: `,_jsx(_components.code,{children:`geo`}),`, `,_jsx(_components.code,{children:`data_region`}),`, `,_jsx(_components.code,{children:`data_policy:zdr`}),`, `,_jsx(_components.code,{children:`data_policy:training`}),`, `,_jsx(_components.code,{children:`max_price`}),`, `,_jsx(_components.code,{children:`context_length`}),`, `,_jsx(_components.code,{children:`require_parameters`}),`, `,_jsx(_components.code,{children:`quantization`}),`, `,_jsx(_components.code,{children:`allowed_providers`}),`.`]}),`\n`,_jsxs(_components.p,{children:[`For debugging, `,_jsx(_components.code,{children:`error.metadata.previous_errors`}),` carries the per-provider attempt history in a slim, stable shape — `,_jsx(_components.code,{children:`{ \"provider\": \"...\", \"code\": \"...\", \"status\": 429 }`}),` — and never includes raw upstream provider error bodies.`]}),`\n`,_jsxs(Heading,{level:`3`,id:`retrying-with-retry_after`,children:[`Retrying with `,_jsx(_components.code,{children:`retry_after`})]}),`\n`,_jsxs(_components.p,{children:[`For `,_jsx(_components.code,{children:`capacity_exhausted`}),` and `,_jsx(_components.code,{children:`temporarily_unavailable`}),`, `,_jsx(_components.code,{children:`availability.retry_after`}),` mirrors the `,_jsx(_components.code,{children:`Retry-After`}),` response header in the body and is populated whenever any attempted endpoint supplied a retry hint (the minimum across attempts). Both are expressed in seconds:`]}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`11`,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:`11`,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:` res`}),_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:`, { `}),_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:` body`}),_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:` res`}),_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:` availability`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--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:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`?.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`availability`}),_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:`availability`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`?.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`retryable`}),_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:` waitSeconds`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    availability`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`retry_after`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ??`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`    Number`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`res`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},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:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`get`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Retry-After'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`||`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`    2`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` **`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` attempt`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`; `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// exponential backoff fallback when no hint is given`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`  await`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` Promise`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`((`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`r`}),_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:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` setTimeout`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`r`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`waitSeconds`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` *`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1000`}),_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:`  // retry the identical request`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`The OpenAI, Anthropic, Vercel AI, and OpenRouter SDKs already honor the `,_jsx(_components.code,{children:`Retry-After`}),` header; `,_jsx(_components.code,{children:`availability.retry_after`}),` exposes the same signal to clients that inspect bodies rather than headers.`]}),`\n`,_jsxs(Heading,{level:`3`,id:`using-fallback_models-suggestions`,children:[`Using `,_jsx(_components.code,{children:`fallback_models`}),` suggestions`]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`fallback_models`}),` contains suggested alternative slugs the router can point to cheaply — the paid variant after a `,_jsx(_components.code,{children:`:free`}),` promotion ends, the successor of a deprecated model, or same-family alternatives. It is omitted when no suggestion is available and never delays the error response.`]}),`\n`,_jsx(_components.p,{children:`Suggestions are hints, not guarantees: a fallback may differ in price, context window, or capabilities, and it may be unavailable under your own routing preferences. Validate the slug against your requirements (or surface it to your user) before silently switching models.`}),`\n`,_jsx(Heading,{level:`3`,id:`example-availability-error-payloads`,children:`Example availability error payloads`}),`\n`,_jsx(_components.p,{children:_jsxs(_components.strong,{children:[`All providers at capacity — `,_jsx(_components.code,{children:`capacity_exhausted`}),` (retryable):`]})}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`22`,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:`22`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"All providers for anthropic/claude-sonnet-4.5 are at capacity. Retry after 40 seconds.\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"error_type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"rate_limit_exceeded\"`}),_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:`    \"http_status\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`429`}),_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:`    \"availability\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"code\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"capacity_exhausted\"`}),_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:`      \"retryable\"`}),_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:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"retry_after\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`40`}),_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:`      \"requested_models\"`}),_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:`      \"affected_providers\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"anthropic\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"amazon-bedrock\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"google-vertex\"`}),_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:`      \"fallback_models\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"anthropic/claude-haiku-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:`      \"docs_url\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"https://openrouter.ai/docs/errors#capacity_exhausted\"`})]}),`\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:`    \"metadata\"`}),_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:`      \"previous_errors\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`        { `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"provider\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"anthropic\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"code\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"capacity_exhausted\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"status\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`429`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`        { `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"provider\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"amazon-bedrock\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"code\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"capacity_exhausted\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"status\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`429`}),_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:_jsxs(_components.strong,{children:[`Deprecated stealth model — `,_jsx(_components.code,{children:`model_deprecated`}),`:`]})}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`14`,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:`14`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Quasar Alpha was a stealth model, revealed on April 14th as an early testing version of GPT-4.1.\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"error_type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"not_found\"`}),_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:`    \"http_status\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`404`}),_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:`    \"availability\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"code\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"model_deprecated\"`}),_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:`      \"retryable\"`}),_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`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"requested_models\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"openrouter/quasar-alpha\"`}),_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:`      \"fallback_models\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"openai/gpt-4.1\"`}),_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:`      \"docs_url\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"https://openrouter.ai/docs/errors#model_deprecated\"`})]}),`\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:_jsxs(_components.strong,{children:[`Privacy restriction eliminated all endpoints — `,_jsx(_components.code,{children:`privacy_restricted`}),`:`]})}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`15`,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:`15`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"No endpoints for openai/gpt-5.2 match your data policy (zero data retention). Adjust at https://openrouter.ai/settings/privacy.\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"error_type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"not_found\"`}),_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:`    \"http_status\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`404`}),_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:`    \"availability\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"code\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"privacy_restricted\"`}),_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:`      \"retryable\"`}),_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`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"requested_models\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"openai/gpt-5.2\"`}),_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:`      \"affected_providers\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"openai\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"azure\"`}),_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:`      \"excluded_by\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"data_policy:zdr\"`}),_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:`      \"docs_url\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"https://openrouter.ai/docs/errors#privacy_restricted\"`})]}),`\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:_jsxs(_components.strong,{children:[`Unknown model id — `,_jsx(_components.code,{children:`model_not_found`}),`:`]})}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`13`,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:`13`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"acme/fake-1.0 is not a valid model ID\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"error_type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"invalid_request\"`}),_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:`    \"http_status\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`400`}),_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:`    \"availability\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"code\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"model_not_found\"`}),_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:`      \"retryable\"`}),_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`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"requested_models\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"acme/fake-1.0\"`}),_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:`      \"docs_url\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"https://openrouter.ai/docs/errors#model_not_found\"`})]}),`\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:`2`,id:`skin-specific-error-formats`,children:`Skin-specific error formats`}),`\n`,_jsxs(_components.p,{children:[`OpenRouter exposes three API skins. Each translates the same internal provider error types into its own wire format, for non-streaming responses and in-stream errors alike. In every case `,_jsx(_components.code,{children:`error_type`}),` is the stable field; the wire location differs per skin.`]}),`\n`,_jsxs(Heading,{level:`3`,id:`chat-completions-/api/v1/chat/completions`,children:[`Chat Completions (`,_jsx(_components.code,{children:`/api/v1/chat/completions`}),`)`]}),`\n`,_jsxs(_components.p,{children:[`Mid-stream errors appear as a `,_jsx(_components.code,{children:`chat.completion.chunk`}),` with a top-level `,_jsx(_components.code,{children:`error`}),` object (shape shown `,_jsx(_components.a,{href:`#mid-stream-errors`,children:`above`}),`). The `,_jsx(_components.code,{children:`error.metadata.error_type`}),` field carries the typed code.`]}),`\n`,_jsx(_components.p,{children:`For non-streaming requests where a provider error occurs, the error is embedded in the final response alongside any partial content:`}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`11`,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:`11`,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:`  \"choices\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [{`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: { `}),_jsx(_components.span,{style:{color:`#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:`, `}),_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:`\"partial output...\"`}),_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:`    \"finish_reason\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"code\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`502`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Provider disconnected mid-stream\"`}),_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:`      \"metadata\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: { `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"error_type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"provider_unavailable\"`}),_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(Heading,{level:`3`,id:`responses-api-/api/v1/responses`,children:[`Responses API (`,_jsx(_components.code,{children:`/api/v1/responses`}),`)`]}),`\n`,_jsxs(_components.p,{children:[`The Responses API maps internal error types to the OpenAI Responses error code set. The mapping is narrower — many distinct internal types collapse to `,_jsx(_components.code,{children:`server_error`}),` — so the precise reason is preserved in a top-level `,_jsx(_components.code,{children:`error_type`}),` field on the response, outside the native `,_jsx(_components.code,{children:`error`}),` object:`]}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsxs(_components.th,{children:[`Internal `,_jsx(_components.code,{children:`error_type`})]}),_jsxs(_components.th,{children:[`Responses API `,_jsx(_components.code,{children:`code`})]})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`rate_limit_exceeded`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`rate_limit_exceeded`})})]}),_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[_jsx(_components.code,{children:`context_length_exceeded`}),`, `,_jsx(_components.code,{children:`invalid_request`})]}),_jsx(_components.td,{children:_jsx(_components.code,{children:`invalid_prompt`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`content_policy_violation`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`image_content_policy_violation`})})]}),_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[_jsx(_components.code,{children:`authentication`}),`, `,_jsx(_components.code,{children:`provider_overloaded`}),`, `,_jsx(_components.code,{children:`provider_unavailable`}),`, `,_jsx(_components.code,{children:`timeout`}),`, `,_jsx(_components.code,{children:`server`})]}),_jsx(_components.td,{children:_jsx(_components.code,{children:`server_error`})})]}),_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[`All others (including `,_jsx(_components.code,{children:`invalid_prompt`}),`)`]}),_jsx(_components.td,{children:_jsx(_components.code,{children:`server_error`})})]})]})]}),`\n`,_jsxs(_components.p,{children:[`Both the streaming terminal event and the non-streaming JSON body carry the canonical `,_jsx(_components.code,{children:`error_type`}),` at the top level of the response object. For example, an authentication failure collapses to the native `,_jsx(_components.code,{children:`server_error`}),` code but keeps `,_jsx(_components.code,{children:`error_type: \"authentication\"`}),`:`]}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`6`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`6`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"resp_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:`  \"status\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"failed\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: { `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"code\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"server_error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Invalid credentials\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"error_type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"authentication\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Streaming errors surface as one of three SSE event types, each wrapping the same response object:`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`response.failed`})}),` — terminal event when the response could not complete:`]}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`9`,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:`9`,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:`  \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"response.failed\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"response\"`}),_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:`\"resp_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:`    \"status\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"failed\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: { `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"code\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"server_error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Internal server error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"error_type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"server\"`})]}),`\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`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`response.error`})}),` — error during response generation:`]}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`4`,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:`4`,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:`  \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"response.error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: { `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"code\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"rate_limit_exceeded\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Rate limit exceeded\"`}),_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`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`error`})}),` — plain error event (matches upstream OpenAI behavior):`]}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`4`,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:`4`,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:`  \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: { `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"code\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"invalid_api_key\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Invalid API key provided\"`}),_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`]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`error-code-transformations`,children:`Error code transformations`}),`\n`,_jsx(_components.p,{children:`Certain token/length errors are transformed into successful completions instead of failures:`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:_jsx(_components.code,{children:`error_type`})}),_jsx(_components.th,{children:`Transformed To`}),_jsx(_components.th,{children:`Finish Reason`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`context_length_exceeded`})}),_jsx(_components.td,{children:`Success`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`length`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`max_tokens_exceeded`})}),_jsx(_components.td,{children:`Success`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`length`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`token_limit_exceeded`})}),_jsx(_components.td,{children:`Success`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`length`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`string_too_long`})}),_jsx(_components.td,{children:`Success`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`length`})})]})]})]}),`\n`,_jsx(_components.p,{children:`This allows graceful handling of limit-based errors without treating them as failures.`}),`\n`,_jsxs(Heading,{level:`3`,id:`anthropic-messages-/api/v1/messages`,children:[`Anthropic Messages (`,_jsx(_components.code,{children:`/api/v1/messages`}),`)`]}),`\n`,_jsx(_components.p,{children:`The Anthropic Messages skin maps internal types to Anthropic-native error type strings:`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsxs(_components.th,{children:[`Internal `,_jsx(_components.code,{children:`error_type`})]}),_jsxs(_components.th,{children:[`Anthropic `,_jsx(_components.code,{children:`error.type`})]})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`authentication`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`authentication_error`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`permission_denied`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`permission_error`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`payment_required`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`billing_error`})})]}),_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[_jsx(_components.code,{children:`not_found`}),`, `,_jsx(_components.code,{children:`image_not_found`})]}),_jsx(_components.td,{children:_jsx(_components.code,{children:`not_found_error`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`rate_limit_exceeded`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`rate_limit_error`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`provider_overloaded`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`overloaded_error`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`timeout`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`timeout_error`})})]}),_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[_jsx(_components.code,{children:`context_length_exceeded`}),`, `,_jsx(_components.code,{children:`content_policy_violation`}),`, `,_jsx(_components.code,{children:`invalid_request`}),`, …`]}),_jsx(_components.td,{children:_jsx(_components.code,{children:`invalid_request_error`})})]}),_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[_jsx(_components.code,{children:`provider_unavailable`}),`, `,_jsx(_components.code,{children:`server`}),`, `,_jsx(_components.code,{children:`unmapped`}),`, …`]}),_jsx(_components.td,{children:_jsx(_components.code,{children:`api_error`})})]})]})]}),`\n`,_jsxs(_components.p,{children:[`Because the native `,_jsx(_components.code,{children:`error.type`}),` is lossy (many internal types collapse to `,_jsx(_components.code,{children:`api_error`}),`), the canonical `,_jsx(_components.code,{children:`error_type`}),` is added inside the `,_jsx(_components.code,{children:`error`}),` object alongside it. This holds for both the non-streaming error envelope and mid-stream SSE `,_jsx(_components.code,{children:`error`}),` events.`]}),`\n`,_jsxs(_components.p,{children:[`Non-streaming error envelope (pre-Router errors such as authentication failures carry a `,_jsx(_components.code,{children:`null`}),` `,_jsx(_components.code,{children:`request_id`}),`; post-Router errors carry the `,_jsx(_components.code,{children:`gen-`}),` generation ID):`]}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`9`,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:`9`,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:`  \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"authentication_error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Invalid credentials\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"error_type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"authentication\"`})]}),`\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:`  \"request_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`null`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Mid-stream errors are emitted as an SSE `,_jsx(_components.code,{children:`error`}),` event with the same shape:`]}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`8`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`8`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`  \"error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"overloaded_error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Provider is temporarily overloaded\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`    \"error_type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"provider_overloaded\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`debugging`,children:`Debugging`}),`\n`,_jsxs(_components.p,{children:[`OpenRouter provides a `,_jsx(_components.code,{children:`debug`}),` option that allows you to inspect the exact request body that was sent to the upstream provider. This works with both the Chat Completions API (`,_jsx(_components.code,{children:`/api/v1/chat/completions`}),`) and the Responses API (`,_jsx(_components.code,{children:`/api/v1/responses`}),`). Useful for understanding how OpenRouter transforms your request parameters for different providers.`]}),`\n`,_jsx(Heading,{level:`3`,id:`debug-option-shape`,children:`Debug option shape`}),`\n`,_jsx(_components.p,{children:`The debug option is an object with the following shape:`}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`3`,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:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`type`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` DebugOptions`}),_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:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  echo_upstream_body`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`?:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` boolean`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`; `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// If true, returns the transformed request body sent to the provider`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`};`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`usage`,children:`Usage`}),`\n`,_jsxs(_components.p,{children:[`To enable debug output, include the `,_jsx(_components.code,{children:`debug`}),` parameter in your request:`]}),`\n`,_jsx(Heading,{level:`4`,id:`chat-completions`,children:`Chat Completions`}),`\n`,_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`TypeScript`,lines:`true`,expandable:`true`,numberOfLines:`35`,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:`35`,children:[_jsxs(_components.span,{className:`line`,children:[_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 \u003cOPENROUTER_API_KEY\u003e'`}),_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:` 'anthropic/claude-haiku-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:`    stream:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` true`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Debug only works with streaming`})]}),`\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`,_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:` 'user'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`content:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'Hello!'`}),_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:`    debug:`}),_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:`      echo_upstream_body:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` true`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  }),`})}),`\n`,_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:` text`}),_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:`text`}),_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:` text`}),_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:`)) {`})]}),`\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:`#CF222E`,\"--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:`)) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`continue`}),_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:`#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`,_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:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ===`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '[DONE]'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},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`}),`\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:` parsed`}),_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:`data`}),_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:`parsed`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`debug`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`?.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`echo_upstream_body`}),_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:`#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:`Debug:'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--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:`stringify`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`parsed`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`debug`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`echo_upstream_body`}),_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:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`2`}),_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:`  process`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`stdout`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`write`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`parsed`}),_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:`content`}),_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:`);`})]}),`\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:`28`,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:`28`,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:` requests`})]}),`\n`,_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`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\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.post(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  url`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#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:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  headers`}),_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:`    \"Authorization\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Bearer \u003cOPENROUTER_API_KEY\u003e\"`}),_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\":`#D4D4D4`},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:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  data`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`json.dumps({`})]}),`\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:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"anthropic/claude-haiku-4.5\"`}),_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:`    \"stream\"`}),_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:`#0A3069`,\"--shiki-dark\":`#CE9178`},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:`#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:`, `}),_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.\"`}),_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:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"role\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"user\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Hello!\"`}),_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:`    \"debug\"`}),_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:`      \"echo_upstream_body\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_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`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  stream`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_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`}),`\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:` line `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`in`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` response.iter_lines():`})]}),`\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:` line:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    text `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` line.decode(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'utf-8'`}),_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:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'echo_upstream_body'`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` in`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` text:`})]}),`\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:`(text)`})]}),`\n`]})})})]}),`\n`,_jsx(Heading,{level:`4`,id:`responses-api`,children:`Responses API`}),`\n`,_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`TypeScript`,lines:`true`,expandable:`true`,numberOfLines:`30`,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:`30`,children:[_jsxs(_components.span,{className:`line`,children:[_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/responses'`}),_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 \u003cOPENROUTER_API_KEY\u003e'`}),_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:` 'anthropic/claude-haiku-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:`    stream:`}),_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:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    input:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'Hello!'`}),_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:`    debug:`}),_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:`      echo_upstream_body:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` true`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  }),`})}),`\n`,_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:` text`}),_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:`text`}),_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:` text`}),_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:`)) {`})]}),`\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:`#CF222E`,\"--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:`)) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`continue`}),_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:`#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`,_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:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ===`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '[DONE]'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},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`}),`\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:` parsed`}),_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:`data`}),_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:`parsed`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`type`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ===`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'response.debug'`}),_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:`#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:`Debug:'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--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:`stringify`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`parsed`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`debug`}),_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:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`2`}),_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:`25`,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:`25`,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:` requests`})]}),`\n`,_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`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\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.post(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  url`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"https://openrouter.ai/api/v1/responses\"`}),_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:`  headers`}),_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:`    \"Authorization\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Bearer \u003cOPENROUTER_API_KEY\u003e\"`}),_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\":`#D4D4D4`},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:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  data`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`json.dumps({`})]}),`\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:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"anthropic/claude-haiku-4.5\"`}),_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:`    \"stream\"`}),_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:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`    \"input\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Hello!\"`}),_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:`    \"debug\"`}),_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:`      \"echo_upstream_body\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_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`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`  stream`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_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`}),`\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:` line `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`in`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` response.iter_lines():`})]}),`\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:` line:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    text `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` line.decode(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'utf-8'`}),_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:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'response.debug'`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` in`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` text:`})]}),`\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:`(text)`})]}),`\n`]})})})]}),`\n`,_jsx(Heading,{level:`3`,id:`debug-response-format`,children:`Debug response format`}),`\n`,_jsx(Heading,{level:`4`,id:`chat-completions-2`,children:`Chat Completions`}),`\n`,_jsxs(_components.p,{children:[`When `,_jsx(_components.code,{children:`debug.echo_upstream_body`}),` is set to `,_jsx(_components.code,{children:`true`}),`, OpenRouter sends a debug chunk as the `,_jsx(_components.strong,{children:`first chunk`}),` in the streaming response. This chunk has an empty `,_jsx(_components.code,{children:`choices`}),` array and includes a `,_jsx(_components.code,{children:`debug`}),` field with the transformed request body:`]}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,expandable:`true`,numberOfLines:`22`,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:`22`,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:`  \"id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"gen-xxxxx\"`}),_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:`  \"provider\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Anthropic\"`}),_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-haiku-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:`  \"object\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"chat.completion.chunk\"`}),_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:`  \"created\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1234567890`}),_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:`  \"choices\"`}),_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:`  \"debug\"`}),_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:`    \"echo_upstream_body\"`}),_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:`      \"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\":`#D4D4D4`},children:`        { `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"text\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"text\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"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:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"messages\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},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:`, `}),_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:`\"Hello!\"`}),_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:`      \"model\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"claude-haiku-4-5-20251001\"`}),_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:`      \"stream\"`}),_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:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"max_tokens\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`64000`}),_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:`      \"temperature\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`})]}),`\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:`4`,id:`responses-api-2`,children:`Responses API`}),`\n`,_jsxs(_components.p,{children:[`On the Responses API, debug data arrives as a `,_jsx(_components.code,{children:`response.debug`}),` SSE event:`]}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`15`,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:`15`,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:`  \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"response.debug\"`}),_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:`  \"debug\"`}),_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:`    \"echo_upstream_body\"`}),_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:`\"claude-haiku-4-5-20251001\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"messages\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},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:`, `}),_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:`\"Hello!\"`}),_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:`      \"stream\"`}),_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:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`      \"max_tokens\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`64000`}),_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:`      \"temperature\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`})]}),`\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:`  \"sequence_number\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`important-notes`,children:`Important notes`}),`\n`,_jsxs(Warning,{children:[_jsx(_components.p,{children:_jsx(_components.strong,{children:`Streaming Only`})}),_jsxs(_components.p,{children:[`The debug option `,_jsx(_components.strong,{children:`only works with streaming mode`}),` (`,_jsx(_components.code,{children:`stream: true`}),`). Non-streaming requests will ignore the debug parameter.`]})]}),`\n`,_jsxs(Warning,{children:[_jsx(_components.p,{children:_jsx(_components.strong,{children:`Not for Production`})}),_jsxs(_components.p,{children:[`The debug flag should `,_jsx(_components.strong,{children:`not be used in production environments`}),`. It is intended for development and debugging purposes only, as it may potentially return sensitive information included in the request that was not intended to be visible elsewhere.`]})]}),`\n`,_jsx(Heading,{level:`3`,id:`use-cases`,children:`Use cases`}),`\n`,_jsx(_components.p,{children:`The debug output is particularly useful for:`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Understanding Parameter Transformations`}),`: See how OpenRouter maps your parameters to provider-specific formats (e.g., how `,_jsx(_components.code,{children:`max_tokens`}),` is set, how `,_jsx(_components.code,{children:`temperature`}),` is handled).`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Verifying Message Formatting`}),`: Check how OpenRouter combines and formats your messages for different providers (e.g., how system messages are concatenated, how user messages are merged).`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Checking Applied Defaults`}),`: See what default values OpenRouter applies when parameters are not specified in your request.`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Debugging Provider Fallbacks`}),`: When using provider fallbacks, a debug chunk will be sent for `,_jsx(_components.strong,{children:`each attempted provider`}),`, allowing you to see which providers were tried and what parameters were sent to each.`]}),`\n`]}),`\n`]}),`\n`,_jsx(Heading,{level:`3`,id:`privacy-and-redaction`,children:`Privacy and redaction`}),`\n`,_jsx(_components.p,{children:`OpenRouter will make a best effort to automatically redact potentially sensitive or noisy data from debug output. Remember that the debug option is not intended for production.`})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{HTTPStatus,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,"54:[\"$\",\"$L57\",null,{\"slug\":\"api_reference/errors-and-debugging\",\"pageMetadata\":\"$48:props:pageMetadata\",\"theme\":\"mint\",\"children\":[\"$\",\"$L58\",null,{\"mdxSource\":{\"compiledSource\":\"$59\",\"frontmatter\":{},\"scope\":{\"config\":{},\"pageMetadata\":{\"title\":\"Errors and Debugging\",\"description\":\"API Errors and Debugging\",\"seoTitle\":\"API Error Handling and Debugging | OpenRouter Documentation\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"API Error Handling and Debugging - Complete Guide\",\"og:description\":\"Learn how to handle errors and debug requests in OpenRouter API interactions. Comprehensive guide to error codes, messages, debugging options, and best practices.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=API%20Error%20Handling%20and%20Debugging\u0026description=Learn%20how%20to%20handle%20errors%20and%20debug%20requests%20in%20OpenRouter%20API%20interactions.\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"triangle-exclamation\",\"href\":\"/api_reference/errors-and-debugging\"}}},\"mdxSourceWithNoJs\":{\"compiledSource\":\"$5a\",\"frontmatter\":{},\"scope\":{\"config\":{},\"pageMetadata\":{\"title\":\"Errors and Debugging\",\"description\":\"API Errors and Debugging\",\"seoTitle\":\"API Error Handling and Debugging | OpenRouter Documentation\",\"og:site_name\":\"OpenRouter Documentation\",\"og:title\":\"API Error Handling and Debugging - Complete Guide\",\"og:description\":\"Learn how to handle errors and debug requests in OpenRouter API interactions. Comprehensive guide to error codes, messages, debugging options, and best practices.\",\"og:image\":\"https://openrouter.ai/dynamic-og?title=API%20Error%20Handling%20and%20Debugging\u0026description=Learn%20how%20to%20handle%20errors%20and%20debug%20requests%20in%20OpenRouter%20API%20interactions.\",\"og:image:width\":1200,\"og:image:height\":630,\"twitter:card\":\"summary_large_image\",\"twitter:site\":\"@OpenRouter\",\"noindex\":false,\"nofollow\":false,\"icon\":\"triangle-exclamation\",\"href\":\"/api_reference/errors-and-debugging\"}}},\"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:'a2e96503abc957d5',t:'MTc4NzMxMjc1OA=='};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>