PageSourceSearch

https://docs.qlaud.ai/guides/build-a-chat-app

html qlaud.ai collected 2026-10-05 16:56:32 UTC 681,588 bytes, 637 lines download raw bytes

1<!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="/mintlify-assets/_next/static/media/83afe278b6a6bb3c.p.3a6ba036.woff2" as="font" crossorigin="" type="font/woff2"/><link rel="preload" href="/mintlify-assets/_next/static/media/PaperMono_Variable.p.aa32f7a0.woff2" as="font" crossorigin="" type="font/woff2"/><link rel="preload" href="/mintlify-assets/_next/static/media/f67ad414ed34149c.p.84166d94.woff2" as="font" crossorigin="" type="font/woff2"/><link rel="preload" as="image" href="https://mintcdn.com/qlaud-866b4636/irr8qn1NjuWyoP5V/logo/light.svg?fit=max&amp;auto=format&amp;n=irr8qn1NjuWyoP5V&amp;q=85&amp;s=a357c282d60388dc78ecf8bb6365e605"/><link rel="preload" as="image" href="https://mintcdn.com/qlaud-866b4636/irr8qn1NjuWyoP5V/logo/dark.svg?fit=max&amp;auto=format&amp;n=irr8qn1NjuWyoP5V&amp;q=85&amp;s=0c7b71ef8c4dd2f2107047b2abc4a666"/><link rel="stylesheet" href="/mintlify-assets/_next/static/chunks/462bacc63bed9960.css?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP" data-precedence="next"/><link rel="stylesheet" href="/mintlify-assets/_next/static/chunks/663a923474cdb1e6.css?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP" 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="/mintlify-assets/_next/static/chunks/3fcb76f539c93820.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP"/>
1<script src="/mintlify-assets/_next/static/chunks/44795504c795ca32.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP" async=""></script>
1<script src="/mintlify-assets/_next/static/chunks/08fc2fe36d1848dc.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP" async=""></script>
1<script src="/mintlify-assets/_next/static/chunks/b730549587248be7.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP" async=""></script>
1<script src="/mintlify-assets/_next/static/chunks/b58a9209ed7b832e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP" async=""></script>
1<script src="/mintlify-assets/_next/static/chunks/turbopack-9a419d41706b051f.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP" async=""></script>
1<script src="/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP" async=""></script>
1<script src="/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP" async=""></script>
1<script src="/mintlify-assets/_next/static/chunks/8da4eea58a747cb5.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP" async=""></script>
1<script src="/mintlify-assets/_next/static/chunks/c50d793b8f34b10b.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP" async=""></script>
1<script src="/mintlify-assets/_next/static/chunks/54f6583600c307fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP" async=""></script>
1<script src="/mintlify-assets/_next/static/chunks/8d0901e40ed4b058.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP" async=""></script>
1<script src="/mintlify-assets/_next/static/chunks/343f3c7f568a2e5d.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP" async=""></script>
1<script src="/mintlify-assets/_next/static/chunks/ccee8d9b3189ccd9.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP" async=""></script>
1<script src="/mintlify-assets/_next/static/chunks/3b847e5370bd724e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP" async=""></script>
1<script src="/mintlify-assets/_next/static/chunks/4fa3ca58dfaaeff8.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP" async=""></script>
1<script src="/mintlify-assets/_next/static/chunks/468295ca52ed5c09.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP" async=""></script>
1<script src="/mintlify-assets/_next/static/chunks/3f8f2653ff1ad14e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP" async=""></script>
1<script src="/mintlify-assets/_next/static/chunks/da953b59c0c41f06.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP" async=""></script>
1<script src="/mintlify-assets/_next/static/chunks/f0ef0acaeece4a23.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP" async=""></script>
1<script src="/mintlify-assets/_next/static/chunks/7538d80a516400fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP" async=""></script>
1<script src="/mintlify-assets/_next/static/chunks/8a19ec8c194a3b47.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP" async=""></script>
1<script src="/mintlify-assets/_next/static/chunks/589b24301b3a37b4.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP" async=""></script>
1<script src="/mintlify-assets/_next/static/chunks/d2fedac44d815262.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP" async=""></script>
1<script src="/mintlify-assets/_next/static/chunks/c3a3ab2374198660.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP" async=""></script>
1<script src="/mintlify-assets/_next/static/chunks/de5d31edef447a03.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP" async=""></script>
1<script src="/mintlify-assets/_next/static/chunks/6fb38247c19b3981.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP" async=""></script>
1<script src="/mintlify-assets/_next/static/chunks/8176871b020d7070.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP" async=""></script>
1<script src="/mintlify-assets/_next/static/chunks/c8150bdcfb731039.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP" async=""></script>
1<script src="/mintlify-assets/_next/static/chunks/8972ae3ec1dd1025.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP" async=""></script>
1<script src="/mintlify-assets/_next/static/chunks/9db9880c49eded60.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP" async=""></script>
1<script src="/mintlify-assets/_next/static/chunks/41c8239ff6030cd1.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP" async=""></script>
1<script src="/mintlify-assets/_next/static/chunks/e452a5c043e34035.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP" async=""></script>
1<script src="/mintlify-assets/_next/static/chunks/fde44643dbef1bcd.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP" async=""></script>
1<script src="/mintlify-assets/_next/static/chunks/c58283ba69dd38df.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP" async=""></script>
1<script src="/mintlify-assets/_next/static/chunks/e5dcdb55f621f74a.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP" async=""></script>
1<script src="/mintlify-assets/_next/static/chunks/1a0bf1d33a977db0.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP" async=""></script>
1<script src="/mintlify-assets/_next/static/chunks/6cb3e8b7f002b825.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP" async=""></script>
1<title>Build a chat app on qlaud - qlaud</title><meta name="description" content="End-to-end tutorial: per-user threads, tool integration, semantic search, streaming UX, and per-end-user billing — no Postgres, no vector DB, no message store of your own."/><meta name="application-name" content="qlaud"/><meta name="generator" content="Mintlify"/><meta name="msapplication-config" content="/mintlify-assets/_mintlify/favicons/qlaud-866b4636/WhlyAxxbPJFJDpk8/_generated/favicon/browserconfig.xml"/><meta name="apple-mobile-web-app-title" content="qlaud"/><meta name="msapplication-TileColor" content="#dc2626"/><link rel="canonical" href="https://docs.qlaud.ai/guides/build-a-chat-app"/><link rel="alternate" type="application/xml" href="/sitemap.xml"/><link rel="alternate" type="text/markdown" href="/guides/build-a-chat-app.md"/><meta property="og:title" content="Build a chat app on qlaud - qlaud"/><meta property="og:description" content="End-to-end tutorial: per-user threads, tool integration, semantic search, streaming UX, and per-end-user billing — no Postgres, no vector DB, no message store of your own."/><meta property="og:url" content="https://docs.qlaud.ai/guides/build-a-chat-app"/><meta property="og:site_name" content="qlaud"/><meta property="og:image" content="https://qlaud-866b4636.mintlify.app/mintlify-assets/_next/image?url=%2F_mintlify%2Fapi%2Fog%3Fdivision%3DTutorials%26title%3DBuild%2Ba%2Bchat%2Bapp%2Bon%2Bqlaud%26description%3DEnd-to-end%2Btutorial%253A%2Bper-user%2Bthreads%252C%2Btool%2Bintegration%252C%2Bsemantic%2Bsearch%252C%2Bstreaming%2BUX%252C%2Band%2Bper-end-user%2Bbilling%2B%25E2%2580%2594%2Bno%2BPostgres%252C%2Bno%2Bvector%2BDB%252C%2Bno%2Bmessage%2Bstore%2Bo%26theme%3Da40b06849626ca03336317c0&amp;w=1200&amp;q=100"/><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="Build a chat app on qlaud - qlaud"/><meta name="twitter:description" content="End-to-end tutorial: per-user threads, tool integration, semantic search, streaming UX, and per-end-user billing — no Postgres, no vector DB, no message store of your own."/><meta name="twitter:image" content="https://qlaud-866b4636.mintlify.app/mintlify-assets/_next/image?url=%2F_mintlify%2Fapi%2Fog%3Fdivision%3DTutorials%26title%3DBuild%2Ba%2Bchat%2Bapp%2Bon%2Bqlaud%26description%3DEnd-to-end%2Btutorial%253A%2Bper-user%2Bthreads%252C%2Btool%2Bintegration%252C%2Bsemantic%2Bsearch%252C%2Bstreaming%2BUX%252C%2Band%2Bper-end-user%2Bbilling%2B%25E2%2580%2594%2Bno%2BPostgres%252C%2Bno%2Bvector%2BDB%252C%2Bno%2Bmessage%2Bstore%2Bo%26theme%3Da40b06849626ca03336317c0&amp;w=1200&amp;q=100"/><meta name="twitter:image:width" content="1200"/><meta name="twitter:image:height" content="630"/><link rel="icon" href="/mintlify-assets/_mintlify/favicons/qlaud-866b4636/WhlyAxxbPJFJDpk8/_generated/favicon/android-chrome-192x192.png" type="image/png" sizes="192x192" media="(prefers-color-scheme: light)"/><link rel="apple-touch-icon" href="/mintlify-assets/_mintlify/favicons/qlaud-866b4636/WhlyAxxbPJFJDpk8/_generated/favicon/apple-touch-icon.png" type="image/png" sizes="180x180"/><link rel="icon" href="/mintlify-assets/_mintlify/favicons/qlaud-866b4636/WhlyAxxbPJFJDpk8/_generated/favicon/favicon-16x16.png" type="image/png" sizes="16x16" media="(prefers-color-scheme: light)"/><link rel="icon" href="/mintlify-assets/_mintlify/favicons/qlaud-866b4636/WhlyAxxbPJFJDpk8/_generated/favicon/favicon-32x32.png" type="image/png" sizes="32x32" media="(prefers-color-scheme: light)"/><link rel="shortcut icon" href="/mintlify-assets/_mintlify/favicons/qlaud-866b4636/WhlyAxxbPJFJDpk8/_generated/favicon/favicon.ico" type="image/x-icon" media="(prefers-color-scheme: light)"/><link rel="icon" href="/mintlify-assets/_mintlify/favicons/qlaud-866b4636/WhlyAxxbPJFJDpk8/_generated/favicon-dark/android-chrome-192x192.png" type="image/png" sizes="192x192" media="(prefers-color-scheme: dark)"/><link rel="icon" href="/mintlify-assets/_mintlify/favicons/qlaud-866b4636/WhlyAxxbPJFJDpk8/_generated/favicon-dark/favicon-16x16.png" type="image/png" sizes="16x16" media="(prefers-color-scheme: dark)"/><link rel="icon" href="/mintlify-assets/_mintlify/favicons/qlaud-866b4636/WhlyAxxbPJFJDpk8/_generated/favicon-dark/favicon-32x32.png" type="image/png" sizes="32x32" media="(prefers-color-scheme: dark)"/><link rel="shortcut icon" href="/mintlify-assets/_mintlify/favicons/qlaud-866b4636/WhlyAxxbPJFJDpk8/_generated/favicon-dark/favicon.ico" type="image/x-icon" media="(prefers-color-scheme: dark)"/><link rel="preload" href="https://d4tuoctqmanu0.cloudfront.net/katex.min.css" as="style"/>
1<script type="text/javascript">!function(){var b="";
2function a(p){if(p==null)return"/";p=""+p;if(""===p)return"/";return"/"===p.charAt(0)?p:"/"+p}
3function u(p){if(p==null)return p;p=""+p;if(!p||p.charAt(p.length-1)==="/")return p.slice(0,-1);return p}
4function 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}
5var p=(location.pathname||"").split("?")[0].split("#")[0]||"";
6if(b)if(p===b)p="";else if(0===p.indexOf(b+"/"))p=p.substring(b.length);
7p=a(p);p=u(p);p=i(p);p=""===p||"index"===p?"/":a(p);
8document.documentElement.setAttribute("data-current-path",p);
9}();</script>
9<script type="text/javascript">(() => {
10  const isIOS =
11    /iP(hone|ad|od)/.test(navigator.userAgent) ||
12    (/Macintosh/.test(navigator.userAgent) && navigator.maxTouchPoints > 1);
13  if (!isIOS) return;
14  const apply = () => {
15    for (const meta of document.querySelectorAll('meta[name="viewport"]')) {
16      const content = meta.getAttribute('content') || '';
17      if (!content.includes('maximum-scale')) {
18        meta.setAttribute('content', content + ', maximum-scale=1');
19      }
20    }
21  };
22  apply();
23  new MutationObserver(apply).observe(document.head, {
24    childList: true,
25    subtree: true,
26    attributes: true,
27    attributeFilter: ['content'],
28  });
29})();</script>
29<script type="text/javascript">!function(){
30function read(){try{
31var e=performance.getEntriesByType?performance.getEntriesByType("navigation"):[];
32var st=(e[0]&&e[0].serverTiming)||[];
33var g={};
34for(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){}
35if(n==="country")g.country=d;else if(n==="region")g.region=d;else if(n==="continent")g.continent=d;}
36var w=window;w.mintlify=w.mintlify||{};w.mintlify.geo=g;
37}catch(x){}}
38read();document.addEventListener("DOMContentLoaded",read);
39}();</script>
39<script type="text/javascript">!function(){try{
40var w=window;w.mintlify=w.mintlify||{};
41var q=w.mintlify.__apiPlaygroundInputsQueue;
42if(!Array.isArray(q)){q=[];w.mintlify.__apiPlaygroundInputsQueue=q;}
43w.mintlify.api=w.mintlify.api||{};
44w.mintlify.api.playground=w.mintlify.api.playground||{};
45if(typeof w.mintlify.api.playground.setServerVariables!=="function"){
46w.mintlify.api.playground.setServerVariables=function(v){q.push({type:"set",variables:v});};
47}
48if(typeof w.mintlify.api.playground.clearServerVariables!=="function"){
49w.mintlify.api.playground.clearServerVariables=function(){q.push({type:"clear"});};
50}
51}catch(e){}}();</script>
51<script type="text/javascript">(function(){
52if(typeof CSS==="undefined"||!("registerProperty" in CSS))return;
53if(CSS.supports&&CSS.supports("-webkit-backdrop-filter:none"))return;
54var n=["--scroll-area-overflow-x-start","--scroll-area-overflow-x-end","--scroll-area-overflow-y-start","--scroll-area-overflow-y-end"];
55var d={"syntax":"<length>","inherits":false,"initialValue":"0px"};
56for(var i=0;i<n.length;i++){try{CSS.registerProperty({name:n[i],syntax:d.syntax,inherits:d.inherits,initialValue:d.initialValue})}catch(e){}}
57})();</script>
57<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")}})(
58  "bannerDismissed",
59  "data-banner-state",
60)</script>
60<script src="/mintlify-assets/_next/static/chunks/a6dad97d9634a72d.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP" noModule=""></script>
60</head><body class="antialiased"><div hidden=""><!--$--><!--/$--></div>
60<script type="application/ld+json">{"@context":"https://schema.org","@type":"WebSite","name":"qlaud","creator":{"@type":"Organization","name":"Mintlify","url":"https://mintlify.com"}}</script>
60<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","system",null,["dark","light","true","false","system"],{"true":"dark","false":"light","dark":"dark","light":"light"},true,false)</script>
60<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="system";document.documentElement.setAttribute("data-theme-preference",v)}catch(e){}})();</script>
60<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="/llms.txt" tabindex="-1">/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>
60<script id="_mintlify-banner-script">(function i(a,b,c,d,e){try{let f,g,h=[];try{h=window.location.pathname.split("/").filter(a=>""!==a&&"global"!==a).slice(0,2)}catch{h=[]}let i=h.find(a=>c.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<localStorage.length;){let a=localStorage.key(l);if(l++,!a?.endsWith(e))continue;let b=localStorage.getItem(a);if(b&&b===f){k=!1;break}g&&(a.startsWith(`lang:${g}_`)||!a.startsWith("lang:"))&&(localStorage.removeItem(a),l--)}document.documentElement.setAttribute(d,k?"visible":"hidden")}catch(a){console.error(a),document.documentElement.setAttribute(d,"hidden")}})(
61  {},
62  "en",
63  [],
64  "data-banner-state",
65  "bannerDismissed",
66)</script>
66<style>:root {
67    --primary: 220 38 38;
68    --primary-light: 239 68 68;
69    --primary-dark: 185 28 28;
70    --tooltip-foreground: 255 255 255;
71    --background-light: 255 255 255;
72    --background-dark: 14 10 12;
73    --gray-50: 249 244 244;
74    --gray-100: 244 239 239;
75    --gray-200: 229 223 223;
76    --gray-300: 212 207 207;
77    --gray-400: 165 159 159;
78    --gray-500: 118 113 113;
79    --gray-600: 86 81 81;
80    --gray-700: 69 63 63;
81    --gray-800: 44 38 38;
82    --gray-900: 29 23 23;
83    --gray-950: 16 11 11;
84  }</style>
84<script type="text/javascript">
85          (function() {
86            function loadKatex() {
87              const link = document.querySelector('link[href="https://d4tuoctqmanu0.cloudfront.net/katex.min.css"]');
88              if (link) link.rel = 'stylesheet';
89            }
90            if (document.readyState === 'loading') {
91              document.addEventListener('DOMContentLoaded', loadKatex);
92            } else {
93              loadKatex();
94            }
95          })();
96        </script>
96<div class="relative antialiased text-gray-500 dark:text-gray-400">
96<script id="_mintlify-navbar-transition-script">(function(a){let b,c=(b="navbar-transition","maple"===a&&(b+="-maple"),b);function d(){let a=!1;a=window.scrollY>50;let b=document.getElementById(c);b&&b.hasAttribute("data-is-opaque")&&b.setAttribute("data-is-opaque",`${!!a}`)}let e=function(){let a=document.createElement("style"),b=`#${c}`;return a.appendChild(document.createTextNode(`${b},${b} *,${b} *::before,${b} *::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(()=>{document.head.removeChild(a)},1)}}();function f(){window.removeEventListener("scroll",d),document.removeEventListener("DOMContentLoaded",d),d(),e()}window.addEventListener("scroll",d,{passive:!0}),document.addEventListener("DOMContentLoaded",d),("requestAnimationFrame"in globalThis?requestAnimationFrame:setTimeout)(d),"complete"===document.readyState?f():window.addEventListener("load",f,{once:!0})})("mint")</script>
96<script id="_mintlify-scroll-margin-script">(function () {
97  var measure = function(){let a=document.querySelectorAll("[id='navbar'], [data-top-chrome]"),b=0;a.forEach(a=>{let c=a.getBoundingClientRect();c.height>0&&(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)&&(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&&f.setProperty("--scroll-mt",e)};
98  (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)=>a!==b[c]))&&d&&(d.disconnect(),c.forEach(a=>d.observe(a))),b=c,a()}function f(){c||(c=requestAnimationFrame(()=>{c=0,e()}))}let g="[id='navbar'], [data-top-chrome]";function h(a){let b=a.target;if(b instanceof Element&&b.closest(g))return!0;for(let b of a.addedNodes)if(b instanceof Element&&(b.matches(g)||b.querySelector(g)))return!0;for(let b of a.removedNodes)if(b instanceof Element&&(b.matches(g)||b.querySelector(g)))return!0;return!1}new MutationObserver(a=>{a.some(h)&&f()}).observe(document.documentElement,{childList:!0,subtree:!0}),window.addEventListener("resize",f),"loading"===document.readyState&&document.addEventListener("DOMContentLoaded",e),e()})(measure);
99  (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&&(a(),d.scrollIntoView(c?{behavior:c}:void 0),!0)}if("complete"===document.readyState)return void d();let e=new MutationObserver(()=>{!c()&&d("instant")&&f()});function f(){e.disconnect(),window.removeEventListener("load",g)}function g(){let a=c();f(),a&&requestAnimationFrame(()=>{d(),function(){let a=["wheel","touchstart","keydown","pointerdown"],c=0,e=window.scrollY,f=setInterval(()=>{c+=1;let a=document.getElementById(b);if(!a||c>=6)return g();let f=Math.abs(window.scrollY-e)>1;if(e=window.scrollY,f)return;let h=parseFloat(getComputedStyle(a).scrollMarginTop)||0;Math.abs(a.getBoundingClientRect().top-h)>4&&d()},350);function g(){clearInterval(f),a.forEach(a=>window.removeEventListener(a,g))}a.forEach(a=>window.addEventListener(a,g,{passive:!0}))}()})}window.addEventListener("load",g),e.observe(document.documentElement,{childList:!0,subtree:!0}),!c()&&d("instant")&&f()})(measure);
100})();</script>
100<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>
100<script>(function e(a,b,c,d,e){try{let f=window.matchMedia("(max-width: 1024px)").matches;if(e){document.documentElement.style.setProperty(c,"0px"),document.documentElement.setAttribute("data-assistant-state","closed");return}if(f||!d){document.documentElement.style.setProperty(c,"0px"),document.documentElement.setAttribute("data-assistant-state","closed"),d||localStorage.setItem(a,"false");return}let g=localStorage.getItem(a);if(null===g){document.documentElement.style.setProperty(c,"0px"),document.documentElement.setAttribute("data-assistant-state","closed");return}let h=JSON.parse(g),i=localStorage.getItem(b),j=null!==i?JSON.parse(i):368;document.documentElement.style.setProperty(c,h?j+"px":"0px"),document.documentElement.setAttribute("data-assistant-state",h?"open":"closed")}catch(a){document.documentElement.style.setProperty(c,"0px"),document.documentElement.setAttribute("data-assistant-state","closed")}})(
101    "chat-assistant-sheet-open",
102    "chat-assistant-sheet-width",
103    "--assistant-sheet-width",
104    false,
105    false
106  )</script>
106<style>html{--assistant-sheet-width:0px!important}</style><div class="max-lg:contents lg:flex lg:w-full" data-docs-theme="mint" data-assistant-layout="legacy"><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="/"><span class="sr-only">qlaud<!-- --> home page</span><img class="nav-logo w-auto h-7 relative object-contain shrink-0 block dark:hidden" src="https://mintcdn.com/qlaud-866b4636/irr8qn1NjuWyoP5V/logo/light.svg?fit=max&amp;auto=format&amp;n=irr8qn1NjuWyoP5V&amp;q=85&amp;s=a357c282d60388dc78ecf8bb6365e605" alt="light logo"/><img class="nav-logo w-auto h-7 relative object-contain shrink-0 hidden dark:block" src="https://mintcdn.com/qlaud-866b4636/irr8qn1NjuWyoP5V/logo/dark.svg?fit=max&amp;auto=format&amp;n=irr8qn1NjuWyoP5V&amp;q=85&amp;s=0c7b71ef8c4dd2f2107047b2abc4a666" 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 justify-center"><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></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://qlaud.ai/dashboard" 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">Dashboard</span></a></li><li class="block lg:hidden"><a 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" href="https://qlaud.ai/sign-up"><span class="min-w-0 truncate">Get an API key</span></a></li><li class="whitespace-nowrap hidden lg:flex" id="topbar-cta-button"><a target="_blank" rel="noopener noreferrer" class="group pl-3 pr-2 py-2 relative inline-flex items-center text-sm font-medium" href="https://qlaud.ai/sign-up"><span class="absolute inset-0 bg-primary-dark rounded-xl group-hover:opacity-[0.9]"></span><div class="z-10 gap-1 flex items-center"><span class="text-white">Get an API key</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 shrink-0 text-white/90"><path d="M6.5 2.75L12.75 9L6.5 15.25" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></div></a></li></ul></nav><div class="flex items-center"><button type="button" tabindex="0" aria-haspopup="menu" aria-expanded="false" 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>
106<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 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>Tutorials</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">Build a chat app on qlaud</div></div></button></div><div class="hidden lg:flex px-12 h-12"><div class="nav-tabs h-full flex text-sm gap-x-6"><a class="link nav-tabs-item group relative h-full gap-2 flex items-center font-medium hover:text-gray-800 dark:hover:text-gray-300 text-gray-800 dark:text-gray-200 [text-shadow:-0.2px_0_0_currentColor,0.2px_0_0_currentColor]" data-active="true" aria-current="location" href="/introduction">Guides<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="/api-reference/messages">API Reference<div class="absolute bottom-0 h-[1.5px] w-full left-0 group-hover:bg-gray-200 dark:group-hover:bg-gray-700"></div></a></div></div><style>:root{--topbar-tabs-height:3rem}</style></div></div></header>
106<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-(--sidebar-width,18rem) top-[calc(var(--mintlify-slot-header-height,calc(4rem+var(--topbar-tabs-height,0rem)))+var(--banner-height,0px))] h-[calc(100dvh-var(--mintlify-slot-header-height,calc(4rem+var(--topbar-tabs-height,0rem)))-var(--banner-height,0px))]" 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_5qnpfb39p7b9snpfiutb_-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"><h3 class="sidebar-title text-[length:inherit] font-[inherit] leading-[inherit]"><span>Get started</span></h3></div><ul class="sidebar-group space-y-px"><li id="/introduction" class="relative scroll-m-4 first:scroll-m-20" data-title="What is qlaud?"><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="/introduction"><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">What is qlaud?</span></div></div></a></li><li id="/quickstart" class="relative scroll-m-4 first:scroll-m-20" data-title="Quickstart"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 break-words hyphens-auto rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/quickstart"><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">Quickstart</span></div></div></a></li><li id="/per-user-billing" class="relative scroll-m-4 first:scroll-m-20" data-title="Per-user billing"><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="/per-user-billing"><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">Per-user billing</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"><h3 class="sidebar-title text-[length:inherit] font-[inherit] leading-[inherit]"><span>Tutorials</span></h3></div><ul class="sidebar-group space-y-px"><li id="/guides/build-a-chat-app" class="relative scroll-m-4 first:scroll-m
106-20" data-title="Build a chat app on qlaud" 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="/guides/build-a-chat-app"><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">Build a chat app on qlaud</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"><h3 class="sidebar-title text-[length:inherit] font-[inherit] leading-[inherit]"><span>Concepts</span></h3></div><ul class="sidebar-group space-y-px"><li id="/concepts/api-surfaces" class="relative scroll-m-4 first:scroll-m-20" data-title="Choosing your API surface"><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="/concepts/api-surfaces"><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">Choosing your API surface</span></div></div></a></li><li id="/concepts/keys-and-scopes" class="relative scroll-m-4 first:scroll-m-20" data-title="Keys &amp; scopes"><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="/concepts/keys-and-scopes"><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">Keys &amp; scopes</span></div></div></a></li><li id="/concepts/wallet-and-caps" class="relative scroll-m-4 first:scroll-m-20" data-title="Wallet &amp; spending caps"><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="/concepts/wallet-and-caps"><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">Wallet &amp; spending caps</span></div></div></a></li><li id="/concepts/usage-and-billing" class="relative scroll-m-4 first:scroll-m-20" data-title="Usage &amp; invoicing"><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="/concepts/usage-and-billing"><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">Usage &amp; invoicing</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"><h3 class="sidebar-title text-[length:inherit] font-[inherit] leading-[inherit]"><span>Integrations</span></h3></div><ul class="sidebar-group space-y-px"><li id="/integrations/claude-code" class="relative scroll-m-4 first:scroll-m
106-20" data-title="Claude Code"><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="/integrations/claude-code"><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">Claude Code</span></div></div></a></li><li id="/integrations/openai-sdk" class="relative scroll-m-4 first:scroll-m-20" data-title="OpenAI SDK"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/integrations/openai-sdk"><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">OpenAI SDK</span></div></div></a></li><li id="/integrations/anthropic-sdk" class="relative scroll-m-4 first:scroll-m-20" data-title="Anthropic SDK"><a class="group flex items-start pr-3 py-1.5 cursor-pointer gap-x-3 text-left focus-visible:-outline-offset-2 rounded-xl w-full outline-offset-[-1px] hover:bg-gray-600/5 dark:hover:bg-gray-200/5 text-gray-700 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-300" style="padding-left:1rem" href="/integrations/anthropic-sdk"><div class="flex-1 flex min-w-0 items-start gap-x-2.5"><div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5 [word-break:break-word]"><span class="min-w-0 max-w-full break-words hyphens-auto">Anthropic SDK</span></div></div></a></li></ul></div>
106<script>(function () {
107  try {
108    if (window.__mintlifyInitialSidebarScrollDone) return;
109    window.__mintlifyInitialSidebarScrollDone = true;
110
111    var path = (window.location.pathname || '/').split('#')[0].split('?')[0];
112    if (path.endsWith('/index')) path = path.slice(0, -6);
113    else if (path === 'index') path = '';
114
115    var candidates = [];
116    if (path) candidates.push(path);
117    if (path.startsWith('/')) candidates.push(path.slice(1));
118    else candidates.push('/' + path);
119
120    var item = null;
121    for (var i = 0; i < candidates.length && !item; i++) {
122      var matches = document.querySelectorAll('[id="' + candidates[i].replace(/"/g, '\\"') + '"]');
123      for (var j = 0; j < matches.length; j++) {
124        if (matches[j].closest('#sidebar, #sidebar-content')) {
125          item = matches[j];
126          break;
127        }
128      }
129    }
130    if (!item) return;
131
132    var parent = item.closest('[data-component-part="scroll-area-viewport"]');
133    if (!parent) {
134      parent = item.parentElement;
135      while (parent) {
136        var style = getComputedStyle(parent);
137        if (style.overflowY === 'auto' || style.overflowY === 'scroll') break;
138        parent = parent.parentElement;
139      }
140    }
141    if (!parent) return;
142
143    var parentRect = parent.getBoundingClientRect();
144    var itemRect = item.getBoundingClientRect();
145    if (itemRect.top >= parentRect.top && itemRect.bottom <= parentRect.bottom) return;
146
147    var itemTopRelative = itemRect.top - parentRect.top + parent.scrollTop;
148    parent.scrollTop = itemTopRelative - parentRect.height / 2 + itemRect.height / 2;
149  } catch (e) {}
150})();</script>
150</div></div></div></div></div></nav><main id="content-container" class="lg:flex-1 lg:min-w-0">
150<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://docs.qlaud.ai/#organization","name":"qlaud","url":"https://docs.qlaud.ai","logo":{"@type":"ImageObject","url":"https://mintcdn.com/qlaud-866b4636/irr8qn1NjuWyoP5V/logo/light.svg?fit=max&auto=format&n=irr8qn1NjuWyoP5V&q=85&s=a357c282d60388dc78ecf8bb6365e605"}},{"@type":"WebSite","@id":"https://docs.qlaud.ai#website","name":"qlaud","url":"https://docs.qlaud.ai","publisher":{"@id":"https://docs.qlaud.ai/#organization"}},{"@type":"WebPage","@id":"https://docs.qlaud.ai/guides/build-a-chat-app#webpage","url":"https://docs.qlaud.ai/guides/build-a-chat-app","name":"Build a chat app on qlaud","description":"End-to-end tutorial: per-user threads, tool integration, semantic search, streaming UX, and per-end-user billing — no Postgres, no vector DB, no message store of your own.","dateModified":"2026-04-27T07:56:40.974Z","isPartOf":{"@id":"https://docs.qlaud.ai#website"},"breadcrumb":{"@id":"https://docs.qlaud.ai/guides/build-a-chat-app#breadcrumb"}},{"@type":"BreadcrumbList","@id":"https://docs.qlaud.ai/guides/build-a-chat-app#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"qlaud","item":"https://docs.qlaud.ai"},{"@type":"ListItem","position":2,"name":"Build a chat app on qlaud","item":"https://docs.qlaud.ai/guides/build-a-chat-app"}]},{"@type":["Article","TechArticle"],"@id":"https://docs.qlaud.ai/guides/build-a-chat-app#article","headline":"Build a chat app on qlaud","name":"Build a chat app on qlaud","description":"End-to-end tutorial: per-user threads, tool integration, semantic search, streaming UX, and per-end-user billing — no Postgres, no vector DB, no message store of your own.","url":"https://docs.qlaud.ai/guides/build-a-chat-app","mainEntityOfPage":{"@id":"https://docs.qlaud.ai/guides/build-a-chat-app#webpage"},"dateModified":"2026-04-27T07:56:40.974Z","publisher":{"@id":"https://docs.qlaud.ai/#organization"},"isPartOf":{"@id":"https://docs.qlaud.ai#website"}}]}</script>
150<script>document.documentElement.setAttribute('data-page-mode', "none");</script>
150<span class="fixed inset-0 bg-background-light dark:bg-background-dark -z-10 pointer-events-none" id="background-color"></span><!--$--><!--/$--><div class="flex flex-row-reverse gap-12 box-border w-full pt-[calc(10rem+var(--banner-height,2.5rem))] 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] [[data-banner-state=visible]_&amp;]:h-[calc(100vh-12rem)] [[data-banner-state=visible]_&amp;]:top-[12rem]" 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_2r9qnpfb39p7b9snpfiutb_-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_r9qnpfb39p7b9snpfiutb_"><h2 id="_R_r9qnpfb39p7b9snpfiutb_" 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="#prerequisites" 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]">Prerequisites</a></li><li class="toc-item relative" data-depth="0"><a style="--toc-padding-left:0rem" href="#architecture-in-one-paragraph" 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]">Architecture in one paragraph</a></li><li class="toc-item relative" data-depth="0"><a style="--toc-padding-left:0rem" href="#step-1-%E2%80%94-on-signup-mint-a-per-user-key-%2B-thread" 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]">Step 1 — On signup, mint a per-user key + thread</a></li><li class="toc-item relative" data-depth="0"><a style="--toc-padding-left:0rem" href="#step-2-%E2%80%94-send-a-message-in-a-conversation" 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]">Step 2 — Send a message in a conversation</a></li><li class="toc-item relative" data-depth="0"><a style="--toc-padding-left:0rem" href="#step-3-%E2%80%94-stream-the-response-token-by-token-ux" 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]">
150Step 3 — Stream the response (token-by-token UX)</a></li><li class="toc-item relative" data-depth="0"><a style="--toc-padding-left:0rem" href="#step-4-%E2%80%94-add-a-tool" 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]">Step 4 — Add a tool</a><ul class=""><li class="toc-item relative" data-depth="1"><a style="--toc-padding-left:1rem" href="#register-the-tool-one-time" 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">Register the tool (one-time)</a></li><li class="toc-item relative" data-depth="1"><a style="--toc-padding-left:1rem" href="#host-the-webhook-your-backend" 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">Host the webhook (your backend)</a></li><li class="toc-item relative" data-depth="1"><a style="--toc-padding-left:1rem" href="#use-the-tool-in-a-conversation" 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 the tool in a conversation</a></li></ul></li><li class="toc-item relative" data-depth="0"><a style="--toc-padding-left:0rem" href="#step-5-%E2%80%94-search-the-user%E2%80%99s-history" 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]">Step 5 — Search the user’s history</a></li><li class="toc-item relative" data-depth="0"><a style="--toc-padding-left:0rem" href="#step-6-%E2%80%94-bill-at-month-end" 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]">Step 6 — Bill at month-end</a></li><li class="toc-item relative" data-depth="0"><a style="--toc-padding-left:0rem" href="#what-you-didn%E2%80%99t-build" 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]">What you didn’t build</a></li><li class="toc-item relative" data-depth="0"><a style="--toc-padding-left:0rem" href="#next-steps" 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]">Next steps</a></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)] lg:max-w-[calc(var(--content-width,100vw)+5.95rem)]" data-empty-page-layout="" 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">Tutorials</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">Build a chat app on qlaud</h1></div></div><div class="mt-2 text-lg prose prose-gray dark:prose-invert [&amp;&gt;*]:[overflow-wrap:anywhere]"><p>End-to-end tutorial: per-user threads, tool integration, semantic search, streaming UX, and per-end-user billing — no Postgres, no vector DB, no message store of your own.</p></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="Build a chat app on qlaud" data-page-href="/guides/build-a-chat-app" id="content"><span data-as="p">This tutorial walks the full stack of a user-facing AI chat product on
151qlaud. By the end you’ll have a chat backend with:</span>
152<ul>
153<li><strong>Per-end-user conversations</strong> — each of your users has their own thread</li>
154<li><strong>Tool integration</strong> — the assistant calls your business logic (lookups,
155actions) via webhooks; qlaud handles the dispatch loop</li>
156<li><strong>Semantic search</strong> — your end-user can search their own conversation
157history; you don’t run a vector DB</li>
158<li><strong>Streaming UX</strong> — text appears word-by-word, like every modern chat</li>
159<li><strong>Per-user billing</strong> — hard spend caps; you bill how you want at month-end</li>
160</ul>
161<span data-as="p">What you DON’T build: Postgres tables, message store, context-window loader,
162tool-call state machine, embedding pipeline, vector store, conversation
163search, per-user cost attribution.</span>
164<span data-as="p">
164Estimated time end-to-end: <strong>~30 minutes</strong>, mostly waiting on
165<code>pip install</code> / <code>npm install</code>.</span>
166<h2 class="flex whitespace-pre-wrap group font-semibold" id="prerequisites"><div class="absolute" tabindex="-1"><a href="#prerequisites" 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.3
16611 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">Prerequisites</span></h2>
167<ul>
168<li>A qlaud account (<a href="https://qlaud.ai/sign-up" target="_blank" rel="noreferrer" class="link">sign up free, $5 starter credit</a>)</li>
169<li>Your master key from <a href="https://qlaud.ai/keys" target="_blank" rel="noreferrer" class="link">/keys</a>, exported as <code>QLAUD_MASTER_KEY</code></li>
170<li><strong>Python 3.9+</strong> (using plain <code>requests</code>) or <strong>Node 18+</strong> (using built-in
171<code>fetch</code>). No qlaud SDK required for any of this.</li>
172</ul>
173<h2 class="flex whitespace-pre-wrap group font-semibold" id="architecture-in-one-paragraph"><div class="absolute" tabindex="-1"><a href="#architecture-in-one-paragraph" 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.3
17311 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">Architecture in one paragraph</span></h2>
174<span data-as="p">Each of your end-users gets:</span>
175<ol>
176<li>A qlaud per-user API key (<code>qlk_live_…</code>) with a hard spend cap, minted on
177signup using your master key.</li>
178<li>A qlaud thread tagged with their <code>end_user_id</code>.</li>
179</ol>
180<span data-as="p">That’s it. Their messages go to qlaud; qlaud calls the model, optionally
181fires tools, persists everything, exposes search, and meters cost — all
182keyed off their thread + their per-user key. Your backend only orchestrates.</span>
183<h2 class="flex whitespace-pre-wrap group font-semibold" id="step-1-—-on-signup-mint-a-per-user-key-+-thread"><div class="absolute" tabindex="-1"><a href="#step-1-—-on-signup-mint-a-per-user-key-+-thread" 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.3
18311 16.083 14.692 14.702L14.702 14.692C16.083 13.311 16.083 11.073 14.702 9.692L13.771 8.761" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M9.50002 11.173C9.85202 11.005 10.182 10.775 10.473 10.483L10.483 10.473C11.864 9.092 11.864 6.854 10.483 5.473L8.30802 3.298C6.92702 1.917 4.68902 1.917 3.30802 3.298L3.29802 3.308C1.91702 4.689 1.91702 6.927 3.29802 8.308L4.22902 9.239" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></div></a></div><span class="cursor-pointer">Step 1 — On signup, mint a per-user key + thread</span></h2>
184<span data-as="p">Whenever a new user signs up in your app, run this once:</span>
185<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_569bb9qnpfb39p7b9snpfiutb_-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_ml69bb9qnpfb39p7b9snpfiutb_" 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">Python</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_16l69bb9qnpfb39p7b9snpfiutb_" 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">TypeScript</div></button></div></div></div></div><div class="flex items-center justify-end shrink-0 gap-1.5"><div class="code-block-copy-button z-10 select-none" id="base-ui-_R_1tp69bb9qnpfb39p7b9snpfiutb_" data-base-ui-tooltip-trigger=""><button class="size-6.5 flex items-center justify-center rounded-md group/copy-button [.code-block:not(:has([data-fade-overlay]))_[data-floating-buttons]_&amp;]:bg-gray-100 dark:[.code-block:not(:has([data-fade-overlay]))_[data-floating-buttons]_&amp;]: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 
1851.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></div><div class="flex flex-1 overflow-hidden"><div data-orientation="horizontal" data-activation-direction="none" id="base-ui-_R_669bb9qnpfb39p7b9snpfiutb_" 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: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"><div role="presentation" data-id="base-ui-_R_1m69bb9qnpfb39p7b9snpfiutb_-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="31"><span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">import</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> os, requests</span></span>
186<span class="line"></span>
187<span class="line"><span style="color:#0550AE;--shiki-dark:#D4D4D4">QLAUD</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> =</span><span style="color:#0A3069;--shiki-dark:#CE9178"> &quot;https://api.qlaud.ai&quot;</span></span>
188<span class="line"><span style="color:#0550AE;--shiki-dark:#D4D4D4">MASTER</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> =</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> os.environ[</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;QLAUD_MASTER_KEY&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">]</span></span>
189<span class="line"></span>
190<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">def</span><span style="color:#8250DF;--shiki-dark:#DCDCAA"> onboard_qlaud</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">end_user_id</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0550AE;--shiki-dark:#4EC9B0">str</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#1F2328;--shiki-dark:#9CDCFE">monthly_budget_usd</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0550AE;--shiki-dark:#4EC9B0">float</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> =</span><span style="color:#0550AE;--shiki-dark:#B5CEA8"> 5.0</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">):</span></span>
191<span class="line"><span style="color:#0A3069;--shiki-dark:#CE9178">    &quot;&quot;&quot;Provision a qlaud per-user key + an initial thread for a new user.&quot;&quot;&quot;</span></span>
192<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    headers </span><span style="color:#CF222E;--shiki-dark:#D4D4D4">=</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> {</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;x-api-key&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0550AE;--shiki-dark:#D4D4D4">MASTER</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><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>
193<span class="line"></span>
194<span class="line"><span style="color:#6E7781;--shiki-dark:#6A9955">    # 1. Mint a standard-scoped key with a hard cap.</span></span>
195<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">
195    key </span><span style="color:#CF222E;--shiki-dark:#D4D4D4">=</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> requests.post(</span><span style="color:#CF222E;--shiki-dark:#569CD6">f</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;</span><span style="color:#CF222E;--shiki-dark:#569CD6">{</span><span style="color:#0550AE;--shiki-dark:#D4D4D4">QLAUD</span><span style="color:#CF222E;--shiki-dark:#569CD6">}</span><span style="color:#0A3069;--shiki-dark:#CE9178">/v1/keys&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#953800;--shiki-dark:#9CDCFE">headers</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">=</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">headers, </span><span style="color:#953800;--shiki-dark:#9CDCFE">json</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">=</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">{</span></span>
196<span class="line"><span style="color:#0A3069;--shiki-dark:#CE9178">        &quot;name&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#CF222E;--shiki-dark:#569CD6">f</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;end_user_</span><span style="color:#CF222E;--shiki-dark:#569CD6">{</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">end_user_id</span><span style="color:#CF222E;--shiki-dark:#569CD6">}</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
197<span class="line"><span style="color:#0A3069;--shiki-dark:#CE9178">        &quot;scope&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;standard&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
198<span class="line"><span style="color:#0A3069;--shiki-dark:#CE9178">        &quot;max_spend_usd&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: monthly_budget_usd,</span></span>
199<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    }).json()</span></span>
200<span class="line"></span>
201<span class="line"><span style="color:#6E7781;--shiki-dark:#6A9955">    # 2. Create their first thread, tagged with your end_user_id.</span></span>
202<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    thread </span><span style="color:#CF222E;--shiki-dark:#D4D4D4">=</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> requests.post(</span><span style="color:#CF222E;--shiki-dark:#569CD6">f</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;</span><span style="color:#CF222E;--shiki-dark:#569CD6">{</span><span style="color:#0550AE;--shiki-dark:#D4D4D4">QLAUD</span><span style="color:#CF222E;--shiki-dark:#569CD6">}</span><span style="color:#0A3069;--shiki-dark:#CE9178">/v1/threads&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><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>
203<span class="line"><span style="color:#0A3069;--shiki-dark:#CE9178">        &quot;x-api-key&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: key[</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;secret&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">],</span></span>
204<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>
205<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    }, </span><span style="color:#953800;--shiki-dark:#9CDCFE">json</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">=</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">{</span></span>
206<span class="line"><span style="color:#0A3069;--shiki-dark:#CE9178">        &quot;end_user_id&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: end_user_id,</span></span>
207<span class="line"><span style="color:#0A3069;--shiki-dark:#CE9178">        &quot;metadata&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;plan&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;free&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">},</span></span>
208<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    }).json()</span></span>
209<span class="line"></span>
210<span class="line"><span style="color:#6E7781;--shiki-dark:#6A9955">    # Store both in YOUR users table.</span></span>
211<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">    return</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> {</span></span>
212<span class="line"><span style="color:#0A3069;--shiki-dark:#CE9178">        &quot;qlaud_key_id&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: key[</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;id&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">],</span></span>
213<span class="line"><span style="color:#0A3069;--shiki-dark:#CE9178">        &quot;qlaud_secret&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: key[</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;secret&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">],   </span><span style="color:#6E7781;--shiki-dark:#6A9955"># only returned once — store it</span></span>
214<span class="line"><span style="color:#0A3069;--shiki-dark:#CE9178">        &quot;qlaud_thread_id&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: thread[</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;id&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">],</span></span>
215<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    }</span></span>
216</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 data-hidden="" data-orientation="horizontal" data-activation-direction="none" hidden="" id="base-ui-_R_a69bb9qnpfb39p7b9snpfiutb_" 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"><div role="presentation" data-id="base-ui-_R_1q69bb9qnpfb39p7b9snpfiutb_-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" 
216class="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="44"><span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">const</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> QLAUD</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> =</span><span style="color:#0A3069;--shiki-dark:#CE9178"> &#x27;https://api.qlaud.ai&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">;</span></span>
217<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">const</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> MASTER</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> =</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> process</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">env</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#0550AE;--shiki-dark:#4FC1FF">QLAUD_MASTER_KEY</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">!</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">;</span></span>
218<span class="line"></span>
219<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">type</span><span style="color:#953800;--shiki-dark:#4EC9B0"> OnboardResult</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> =</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> {</span></span>
220<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">  qlaudKeyId</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>
221<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">  qlaudSecret</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>
222<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">  qlaudThreadId</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>
223<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">};</span></span>
224<span class="line"></span>
225<span class="line"><span style="color:#6E7781;--shiki-dark:#6A9955">/** Provision a qlaud per-user key + an initial thread for a new user. */</span></span>
226<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">export</span><span style="color:#CF222E;--shiki-dark:#569CD6"> async</span><span style="color:#CF222E;--shiki-dark:#569CD6"> function</span><span style="color:#8250DF;--shiki-dark:#DCDCAA"> onboardQlaud</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span></span>
227<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">  endUserId</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>
228<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">  monthlyBudgetUsd</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> =</span><span style="color:#0550AE;--shiki-dark:#B5CEA8"> 5</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
229<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">)</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">:</span><span style="color:#953800;--shiki-dark:#4EC9B0"> Promise</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">&lt;</span><span style="color:#953800;--shiki-dark:#4EC9B0">OnboardResult</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">&gt; {</span></span>
230<span class="line"><span style="color:#6E7781;--shiki-dark:#6A9955">  // 1. Mint a standard-scoped key with a hard cap.</span></span>
231<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">  const</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> keyResp</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">`</span><span style="color:#0A3069;--shiki-dark:#569CD6">${</span><span style="color:#0550AE;--shiki-dark:#4FC1FF">QLAUD</span><span style="color:#0A3069;--shiki-dark:#569CD6">}</span><span style="color:#0A3069;--shiki-dark:#CE9178">/v1/keys`</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">
231, {</span></span>
232<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>
233<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">    headers:</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> { </span><span style="color:#0A3069;--shiki-dark:#CE9178">&#x27;x-api-key&#x27;</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">:</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> MASTER</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#0A3069;--shiki-dark:#CE9178">&#x27;content-type&#x27;</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">:</span><span style="color:#0A3069;--shiki-dark:#CE9178"> &#x27;application/json&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> },</span></span>
234<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>
235<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">      name:</span><span style="color:#0A3069;--shiki-dark:#CE9178"> `end_user_</span><span style="color:#0A3069;--shiki-dark:#569CD6">${</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">endUserId</span><span style="color:#0A3069;--shiki-dark:#569CD6">}</span><span style="color:#0A3069;--shiki-dark:#CE9178">`</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
236<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">      scope:</span><span style="color:#0A3069;--shiki-dark:#CE9178"> &#x27;standard&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
237<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">      max_spend_usd:</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> monthlyBudgetUsd</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
238<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    }),</span></span>
239<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">  });</span></span>
240<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">  const</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> key</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> =</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> (</span><span style="color:#CF222E;--shiki-dark:#C586C0">await</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> keyResp</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 style="color:#CF222E;--shiki-dark:#C586C0">as</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> { </span><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 style="color:#953800;--shiki-dark:#9CDCFE">secret</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>
241<span class="line"></span>
242<span class="line"><span style="color:#6E7781;--shiki-dark:#6A9955">  // 2. Create their first thread, tagged with your end_user_id.</span></span>
243<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">  const</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> threadResp</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">`</span><span style="color:#0A3069;--shiki-dark:#569CD6">${</span><span style="color:#0550AE;--shiki-dark:#4FC1FF">QLAUD</span><span style="color:#0A3069;--shiki-dark:#569CD6">}</span><span style="color:#0A3069;--shiki-dark:#CE9178">/v1/threads`</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">
243, {</span></span>
244<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>
245<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">    headers:</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> { </span><span style="color:#0A3069;--shiki-dark:#CE9178">&#x27;x-api-key&#x27;</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">:</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> key</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">secret</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#0A3069;--shiki-dark:#CE9178">&#x27;content-type&#x27;</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">:</span><span style="color:#0A3069;--shiki-dark:#CE9178"> &#x27;application/json&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> },</span></span>
246<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>
247<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">      end_user_id:</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> endUserId</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
248<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">      metadata:</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> { </span><span style="color:#1F2328;--shiki-dark:#9CDCFE">plan:</span><span style="color:#0A3069;--shiki-dark:#CE9178"> &#x27;free&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> },</span></span>
249<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    }),</span></span>
250<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">  });</span></span>
251<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">  const</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> thread</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> =</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> (</span><span style="color:#CF222E;--shiki-dark:#C586C0">await</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> threadResp</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 style="color:#CF222E;--shiki-dark:#C586C0">as</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> { </span><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>
252<span class="line"></span>
253<span class="line"><span style="color:#6E7781;--shiki-dark:#6A9955">  // Store both in YOUR users table.</span></span>
254<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">  return</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> {</span></span>
255<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">    qlaudKeyId:</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> key</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">id</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
256<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">    qlaudSecret:</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> key</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">secret</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,    </span><span style="color:#6E7781;--shiki-dark:#6A9955">// only returned once — store it</span></span>
257<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">    qlaudThreadId:</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> thread</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">id</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
258<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">  };</span></span>
259<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">}</span></span>
260</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>
261<span data-as="p">You now have one place per user that holds their entire AI footprint.
262That’s all the per-user state you need to track on your side.</span>
263<h2 class="flex whitespace-pre-wrap group font-semibold" id="step-2-—-send-a-message-in-a-conversation"><div class="absolute" tabindex="-1"><a href="#step-2-—-send-a-message-in-a-conversation" 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.
263083 13.311 16.083 14.692 14.702L14.702 14.692C16.083 13.311 16.083 11.073 14.702 9.692L13.771 8.761" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M9.50002 11.173C9.85202 11.005 10.182 10.775 10.473 10.483L10.483 10.473C11.864 9.092 11.864 6.854 10.483 5.473L8.30802 3.298C6.92702 1.917 4.68902 1.917 3.30802 3.298L3.29802 3.308C1.91702 4.689 1.91702 6.927 3.29802 8.308L4.22902 9.239" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></div></a></div><span class="cursor-pointer">Step 2 — Send a message in a conversation</span></h2>
264<span data-as="p">Once you have a user’s <code>qlaud_secret</code> and <code>qlaud_thread_id</code>, sending a turn
265is one call. qlaud loads the prior history server-side; you only send the
266new user content:</span>
267<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_589bb9qnpfb39p7b9snpfiutb_-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_ml89bb9qnpfb39p7b9snpfiutb_" 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">Python</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_16l89bb9qnpfb39p7b9snpfiutb_" 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">TypeScript</div></button></div></div></div></div><div class="flex items-center justify-end shrink-0 gap-1.5"><div class="code-block-copy-button z-10 select-none" id="base-ui-_R_1tp89bb9qnpfb39p7b9snpfiutb_" data-base-ui-tooltip-trigger=""><button class="size-6.5 flex items-center justify-center rounded-md group/copy-button [.code-block:not(:has([data-fade-overlay]))_[data-floating-buttons]_&amp;]:bg-gray-100 dark:[.code-block:not(:has([data-fade-overlay]))_[data-floating-buttons]_&amp;]: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 
2671.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></div><div class="flex flex-1 overflow-hidden"><div data-orientation="horizontal" data-activation-direction="none" id="base-ui-_R_689bb9qnpfb39p7b9snpfiutb_" 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: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"><div role="presentation" data-id="base-ui-_R_1m89bb9qnpfb39p7b9snpfiutb_-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="12"><span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">def</span><span style="color:#8250DF;--shiki-dark:#DCDCAA"> chat</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">qlaud_secret</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0550AE;--shiki-dark:#4EC9B0">str</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#1F2328;--shiki-dark:#9CDCFE">thread_id</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0550AE;--shiki-dark:#4EC9B0">str</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#1F2328;--shiki-dark:#9CDCFE">user_msg</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0550AE;--shiki-dark:#4EC9B0">str</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">) -&gt; </span><span style="color:#0550AE;--shiki-dark:#4EC9B0">str</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">:</span></span>
268<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    r </span><span style="color:#CF222E;--shiki-dark:#D4D4D4">=</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> requests.post(</span></span>
269<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">        f</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;</span><span style="color:#CF222E;--shiki-dark:#569CD6">{</span><span style="color:#0550AE;--shiki-dark:#D4D4D4">QLAUD</span><span style="color:#CF222E;--shiki-dark:#569CD6">}</span><span style="color:#0A3069;--shiki-dark:#CE9178">/v1/threads/</span><span style="color:#CF222E;--shiki-dark:#569CD6">{</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">thread_id</span><span style="color:#CF222E;--shiki-dark:#569CD6">}</span><span style="color:#0A3069;--shiki-dark:#CE9178">/messages&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
270<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 style="color:#0A3069;--shiki-dark:#CE9178">&quot;x-api-key&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: qlaud_secret, </span><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>
271<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">        json</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">=</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">{</span></span>
272<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;claude-sonnet-4-6&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
273<span class="line"><span style="color:#0A3069;--shiki-dark:#CE9178">            &quot;max_tokens&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0550AE;--shiki-dark:#B5CEA8">1024</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
274<span class="line"><span style="color:#0A3069;--shiki-dark:#CE9178">            &quot;content&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: user_msg,   </span><span style="color:#6E7781;--shiki-dark:#6A9955"># NOT a `messages` array</span></span>
275<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">        },</span></span>
276<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    )</span></span>
277<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    body </span><span style="color:#CF222E;--shiki-dark:#D4D4D4">=</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> r.json()</span></span>
278<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">    return</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> body[</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;content&quot;</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:#0A3069;--shiki-dark:#CE9178">&quot;text&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">]</span></span>
279</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 data-hidden="" data-orientation="horizontal" data-activation-direction="none" hidden="" id="base-ui-_R_a89bb9qnpfb39p7b9snpfiutb_" 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"><div role="presentation" data-id="base-ui-_R_1q89bb9qnpfb39p7b9snpfiutb_-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" 
279class="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="17"><span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">export</span><span style="color:#CF222E;--shiki-dark:#569CD6"> async</span><span style="color:#CF222E;--shiki-dark:#569CD6"> function</span><span style="color:#8250DF;--shiki-dark:#DCDCAA"> chat</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span></span>
280<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">  qlaudSecret</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>
281<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">  threadId</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>
282<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">  userMsg</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>
283<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">)</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">:</span><span style="color:#953800;--shiki-dark:#4EC9B0"> Promise</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">&gt; {</span></span>
284<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">  const</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> r</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">`</span><span style="color:#0A3069;--shiki-dark:#569CD6">${</span><span style="color:#0550AE;--shiki-dark:#4FC1FF">QLAUD</span><span style="color:#0A3069;--shiki-dark:#569CD6">}</span><span style="color:#0A3069;--shiki-dark:#CE9178">/v1/threads/</span><span style="color:#0A3069;--shiki-dark:#569CD6">${</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">threadId</span><span style="color:#0A3069;--shiki-dark:#569CD6">}</span><span style="color:#0A3069;--shiki-dark:#CE9178">/messages`</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, {</span></span>
285<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>
286<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">    headers:</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> { </span><span style="color:#0A3069;--shiki-dark:#CE9178">&#x27;x-api-key&#x27;</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">:</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> qlaudSecret</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#0A3069;--shiki-dark:#CE9178">&#x27;content-type&#x27;</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">:</span><span style="color:#0A3069;--shiki-dark:#CE9178"> &#x27;application/json&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> },</span></span>
287<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">
287({</span></span>
288<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">      model:</span><span style="color:#0A3069;--shiki-dark:#CE9178"> &#x27;claude-sonnet-4-6&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
289<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">      max_tokens:</span><span style="color:#0550AE;--shiki-dark:#B5CEA8"> 1024</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
290<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">      content:</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> userMsg</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,           </span><span style="color:#6E7781;--shiki-dark:#6A9955">// NOT a `messages` array</span></span>
291<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    }),</span></span>
292<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">  });</span></span>
293<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:#1F2328;--shiki-dark:#D4D4D4"> (</span><span style="color:#CF222E;--shiki-dark:#C586C0">await</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> r</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 style="color:#CF222E;--shiki-dark:#C586C0">as</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:#953800;--shiki-dark:#4EC9B0"> Array</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">&lt;{ </span><span style="color:#953800;--shiki-dark:#9CDCFE">text</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"> }&gt; };</span></span>
294<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">  return</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">content</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">text</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">;</span></span>
295<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">}</span></span>
296</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>
297<span data-as="p">That’s a complete chat backend. No message store, no context loader, no
298“how do I keep history under N tokens” code. qlaud caps at the last 50
299turns automatically and you never see the upstream <code>messages</code> array.</span>
300<h2 class="flex whitespace-pre-wrap group font-semibold" id="step-3-—-stream-the-response-token-by-token-ux"><div class="absolute" tabindex="-1"><a href="#step-3-—-stream-the-response-token-by-token-ux" 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.
300083 13.311 16.083 14.692 14.702L14.702 14.692C16.083 13.311 16.083 11.073 14.702 9.692L13.771 8.761" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M9.50002 11.173C9.85202 11.005 10.182 10.775 10.473 10.483L10.483 10.473C11.864 9.092 11.864 6.854 10.483 5.473L8.30802 3.298C6.92702 1.917 4.68902 1.917 3.30802 3.298L3.29802 3.308C1.91702 4.689 1.91702 6.927 3.29802 8.308L4.22902 9.239" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></div></a></div><span class="cursor-pointer">Step 3 — Stream the response (token-by-token UX)</span></h2>
301<span data-as="p">For a real chat UI you want text to appear word-by-word. Add <code>stream: true</code>
302and read the SSE stream:</span>
303<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_5a9bb9qnpfb39p7b9snpfiutb_-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_mla9bb9qnpfb39p7b9snpfiutb_" 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">Python</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_16la9bb9qnpfb39p7b9snpfiutb_" 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">TypeScript</div></button></div></div></div></div><div class="flex items-center justify-end shrink-0 gap-1.5"><div class="code-block-copy-button z-10 select-none" id="base-ui-_R_1tpa9bb9qnpfb39p7b9snpfiutb_" data-base-ui-tooltip-trigger=""><button class="size-6.5 flex items-center justify-center rounded-md group/copy-button [.code-block:not(:has([data-fade-overlay]))_[data-floating-buttons]_&amp;]:bg-gray-100 dark:[.code-block:not(:has([data-fade-overlay]))_[data-floating-buttons]_&amp;]: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 
3031.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></div><div class="flex flex-1 overflow-hidden"><div data-orientation="horizontal" data-activation-direction="none" id="base-ui-_R_6a9bb9qnpfb39p7b9snpfiutb_" 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: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"><div role="presentation" data-id="base-ui-_R_1ma9bb9qnpfb39p7b9snpfiutb_-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="22"><span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">import</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> json</span></span>
304<span class="line"></span>
305<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">def</span><span style="color:#8250DF;--shiki-dark:#DCDCAA"> chat_stream</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">qlaud_secret</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0550AE;--shiki-dark:#4EC9B0">str</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#1F2328;--shiki-dark:#9CDCFE">thread_id</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0550AE;--shiki-dark:#4EC9B0">str</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#1F2328;--shiki-dark:#9CDCFE">user_msg</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0550AE;--shiki-dark:#4EC9B0">str</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">):</span></span>
306<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">    with</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> requests.post(</span></span>
307<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">        f</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;</span><span style="color:#CF222E;--shiki-dark:#569CD6">{</span><span style="color:#0550AE;--shiki-dark:#D4D4D4">QLAUD</span><span style="color:#CF222E;--shiki-dark:#569CD6">}</span><span style="color:#0A3069;--shiki-dark:#CE9178">/v1/threads/</span><span style="color:#CF222E;--shiki-dark:#569CD6">{</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">thread_id</span><span style="color:#CF222E;--shiki-dark:#569CD6">}</span><span style="color:#0A3069;--shiki-dark:#CE9178">/messages&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
308<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 style="color:#0A3069;--shiki-dark:#CE9178">&quot;x-api-key&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: qlaud_secret, </span><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>
309<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">        json</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">=</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">{</span></span>
310<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;claude-sonnet-4-6&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
311<span class="line"><span style="color:#0A3069;--shiki-dark:#CE9178">            &quot;max_tokens&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0550AE;--shiki-dark:#B5CEA8">1024</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
312<span class="line"><span style="color:#0A3069;--shiki-dark:#CE9178">            &quot;content&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: user_msg,</span></span>
313<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>
314<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">        },</span></span>
315<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 style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
316<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    ) </span><span style="color:#CF222E;--shiki-dark:#C586C0">as</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> r:</span></span>
317<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"> r.iter_lines(</span><span style="color:#953800;--shiki-dark:#9CDCFE">decode_unicode</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">=</span><span style="color:#0550AE;--shiki-dark:#569CD6">True</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">):</span></span>
318<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">            if</span><span style="color:#CF222E;--shiki-dark:#569CD6"> not</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> line </span><span style="color:#CF222E;--shiki-dark:#569CD6">or</span><span style="color:#CF222E;--shiki-dark:#569CD6"> not</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> line.startswith(</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;data: &quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">):</span></span>
319<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">                continue</span></span>
320<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">            event </span><span style="color:#CF222E;--shiki-dark:#D4D4D4">=</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> json.loads(line[</span><span style="color:#0550AE;--shiki-dark:#B5CEA8">6</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">:])</span></span>
321<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">            if</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> event.get(</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;type&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">) </span><span style="color:#CF222E;--shiki-dark:#D4D4D4">==</span><span style="color:#0A3069;--shiki-dark:#CE9178"> &quot;content_block_delta&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">:</span></span>
322<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">                delta </span><span style="color:#CF222E;--shiki-dark:#D4D4D4">=</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> event.get(</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;delta&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, {})</span></span>
323<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">                if</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> delta.get(</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;type&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">) </span><span style="color:#CF222E;--shiki-dark:#D4D4D4">==</span><span style="color:#0A3069;--shiki-dark:#CE9178"> &quot;text_delta&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">:</span></span>
324<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">                    yield</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> delta[</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;text&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">]</span></span>
325</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 data-hidden="" data-orientation="horizontal" data-activation-direction="none" hidden="" id="base-ui-_R_aa9bb9qnpfb39p7b9snpfiutb_" 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"><div role="presentation" data-id="base-ui-_R_1qa9bb9qnpfb39p7b9snpfiutb_-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" 
325class="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="43"><span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">export</span><span style="color:#CF222E;--shiki-dark:#569CD6"> async</span><span style="color:#CF222E;--shiki-dark:#569CD6"> function*</span><span style="color:#8250DF;--shiki-dark:#DCDCAA"> chatStream</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span></span>
326<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">  qlaudSecret</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>
327<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">  threadId</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>
328<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">  userMsg</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>
329<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">)</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">:</span><span style="color:#953800;--shiki-dark:#4EC9B0"> AsyncGenerator</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">&gt; {</span></span>
330<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">  const</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> r</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">`</span><span style="color:#0A3069;--shiki-dark:#569CD6">${</span><span style="color:#0550AE;--shiki-dark:#4FC1FF">QLAUD</span><span style="color:#0A3069;--shiki-dark:#569CD6">}</span><span style="color:#0A3069;--shiki-dark:#CE9178">/v1/threads/</span><span style="color:#0A3069;--shiki-dark:#569CD6">${</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">threadId</span><span style="color:#0A3069;--shiki-dark:#569CD6">}</span><span style="color:#0A3069;--shiki-dark:#CE9178">/messages`</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, {</span></span>
331<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>
332<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">    headers:</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> { </span><span style="color:#0A3069;--shiki-dark:#CE9178">&#x27;x-api-key&#x27;</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">:</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> qlaudSecret</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#0A3069;--shiki-dark:#CE9178">&#x27;content-type&#x27;</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">:</span><span style="color:#0A3069;--shiki-dark:#CE9178"> &#x27;application/json&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> },</span></span>
333<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">
333({</span></span>
334<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">      model:</span><span style="color:#0A3069;--shiki-dark:#CE9178"> &#x27;claude-sonnet-4-6&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
335<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">      max_tokens:</span><span style="color:#0550AE;--shiki-dark:#B5CEA8"> 1024</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
336<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">      content:</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> userMsg</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
337<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>
338<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    }),</span></span>
339<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">  });</span></span>
340<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">r</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">body</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">) </span><span style="color:#CF222E;--shiki-dark:#C586C0">return</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">;</span></span>
341<span class="line"></span>
342<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">  const</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> reader</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> =</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> r</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">body</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#8250DF;--shiki-dark:#DCDCAA">getReader</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">();</span></span>
343<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">  const</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> dec</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> =</span><span style="color:#CF222E;--shiki-dark:#569CD6"> new</span><span style="color:#8250DF;--shiki-dark:#DCDCAA"> TextDecoder</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">();</span></span>
344<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">  let</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> buffer</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>
345<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">  while</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> (</span><span style="color:#0550AE;--shiki-dark:#569CD6">true</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">) {</span></span>
346<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">    const</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> { </span><span style="color:#0550AE;--shiki-dark:#4FC1FF">done</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#0550AE;--shiki-dark:#4FC1FF">value</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> } </span><span style="color:#CF222E;--shiki-dark:#D4D4D4">=</span><span style="color:#CF222E;--shiki-dark:#C586C0"> await</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> reader</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#8250DF;--shiki-dark:#DCDCAA">read</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">();</span></span>
347<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">    if</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> (</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">done</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">) </span><span style="color:#CF222E;--shiki-dark:#C586C0">break</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">;</span></span>
348<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">    buffer</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> +=</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> dec</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#8250DF;--shiki-dark:#DCDCAA">
348decode</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">value</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, { </span><span 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>
349<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">    let</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> idx</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>
350<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">    while</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> ((</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">idx</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> =</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> buffer</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#8250DF;--shiki-dark:#DCDCAA">indexOf</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#0A3069;--shiki-dark:#CE9178">&#x27;</span><span style="color:#CF222E;--shiki-dark:#D7BA7D">\n</span><span style="color:#0A3069;--shiki-dark:#CE9178">&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">)) </span><span style="color:#CF222E;--shiki-dark:#D4D4D4">&gt;=</span><span style="color:#0550AE;--shiki-dark:#B5CEA8"> 0</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">) {</span></span>
351<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">      const</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> line</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> =</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> buffer</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">0</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#1F2328;--shiki-dark:#9CDCFE">idx</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">);</span></span>
352<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">      buffer</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> =</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> buffer</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:#1F2328;--shiki-dark:#9CDCFE">idx</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> +</span><span style="color:#0550AE;--shiki-dark:#B5CEA8"> 1</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">);</span></span>
353<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>
354<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">      try</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> {</span></span>
355<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">        const</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> event</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> =</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> JSON</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#8250DF;--shiki-dark:#DCDCAA">parse</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">line</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#8250DF;--shiki-dark:#DCDCAA">slice</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#0550AE;--shiki-dark:#B5CEA8">6</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">));</span></span>
356<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">        if</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> (</span></span>
357<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">          event</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;content_block_delta&#x27;</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> &amp;&amp;</span></span>
358<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">          event</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">type</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> ===</span><span style="color:#0A3069;--shiki-dark:#CE9178"> &#x27;text_delta&#x27;</span></span>
359<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">        ) {</span></span>
360<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">          yield</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> event</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">text</span><span style="color:#CF222E;--shiki-dark:#C586C0"> as</span><span style="color:#0550AE;--shiki-dark:#4EC9B0"> string</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">;</span></span>
361<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">        }</span></span>
362<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">      } </span><span style="color:#CF222E;--shiki-dark:#C586C0">catch</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> {</span></span>
363<span class="line"><span style="color:#6E7781;--shiki-dark:#6A9955">        // partial JSON between chunks — wait for next read</span></span>
364<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">      }</span></span>
365<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    }</span></span>
366<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">  }</span></span>
367<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">}</span></span>
368</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>
369<span data-as="p">Frontend: pipe each yielded chunk straight into your UI. After the stream
370closes, qlaud has already persisted the full assistant turn for you.</span>
371<h2 class="flex whitespace-pre-wrap group font-semibold" id="step-4-—-add-a-tool"><div class="absolute" tabindex="-1"><a href="#step-4-—-add-a-tool" class="-ml-10 flex items-center opacity-0 border-0 group-hover:opacity-100 focus:opacity-100 focus:outline-0 group/link" aria-label="Navigate to header">​<div class="size-6 rounded-md flex items-center justify-center shadow-xs text-gray-400 dark:text-white/50 dark:bg-background-dark dark:brightness-[1.35] dark:ring-1 dark:hover:brightness-150 bg-white ring-1 ring-gray-400/30 dark:ring-gray-700/25 hover:ring-gray-400/60 dark:hover:ring-white/20 group-focus/link:border-2 group-focus/link:border-primary dark:group-focus/link:border-primary-light"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="size-3 shrink-0"><path d="M8.50001 6.827C8.14801 6.995 7.81801 7.225 7.52701 7.517L7.51701 7.527C6.13601 8.908 6.13601 11.146 7.51701 12.527L9.69201 14.702C11.073 16.
371083 13.311 16.083 14.692 14.702L14.702 14.692C16.083 13.311 16.083 11.073 14.702 9.692L13.771 8.761" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M9.50002 11.173C9.85202 11.005 10.182 10.775 10.473 10.483L10.483 10.473C11.864 9.092 11.864 6.854 10.483 5.473L8.30802 3.298C6.92702 1.917 4.68902 1.917 3.30802 3.298L3.29802 3.308C1.91702 4.689 1.91702 6.927 3.29802 8.308L4.22902 9.239" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></div></a></div><span class="cursor-pointer">Step 4 — Add a tool</span></h2>
372<span data-as="p">Let’s give the assistant the ability to look up user account info. Two
373parts: register the tool with qlaud, then host the webhook.</span>
374<h3 class="flex whitespace-pre-wrap group font-semibold" id="register-the-tool-one-time"><div class="absolute" tabindex="-1"><a href="#register-the-tool-one-time" 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.3
37411 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">Register the tool (one-time)</span></h3>
375<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_5cpbb9qnpfb39p7b9snpfiutb_-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_mlcpbb9qnpfb39p7b9snpfiutb_" 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">Python</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_16lcpbb9qnpfb39p7b9snpfiutb_" 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">TypeScript</div></button></div></div></div></div><div class="flex items-center justify-end shrink-0 gap-1.5"><div class="code-block-copy-button z-10 select-none" id="base-ui-_R_1tpcpbb9qnpfb39p7b9snpfiutb_" data-base-ui-tooltip-trigger=""><button class="size-6.5 flex items-center justify-center rounded-md group/copy-button [.code-block:not(:has([data-fade-overlay]))_[data-floating-buttons]_&amp;]:bg-gray-100 dark:[.code-block:not(:has([data-fade-overlay]))_[data-floating-buttons]_&amp;]: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 
3751.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></div><div class="flex flex-1 overflow-hidden"><div data-orientation="horizontal" data-activation-direction="none" id="base-ui-_R_6cpbb9qnpfb39p7b9snpfiutb_" 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: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"><div role="presentation" data-id="base-ui-_R_1mcpbb9qnpfb39p7b9snpfiutb_-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="18"><span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">def</span><span style="color:#8250DF;--shiki-dark:#DCDCAA"> register_account_lookup_tool</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">():</span></span>
376<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    r </span><span style="color:#CF222E;--shiki-dark:#D4D4D4">=</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> requests.post(</span></span>
377<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">        f</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;</span><span style="color:#CF222E;--shiki-dark:#569CD6">{</span><span style="color:#0550AE;--shiki-dark:#D4D4D4">QLAUD</span><span style="color:#CF222E;--shiki-dark:#569CD6">}</span><span style="color:#0A3069;--shiki-dark:#CE9178">/v1/tools&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
378<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 style="color:#0A3069;--shiki-dark:#CE9178">&quot;x-api-key&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0550AE;--shiki-dark:#D4D4D4">MASTER</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><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>
379<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">        json</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">=</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">{</span></span>
380<span class="line"><span style="color:#0A3069;--shiki-dark:#CE9178">            &quot;name&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;lookup_account&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
381<span class="line"><span style="color:#0A3069;--shiki-dark:#CE9178">            &quot;description&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;Look up a customer&#x27;s account info by email&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
382<span class="line"><span style="color:#0A3069;--shiki-dark:#CE9178">            &quot;input_schema&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span></span>
383<span class="line"><span style="color:#0A3069;--shiki-dark:#CE9178">                &quot;type&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;object&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
384<span class="line"><span style="color:#0A3069;--shiki-dark:#CE9178">                &quot;properties&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span></span>
385<span class="line"><span style="color:#0A3069;--shiki-dark:#CE9178">                    &quot;email&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;type&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;
385string&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;description&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;Customer email&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">}</span></span>
386<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">                },</span></span>
387<span class="line"><span style="color:#0A3069;--shiki-dark:#CE9178">                &quot;required&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: [</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;email&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">],</span></span>
388<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">            },</span></span>
389<span class="line"><span style="color:#0A3069;--shiki-dark:#CE9178">            &quot;webhook_url&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;https://my-app.example/qlaud/tools/account-lookup&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
390<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">        },</span></span>
391<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    ).json()</span></span>
392<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">    return</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> r[</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;id&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">], r[</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;secret&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">]   </span><span style="color:#6E7781;--shiki-dark:#6A9955"># store both — secret is returned ONCE</span></span>
393</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 data-hidden="" data-orientation="horizontal" data-activation-direction="none" hidden="" id="base-ui-_R_acpbb9qnpfb39p7b9snpfiutb_" 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"><div role="presentation" data-id="base-ui-_R_1qcpbb9qnpfb39p7b9snpfiutb_-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="typescript"><code language="typescript" numberOfLines="20"><span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">export</span><span style="color:#CF222E;--shiki-dark:#569CD6"> async</span><span style="color:#CF222E;--shiki-dark:#569CD6"> function</span><span style="color:#8250DF;--shiki-dark:#DCDCAA"> registerAccountLookupTool</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">() {</span></span>
394<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">  const</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> r</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">`</span><span style="color:#0A3069;--shiki-dark:#569CD6">${</span><span style="color:#0550AE;--shiki-dark:#4FC1FF">QLAUD</span><span style="color:#0A3069;--shiki-dark:#569CD6">}</span><span style="color:#0A3069;--shiki-dark:#CE9178">
394/v1/tools`</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, {</span></span>
395<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>
396<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">    headers:</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> { </span><span style="color:#0A3069;--shiki-dark:#CE9178">&#x27;x-api-key&#x27;</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">:</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> MASTER</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#0A3069;--shiki-dark:#CE9178">&#x27;content-type&#x27;</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">:</span><span style="color:#0A3069;--shiki-dark:#CE9178"> &#x27;application/json&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> },</span></span>
397<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>
398<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">      name:</span><span style="color:#0A3069;--shiki-dark:#CE9178"> &#x27;lookup_account&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
399<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">      description:</span><span style="color:#0A3069;--shiki-dark:#CE9178"> &quot;Look up a customer&#x27;s account info by email&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
400<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">      input_schema:</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> {</span></span>
401<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">        type:</span><span style="color:#0A3069;--shiki-dark:#CE9178"> &#x27;object&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
402<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">        properties:</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> {</span></span>
403<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">          email:</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> { </span><span style="color:#1F2328;--shiki-dark:#9CDCFE">type:</span><span style="color:#0A3069;--shiki-dark:#CE9178"> &#x27;string&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#1F2328;--shiki-dark:#9CDCFE">description:</span><span style="color:#0A3069;--shiki-dark:#CE9178"> &#x27;Customer email&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> },</span></span>
404<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">        },</span></span>
405<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">        required:</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> [</span><span style="color:#0A3069;--shiki-dark:#CE9178">&#x27;email&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">],</span></span>
406<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">      },</span></span>
407<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">      webhook_url:</span><span style="color:#0A3069;--shiki-dark:#CE9178"> &#x27;https://my-app.example/qlaud/tools/account-lookup&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
408<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    }),</span></span>
409<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">  });</span></span>
410<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">  const</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> t</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> =</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> (</span><span style="color:#CF222E;--shiki-dark:#C586C0">await</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> r</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 style="color:#CF222E;--shiki-dark:#C586C0">as</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> { </span><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 style="color:#953800;--shiki-dark:#9CDCFE">
410secret</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>
411<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">  return</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> { </span><span style="color:#1F2328;--shiki-dark:#9CDCFE">id:</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> t</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">id</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#1F2328;--shiki-dark:#9CDCFE">secret:</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> t</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">secret</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> };  </span><span style="color:#6E7781;--shiki-dark:#6A9955">// store both — secret is returned ONCE</span></span>
412<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">}</span></span>
413</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>
414<h3 class="flex whitespace-pre-wrap group font-semibold" id="host-the-webhook-your-backend"><div class="absolute" tabindex="-1"><a href="#host-the-webhook-your-backend" 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.3
41411 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">Host the webhook (your backend)</span></h3>
415<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_5dpbb9qnpfb39p7b9snpfiutb_-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_mldpbb9qnpfb39p7b9snpfiutb_" 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">Python</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_16ldpbb9qnpfb39p7b9snpfiutb_" 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">TypeScript</div></button></div></div></div></div><div class="flex items-center justify-end shrink-0 gap-1.5"><div class="code-block-copy-button z-10 select-none" id="base-ui-_R_1tpdpbb9qnpfb39p7b9snpfiutb_" data-base-ui-tooltip-trigger=""><button class="size-6.5 flex items-center justify-center rounded-md group/copy-button [.code-block:not(:has([data-fade-overlay]))_[data-floating-buttons]_&amp;]:bg-gray-100 dark:[.code-block:not(:has([data-fade-overlay]))_[data-floating-buttons]_&amp;]: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 
4151.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></div><div class="flex flex-1 overflow-hidden"><div data-orientation="horizontal" data-activation-direction="none" id="base-ui-_R_6dpbb9qnpfb39p7b9snpfiutb_" 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: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"><div role="presentation" data-id="base-ui-_R_1mdpbb9qnpfb39p7b9snpfiutb_-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="35"><span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">import</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> hmac, hashlib</span></span>
416<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">from</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> flask </span><span style="color:#CF222E;--shiki-dark:#C586C0">import</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> Flask, request, jsonify</span></span>
417<span class="line"></span>
418<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">app </span><span style="color:#CF222E;--shiki-dark:#D4D4D4">=</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> Flask(</span><span style="color:#0550AE;--shiki-dark:#9CDCFE">__name__</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">)</span></span>
419<span class="line"><span style="color:#0550AE;--shiki-dark:#D4D4D4">TOOL_SECRET</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> =</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> os.environ[</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;QLAUD_TOOL_SECRET_LOOKUP_ACCOUNT&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">]</span></span>
420<span class="line"></span>
421<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">def</span><span style="color:#8250DF;--shiki-dark:#DCDCAA"> verify_signature</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:#1F2328;--shiki-dark:#9CDCFE">body_bytes</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">):</span></span>
422<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    ts </span><span style="color:#CF222E;--shiki-dark:#D4D4D4">=</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> headers.get(</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;X-Qlaud-Timestamp&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">)</span></span>
423<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    sig </span><span style="color:#CF222E;--shiki-dark:#D4D4D4">=</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> headers.get(</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;X-Qlaud-Signature&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">)</span></span>
424<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    expected </span><span style="color:#CF222E;--shiki-dark:#D4D4D4">=</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> hmac.new(</span></span>
425<span class="line"><span style="color:#0550AE;--shiki-dark:#D4D4D4">        TOOL_SECRET</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.encode(),</span></span>
426<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">        f</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;</span><span style="color:#CF222E;--shiki-dark:#569CD6">{</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">ts</span><span style="color:#CF222E;--shiki-dark:#569CD6">}</span><span style="color:#0A3069;--shiki-dark:#CE9178">.</span><span style="color:#CF222E;--shiki-dark:#569CD6">{</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">body_bytes.decode()</span><span style="color:#CF222E;--shiki-dark:#569CD6">}</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.encode(),</span></span>
427<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">        hashlib.sha256,</span></span>
428<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    ).hexdigest()</span></span>
429<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">    return</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> hmac.compare_digest(sig, expected)</span></span>
430<span class="line"></span>
431<span class="line"><span style="color:#8250DF;--shiki-dark:#DCDCAA">@app.post</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;/qlaud/tools/account-lookup&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">)</span></span>
432<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">def</span><span style="color:#8250DF;--shiki-dark:#DCDCAA"> account_lookup</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">():</span></span>
433<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">    if</span><span style="color:#CF222E;--shiki-dark:#569CD6"> not</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> verify_signature(request.headers, request.get_data()):</span></span>
434<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">        return</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> jsonify({</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;error&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;bad signature&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">}), </span><span style="color:#0550AE;--shiki-dark:#B5CEA8">401</span></span>
435<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    payload </span><span style="color:#CF222E;--shiki-dark:#D4D4D4">=</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> request.get_json()</span></span>
436<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    email </span><span style="color:#CF222E;--shiki-dark:#D4D4D4">=</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> payload[</span><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;email&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">]</span></span>
437<span class="line"></span>
438<span class="line"><span style="color:#6E7781;--shiki-dark:#6A9955">    # Your business logic — DB query, internal API, etc.</span></span>
439<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    account </span><span style="color:#CF222E;--shiki-dark:#D4D4D4">=</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> my_db.find_account(email)</span></span>
440<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">    if</span><span style="color:#CF222E;--shiki-dark:#569CD6"> not</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> account:</span></span>
441<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">        return</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> jsonify({</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;output&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;no account found&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;is_error&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>
442<span class="line"></span>
443<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">    return</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> jsonify({</span></span>
444<span class="line"><span style="color:#0A3069;--shiki-dark:#CE9178">        &quot;output&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: {</span></span>
445<span class="line"><span style="color:#0A3069;--shiki-dark:#CE9178">            &quot;plan&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: account.plan,</span></span>
446<span class="line"><span style="color:#0A3069;--shiki-dark:#CE9178">            &quot;credits_remaining&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: account.credits,</span></span>
447<span class="line"><span style="color:#0A3069;--shiki-dark:#CE9178">            &quot;joined_at&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: account.joined_at.isoformat(),</span></span>
448<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">        }</span></span>
449<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    })</span></span>
450</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 data-hidden="" data-orientation="horizontal" data-activation-direction="none" hidden="" id="base-ui-_R_adpbb9qnpfb39p7b9snpfiutb_" 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"><div role="presentation" data-id="base-ui-_R_1qdpbb9qnpfb39p7b9snpfiutb_-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" 
450class="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="38"><span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">import</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> { </span><span style="color:#1F2328;--shiki-dark:#9CDCFE">Hono</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> } </span><span style="color:#CF222E;--shiki-dark:#C586C0">from</span><span style="color:#0A3069;--shiki-dark:#CE9178"> &#x27;hono&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">;</span></span>
451<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">import</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> { </span><span style="color:#1F2328;--shiki-dark:#9CDCFE">createHmac</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#1F2328;--shiki-dark:#9CDCFE">timingSafeEqual</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> } </span><span style="color:#CF222E;--shiki-dark:#C586C0">from</span><span style="color:#0A3069;--shiki-dark:#CE9178"> &#x27;node:crypto&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">;</span></span>
452<span class="line"></span>
453<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">const</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> app</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> =</span><span style="color:#CF222E;--shiki-dark:#569CD6"> new</span><span style="color:#8250DF;--shiki-dark:#DCDCAA"> Hono</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">();</span></span>
454<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">const</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> TOOL_SECRET</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> =</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> process</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">env</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#0550AE;--shiki-dark:#4FC1FF">QLAUD_TOOL_SECRET_LOOKUP_ACCOUNT</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">!</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">;</span></span>
455<span class="line"></span>
456<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">function</span><span style="color:#8250DF;--shiki-dark:#DCDCAA"> verifySignature</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#953800;--shiki-dark:#9CDCFE">headers</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">:</span><span style="color:#953800;--shiki-dark:#4EC9B0"> Headers</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#953800;--shiki-dark:#9CDCFE">bodyText</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"> boolean</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> {</span></span>
457<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">  const</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> ts</span><span style="color:#CF222E;--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;x-qlaud-timestamp&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">) </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>
458<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">  const</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> sig</span><span style="color:#CF222E;--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">
458get</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#0A3069;--shiki-dark:#CE9178">&#x27;x-qlaud-signature&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">) </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>
459<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">  const</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> expected</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> =</span><span style="color:#8250DF;--shiki-dark:#DCDCAA"> createHmac</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#0A3069;--shiki-dark:#CE9178">&#x27;sha256&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#0550AE;--shiki-dark:#4FC1FF">TOOL_SECRET</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">)</span></span>
460<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    .</span><span style="color:#8250DF;--shiki-dark:#DCDCAA">update</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#0A3069;--shiki-dark:#CE9178">`</span><span style="color:#0A3069;--shiki-dark:#569CD6">${</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">ts</span><span style="color:#0A3069;--shiki-dark:#569CD6">}</span><span style="color:#0A3069;--shiki-dark:#CE9178">.</span><span style="color:#0A3069;--shiki-dark:#569CD6">${</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">bodyText</span><span style="color:#0A3069;--shiki-dark:#569CD6">}</span><span style="color:#0A3069;--shiki-dark:#CE9178">`</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">)</span></span>
461<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    .</span><span style="color:#8250DF;--shiki-dark:#DCDCAA">digest</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#0A3069;--shiki-dark:#CE9178">&#x27;hex&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">);</span></span>
462<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">sig</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#0550AE;--shiki-dark:#9CDCFE">length</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> !==</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> expected</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#0550AE;--shiki-dark:#9CDCFE">length</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">) </span><span style="color:#CF222E;--shiki-dark:#C586C0">return</span><span style="color:#0550AE;--shiki-dark:#569CD6"> false</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">;</span></span>
463<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">  return</span><span style="color:#8250DF;--shiki-dark:#DCDCAA"> timingSafeEqual</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">Buffer</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#8250DF;--shiki-dark:#DCDCAA">from</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">sig</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">), </span><span style="color:#1F2328;--shiki-dark:#9CDCFE">Buffer</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#8250DF;--shiki-dark:#DCDCAA">from</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">expected</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">));</span></span>
464<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">}</span></span>
465<span class="line"></span>
466<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">app</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#8250DF;--shiki-dark:#DCDCAA">post</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#0A3069;--shiki-dark:#CE9178">&#x27;/qlaud/tools/account-lookup&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#CF222E;--shiki-dark:#569CD6">async</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> (</span><span style="color:#953800;--shiki-dark:#9CDCFE">c</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">) </span><span style="color:#CF222E;--shiki-dark:#569CD6">=&gt;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> {</span></span>
467<span class="line"><span style="color:#6E7781;--shiki-dark:#6A9955">  // Read raw body BEFORE parsing — HMAC needs the exact bytes.</span></span>
468<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">  const</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> bodyText</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"> c</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">req</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>
469<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:#8250DF;--shiki-dark:#DCDCAA">verifySignature</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">c</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">req</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">raw</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:#1F2328;--shiki-dark:#9CDCFE">bodyText</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">)) {</span></span>
470<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">    return</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> c</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 style="color:#1F2328;--shiki-dark:#9CDCFE">error:</span><span style="color:#0A3069;--shiki-dark:#CE9178"> &#x27;bad signature&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> }, </span><span style="color:#0550AE;--shiki-dark:#B5CEA8">401</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">);</span></span>
471<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">  }</span></span>
472<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">  const</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> payload</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">bodyText</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">) </span><span style="color:#CF222E;--shiki-dark:#C586C0">as</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> { </span><span style="color:#953800;--shiki-dark:#9CDCFE">input</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">:</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> { </span><span style="color:#953800;--shiki-dark:#9CDCFE">email</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>
473<span class="line"></span>
474<span class="line"><span style="color:#6E7781;--shiki-dark:#6A9955">  // Your business logic — DB query, internal API, etc.</span></span>
475<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">  const</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> account</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"> myDb</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#8250DF;--shiki-dark:#DCDCAA">findAccount</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">payload</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">input</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">email</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">);</span></span>
476<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">account</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">) {</span></span>
477<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">    return</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> c</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 style="color:#1F2328;--shiki-dark:#9CDCFE">output:</span><span style="color:#0A3069;--shiki-dark:#CE9178"> &#x27;no account found&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#1F2328;--shiki-dark:#9CDCFE">is_error:</span><span style="color:#0550AE;--shiki-dark:#569CD6"> true</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> });</span></span>
478<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">  }</span></span>
479<span class="line"></span>
480<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">  return</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> c</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">
480({</span></span>
481<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">    output:</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> {</span></span>
482<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">      plan:</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> account</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">plan</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
483<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">      credits_remaining:</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> account</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">credits</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
484<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">      joined_at:</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> account</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">joinedAt</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#8250DF;--shiki-dark:#DCDCAA">toISOString</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(),</span></span>
485<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    },</span></span>
486<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">  });</span></span>
487<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">});</span></span>
488</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>
489<h3 class="flex whitespace-pre-wrap group font-semibold" id="use-the-tool-in-a-conversation"><div class="absolute" tabindex="-1"><a href="#use-the-tool-in-a-conversation" 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.3
48911 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 the tool in a conversation</span></h3>
490<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_5epbb9qnpfb39p7b9snpfiutb_-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_mlepbb9qnpfb39p7b9snpfiutb_" 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">Python</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_16lepbb9qnpfb39p7b9snpfiutb_" 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">TypeScript</div></button></div></div></div></div><div class="flex items-center justify-end shrink-0 gap-1.5"><div class="code-block-copy-button z-10 select-none" id="base-ui-_R_1tpepbb9qnpfb39p7b9snpfiutb_" data-base-ui-tooltip-trigger=""><button class="size-6.5 flex items-center justify-center rounded-md group/copy-button [.code-block:not(:has([data-fade-overlay]))_[data-floating-buttons]_&amp;]:bg-gray-100 dark:[.code-block:not(:has([data-fade-overlay]))_[data-floating-buttons]_&amp;]: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 
4901.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></div><div class="flex flex-1 overflow-hidden"><div data-orientation="horizontal" data-activation-direction="none" id="base-ui-_R_6epbb9qnpfb39p7b9snpfiutb_" 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: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"><div role="presentation" data-id="base-ui-_R_1mepbb9qnpfb39p7b9snpfiutb_-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="12"><span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">def</span><span style="color:#8250DF;--shiki-dark:#DCDCAA"> chat_with_tools</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">qlaud_secret</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#1F2328;--shiki-dark:#9CDCFE">thread_id</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#1F2328;--shiki-dark:#9CDCFE">user_msg</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#1F2328;--shiki-dark:#9CDCFE">tool_ids</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">):</span></span>
491<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    r </span><span style="color:#CF222E;--shiki-dark:#D4D4D4">=</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> requests.post(</span></span>
492<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">        f</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;</span><span style="color:#CF222E;--shiki-dark:#569CD6">{</span><span style="color:#0550AE;--shiki-dark:#D4D4D4">QLAUD</span><span style="color:#CF222E;--shiki-dark:#569CD6">}</span><span style="color:#0A3069;--shiki-dark:#CE9178">/v1/threads/</span><span style="color:#CF222E;--shiki-dark:#569CD6">{</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">thread_id</span><span style="color:#CF222E;--shiki-dark:#569CD6">}</span><span style="color:#0A3069;--shiki-dark:#CE9178">/messages&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
493<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 style="color:#0A3069;--shiki-dark:#CE9178">&quot;x-api-key&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: qlaud_secret, </span><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>
494<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">        json</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">=</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">{</span></span>
495<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;claude-sonnet-4-6&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
496<span class="line"><span style="color:#0A3069;--shiki-dark:#CE9178">            &quot;max_tokens&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0550AE;--shiki-dark:#B5CEA8">1024</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
497<span class="line"><span style="color:#0A3069;--shiki-dark:#CE9178">            &quot;content&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: user_msg,</span></span>
498<span class="line"><span style="color:#0A3069;--shiki-dark:#CE9178">            &quot;tools&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: tool_ids,</span></span>
499<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">        },</span></span>
500<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    )</span></span>
501<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">    return</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> r.json()[</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;content&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">]</span></span>
502</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 data-hidden="" data-orientation="horizontal" data-activation-direction="none" hidden="" id="base-ui-_R_aepbb9qnpfb39p7b9snpfiutb_" 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"><div role="presentation" data-id="base-ui-_R_1qepbb9qnpfb39p7b9snpfiutb_-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" 
502class="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="19"><span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">export</span><span style="color:#CF222E;--shiki-dark:#569CD6"> async</span><span style="color:#CF222E;--shiki-dark:#569CD6"> function</span><span style="color:#8250DF;--shiki-dark:#DCDCAA"> chatWithTools</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span></span>
503<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">  qlaudSecret</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>
504<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">  threadId</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>
505<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">  userMsg</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>
506<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">  toolIds</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>
507<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">)</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">:</span><span style="color:#953800;--shiki-dark:#4EC9B0"> Promise</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">&lt;</span><span style="color:#0550AE;--shiki-dark:#4EC9B0">unknown</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">[]&gt; {</span></span>
508<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">  const</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> r</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">`</span><span style="color:#0A3069;--shiki-dark:#569CD6">${</span><span style="color:#0550AE;--shiki-dark:#4FC1FF">QLAUD</span><span style="color:#0A3069;--shiki-dark:#569CD6">}</span><span style="color:#0A3069;--shiki-dark:#CE9178">/v1/threads/</span><span style="color:#0A3069;--shiki-dark:#569CD6">${</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">threadId</span><span style="color:#0A3069;--shiki-dark:#569CD6">}</span><span style="color:#0A3069;--shiki-dark:#CE9178">/messages`</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, {</span></span>
509<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>
510<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">    headers:</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> { </span><span style="color:#0A3069;--shiki-dark:#CE9178">&#x27;x-api-key&#x27;</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">:</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> qlaudSecret</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#0A3069;--shiki-dark:#CE9178">&#x27;content-type&#x27;</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">:</span><span style="color:#0A3069;--shiki-dark:#CE9178"> &#x27;application/json&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> }
510,</span></span>
511<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>
512<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">      model:</span><span style="color:#0A3069;--shiki-dark:#CE9178"> &#x27;claude-sonnet-4-6&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
513<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">      max_tokens:</span><span style="color:#0550AE;--shiki-dark:#B5CEA8"> 1024</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
514<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">      content:</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> userMsg</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
515<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">      tools:</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> toolIds</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
516<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    }),</span></span>
517<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">  });</span></span>
518<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:#1F2328;--shiki-dark:#D4D4D4"> (</span><span style="color:#CF222E;--shiki-dark:#C586C0">await</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> r</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 style="color:#CF222E;--shiki-dark:#C586C0">as</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:#0550AE;--shiki-dark:#4EC9B0"> unknown</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">[] };</span></span>
519<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">  return</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">content</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">;</span></span>
520<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">}</span></span>
521</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>
522<span data-as="p">What happens when the user asks <em>“what plan am I on?”</em> and you pass
523<code>tool_ids=[lookup_account_id]</code>:</span>
524<ol>
525<li>qlaud sends the question + tool definition to Claude</li>
526<li>Claude emits a <code>tool_use</code> block: <code>lookup_account({email: &quot;[email protected]&quot;})</code></li>
527<li>qlaud POSTs to your webhook with the input</li>
528<li>Your handler queries your DB and returns <code>{output: {plan: &quot;pro&quot;, ...}}</code></li>
529<li>qlaud appends a <code>tool_result</code> to the conversation</li>
530<li>Claude reads the tool result and responds: <em>“You’re on the Pro plan…”</em></li>
531<li>You get the final text response</li>
532</ol>
533<span data-as="p">You wrote ~20 lines (one webhook handler). qlaud orchestrated the rest —
534including signature verification, retries on transient failures, parallel
535dispatch when multiple tools fire at once, and persistence of the entire
536dance for audit.</span>
537<h2 class="flex whitespace-pre-wrap group font-semibold" id="step-5-—-search-the-user’s-history"><div class="absolute" tabindex="-1"><a href="#step-5-—-search-the-user’s-history" 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.
537083 13.311 16.083 14.692 14.702L14.702 14.692C16.083 13.311 16.083 11.073 14.702 9.692L13.771 8.761" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M9.50002 11.173C9.85202 11.005 10.182 10.775 10.473 10.483L10.483 10.473C11.864 9.092 11.864 6.854 10.483 5.473L8.30802 3.298C6.92702 1.917 4.68902 1.917 3.30802 3.298L3.29802 3.308C1.91702 4.689 1.91702 6.927 3.29802 8.308L4.22902 9.239" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></div></a></div><span class="cursor-pointer">Step 5 — Search the user’s history</span></h2>
538<span data-as="p">Your end-user wants to find a past conversation: <em>“What did we discuss
539about refunds last week?”</em> No vector DB to provision; semantic search is
540already indexed:</span>
541<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_5hpbb9qnpfb39p7b9snpfiutb_-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_mlhpbb9qnpfb39p7b9snpfiutb_" 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">Python</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_16lhpbb9qnpfb39p7b9snpfiutb_" 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">TypeScript</div></button></div></div></div></div><div class="flex items-center justify-end shrink-0 gap-1.5"><div class="code-block-copy-button z-10 select-none" id="base-ui-_R_1tphpbb9qnpfb39p7b9snpfiutb_" data-base-ui-tooltip-trigger=""><button class="size-6.5 flex items-center justify-center rounded-md group/copy-button [.code-block:not(:has([data-fade-overlay]))_[data-floating-buttons]_&amp;]:bg-gray-100 dark:[.code-block:not(:has([data-fade-overlay]))_[data-floating-buttons]_&amp;]: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 
5411.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></div><div class="flex flex-1 overflow-hidden"><div data-orientation="horizontal" data-activation-direction="none" id="base-ui-_R_6hpbb9qnpfb39p7b9snpfiutb_" 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: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"><div role="presentation" data-id="base-ui-_R_1mhpbb9qnpfb39p7b9snpfiutb_-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="7"><span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">def</span><span style="color:#8250DF;--shiki-dark:#DCDCAA"> search_user_history</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">end_user_id</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0550AE;--shiki-dark:#4EC9B0">str</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#1F2328;--shiki-dark:#9CDCFE">query</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0550AE;--shiki-dark:#4EC9B0">str</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">):</span></span>
542<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    r </span><span style="color:#CF222E;--shiki-dark:#D4D4D4">=</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> requests.get(</span></span>
543<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">        f</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;</span><span style="color:#CF222E;--shiki-dark:#569CD6">{</span><span style="color:#0550AE;--shiki-dark:#D4D4D4">QLAUD</span><span style="color:#CF222E;--shiki-dark:#569CD6">}</span><span style="color:#0A3069;--shiki-dark:#CE9178">/v1/search&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
544<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 style="color:#0A3069;--shiki-dark:#CE9178">&quot;x-api-key&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0550AE;--shiki-dark:#D4D4D4">MASTER</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">},</span></span>
545<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">        params</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">=</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">{</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;q&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: query, </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;end_user_id&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: end_user_id, </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;limit&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0550AE;--shiki-dark:#B5CEA8">10</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">},</span></span>
546<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    ).json()</span></span>
547<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">    return</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> r[</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;data&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">]   </span><span style="color:#6E7781;--shiki-dark:#6A9955"># list of {thread_id, seq, role, snippet, score, created_at}</span></span>
548</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 data-hidden="" data-orientation="horizontal" data-activation-direction="none" hidden="" id="base-ui-_R_ahpbb9qnpfb39p7b9snpfiutb_" 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"><div role="presentation" data-id="base-ui-_R_1qhpbb9qnpfb39p7b9snpfiutb_-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" 
548class="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="19"><span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">export</span><span style="color:#CF222E;--shiki-dark:#569CD6"> async</span><span style="color:#CF222E;--shiki-dark:#569CD6"> function</span><span style="color:#8250DF;--shiki-dark:#DCDCAA"> searchUserHistory</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#953800;--shiki-dark:#9CDCFE">endUserId</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:#953800;--shiki-dark:#9CDCFE">query</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>
549<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">  const</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> url</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> =</span><span style="color:#CF222E;--shiki-dark:#569CD6"> new</span><span style="color:#8250DF;--shiki-dark:#DCDCAA"> URL</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#0A3069;--shiki-dark:#CE9178">`</span><span style="color:#0A3069;--shiki-dark:#569CD6">${</span><span style="color:#0550AE;--shiki-dark:#4FC1FF">QLAUD</span><span style="color:#0A3069;--shiki-dark:#569CD6">}</span><span style="color:#0A3069;--shiki-dark:#CE9178">/v1/search`</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">);</span></span>
550<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">  url</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">searchParams</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#8250DF;--shiki-dark:#DCDCAA">set</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#0A3069;--shiki-dark:#CE9178">&#x27;q&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#1F2328;--shiki-dark:#9CDCFE">query</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">);</span></span>
551<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">  url</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">searchParams</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#8250DF;--shiki-dark:#DCDCAA">set</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#0A3069;--shiki-dark:#CE9178">&#x27;end_user_id&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#1F2328;--shiki-dark:#9CDCFE">endUserId</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">);</span></span>
552<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">  url</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">searchParams</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#8250DF;--shiki-dark:#DCDCAA">set</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#0A3069;--shiki-dark:#CE9178">&#x27;limit&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#0A3069;--shiki-dark:#CE9178">&#x27;10&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">);</span></span>
553<span class="line"></span>
554<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">  const</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> r</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:#1F2328;--shiki-dark:#9CDCFE">url</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:#0A3069;--shiki-dark:#CE9178">&#x27;x-api-key&#x27;</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">:</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> MASTER</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> } });</span></span>
555<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:#1F2328;--shiki-dark:#D4D4D4"> (</span><span style="color:#CF222E;--shiki-dark:#C586C0">await</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> r</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 style="color:#CF222E;--shiki-dark:#C586C0">as</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> {</span></span>
556<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">    data</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">:</span><span style="color:#953800;--shiki-dark:#4EC9B0"> Array</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">&lt;{</span></span>
557<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">      thread_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>
558<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">      seq</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>
559<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">      role</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>
560<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">      snippet</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>
561<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">      score</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>
562<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">      created_at</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>
563<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    }&gt;;</span></span>
564<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">  };</span></span>
565<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">  return</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">data</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">;</span></span>
566<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">}</span></span>
567</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>
568<span data-as="p"><code>end_user_id</code> filter scopes results to ONE of your end-users — they only
569see their own past conversations, never any other customer’s. The
570underlying Vectorize index handles that filter at the metadata layer.</sp
570an>
571<h2 class="flex whitespace-pre-wrap group font-semibold" id="step-6-—-bill-at-month-end"><div class="absolute" tabindex="-1"><a href="#step-6-—-bill-at-month-end" 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.3
57111 16.083 14.692 14.702L14.702 14.692C16.083 13.311 16.083 11.073 14.702 9.692L13.771 8.761" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path><path d="M9.50002 11.173C9.85202 11.005 10.182 10.775 10.473 10.483L10.483 10.473C11.864 9.092 11.864 6.854 10.483 5.473L8.30802 3.298C6.92702 1.917 4.68902 1.917 3.30802 3.298L3.29802 3.308C1.91702 4.689 1.91702 6.927 3.29802 8.308L4.22902 9.239" stroke="currentColor" width="1.5" linecap="round" linejoin="round"></path></svg></div></a></div><span class="cursor-pointer">Step 6 — Bill at month-end</span></h2>
572<span data-as="p">End of month, pull per-key usage and invoice however you want
573(Stripe, Paddle, in-app credits, custom):</span>
574<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_5jpbb9qnpfb39p7b9snpfiutb_-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_mljpbb9qnpfb39p7b9snpfiutb_" 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">Python</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_16ljpbb9qnpfb39p7b9snpfiutb_" 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">TypeScript</div></button></div></div></div></div><div class="flex items-center justify-end shrink-0 gap-1.5"><div class="code-block-copy-button z-10 select-none" id="base-ui-_R_1tpjpbb9qnpfb39p7b9snpfiutb_" data-base-ui-tooltip-trigger=""><button class="size-6.5 flex items-center justify-center rounded-md group/copy-button [.code-block:not(:has([data-fade-overlay]))_[data-floating-buttons]_&amp;]:bg-gray-100 dark:[.code-block:not(:has([data-fade-overlay]))_[data-floating-buttons]_&amp;]: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 
5741.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></div><div class="flex flex-1 overflow-hidden"><div data-orientation="horizontal" data-activation-direction="none" id="base-ui-_R_6jpbb9qnpfb39p7b9snpfiutb_" 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: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"><div role="presentation" data-id="base-ui-_R_1mjpbb9qnpfb39p7b9snpfiutb_-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="21"><span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">from</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> datetime </span><span style="color:#CF222E;--shiki-dark:#C586C0">import</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> datetime, timezone, timedelta</span></span>
575<span class="line"></span>
576<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">def</span><span style="color:#8250DF;--shiki-dark:#DCDCAA"> monthly_bill_run</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">():</span></span>
577<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    now </span><span style="color:#CF222E;--shiki-dark:#D4D4D4">=</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> datetime.now(timezone.utc)</span></span>
578<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    from_ms </span><span style="color:#CF222E;--shiki-dark:#D4D4D4">=</span><span style="color:#0550AE;--shiki-dark:#4EC9B0"> int</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">((now </span><span style="color:#CF222E;--shiki-dark:#D4D4D4">-</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> timedelta(</span><span style="color:#953800;--shiki-dark:#9CDCFE">days</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">=</span><span style="color:#0550AE;--shiki-dark:#B5CEA8">30</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">)).timestamp() </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>
579<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    to_ms </span><span style="color:#CF222E;--shiki-dark:#D4D4D4">=</span><span style="color:#0550AE;--shiki-dark:#4EC9B0"> int</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(now.timestamp() </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>
580<span class="line"></span>
581<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    rollup </span><span style="color:#CF222E;--shiki-dark:#D4D4D4">=</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> requests.get(</span></span>
582<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">        f</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;</span><span style="color:#CF222E;--shiki-dark:#569CD6">{</span><span style="color:#0550AE;--shiki-dark:#D4D4D4">QLAUD</span><span style="color:#CF222E;--shiki-dark:#569CD6">}</span><span style="color:#0A3069;--shiki-dark:#CE9178">/v1/usage&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">,</span></span>
583<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 style="color:#0A3069;--shiki-dark:#CE9178">&quot;x-api-key&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: </span><span style="color:#0550AE;--shiki-dark:#D4D4D4">MASTER</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">},</span></span>
584<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">        params</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">=</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">{</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;from_ms&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: from_ms, </span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;to_ms&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">: to_ms},</span></span>
585<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">    ).json()</span></span>
586<span class="line"></span>
587<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">    for</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> row </span><span style="color:#CF222E;--shiki-dark:#C586C0">in</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> rollup[</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;by_key&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">]:</span></span>
588<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">        end_user </span><span style="color:#CF222E;--shiki-dark:#D4D4D4">=</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> lookup_user_by_qlaud_key_id(row[</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;key_id&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">])</span></span>
589<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">        if</span><span style="color:#CF222E;--shiki-dark:#569CD6"> not</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> end_user:</span></span>
590<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">            continue</span></span>
591<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">        upstream_cost_usd </span><span style="color:#CF222E;--shiki-dark:#D4D4D4">=</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> row[</span><span style="color:#0A3069;--shiki-dark:#CE9178">&quot;cost_micros&quot;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">] </span><span style="color:#CF222E;--shiki-dark:#D4D4D4">/</span><span style="color:#0550AE;--shiki-dark:#B5CEA8"> 1_000_000</span></span>
592<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">        margin </span><span style="color:#CF222E;--shiki-dark:#D4D4D4">=</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> upstream_cost_usd </span><span style="color:#CF222E;--shiki-dark:#D4D4D4">*</span><span style="color:#0550AE;--shiki-dark:#B5CEA8"> 0.50</span><span style="color:#6E7781;--shiki-dark:#6A9955">          # whatever you charge</span></span>
593<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">        bill_usd </span><span style="color:#CF222E;--shiki-dark:#D4D4D4">=</span><span style="color:#0550AE;--shiki-dark:#DCDCAA"> round</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(upstream_cost_usd </span><span style="color:#CF222E;--shiki-dark:#D4D4D4">+</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> margin, </span><span style="color:#0550AE;--shiki-dark:#B5CEA8">4</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">)</span></span>
594<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">        my_billing_tool.charge(end_user, bill_usd)</span></span>
595</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 data-hidden="" data-orientation="horizontal" data-activation-direction="none" hidden="" id="base-ui-_R_ajpbb9qnpfb39p7b9snpfiutb_" 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"><div role="presentation" data-id="base-ui-_R_1qjpbb9qnpfb39p7b9snpfiutb_-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" 
595class="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="22"><span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">export</span><span style="color:#CF222E;--shiki-dark:#569CD6"> async</span><span style="color:#CF222E;--shiki-dark:#569CD6"> function</span><span style="color:#8250DF;--shiki-dark:#DCDCAA"> monthlyBillRun</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">() {</span></span>
596<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">  const</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> now</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> =</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> Date</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#8250DF;--shiki-dark:#DCDCAA">now</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">();</span></span>
597<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">  const</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> fromMs</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> =</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> now</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> -</span><span style="color:#0550AE;--shiki-dark:#B5CEA8"> 30</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> *</span><span style="color:#0550AE;--shiki-dark:#B5CEA8"> 24</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> *</span><span style="color:#0550AE;--shiki-dark:#B5CEA8"> 60</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> *</span><span style="color:#0550AE;--shiki-dark:#B5CEA8"> 60</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>
598<span class="line"></span>
599<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">  const</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> url</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> =</span><span style="color:#CF222E;--shiki-dark:#569CD6"> new</span><span style="color:#8250DF;--shiki-dark:#DCDCAA"> URL</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#0A3069;--shiki-dark:#CE9178">`</span><span style="color:#0A3069;--shiki-dark:#569CD6">${</span><span style="color:#0550AE;--shiki-dark:#4FC1FF">QLAUD</span><span style="color:#0A3069;--shiki-dark:#569CD6">}</span><span style="color:#0A3069;--shiki-dark:#CE9178">/v1/usage`</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">);</span></span>
600<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">  url</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">searchParams</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#8250DF;--shiki-dark:#DCDCAA">set</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#0A3069;--shiki-dark:#CE9178">&#x27;from_ms&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#8250DF;--shiki-dark:#DCDCAA">String</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">fromMs</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">));</span></span>
601<span class="line"><span style="color:#1F2328;--shiki-dark:#9CDCFE">  url</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">searchParams</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#8250DF;--shiki-dark:#DCDCAA">set</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#0A3069;--shiki-dark:#CE9178">&#x27;to_ms&#x27;</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#8250DF;--shiki-dark:#DCDCAA">String</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">now</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">));</span></span>
602<span class="line"></span>
603<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">  const</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> r</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:#1F2328;--shiki-dark:#9CDCFE">url</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:#0A3069;--shiki-dark:#CE9178">&#x27;x-api-key&#x27;</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">:</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> MASTER</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> } });</span></span>
604<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">  const</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> rollup</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> =</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> (</span><span style="color:#CF222E;--shiki-dark:#C586C0">await</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> r</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 style="color:#CF222E;--shiki-dark:#C586C0">as</span><span style="color:#1F2328;--shiki-dark:#D4D4D4"> {</span></span>
605<span class="line"><span style="color:#953800;--shiki-dark:#9CDCFE">    by_key</span><span style="color:#CF222E;--shiki-dark:#D4D4D4">:</span><span style="color:#953800;--shiki-dark:#4EC9B0"> Array</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">&lt;{ </span><span style="color:#953800;--shiki-dark:#9CDCFE">key_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 style="color:#953800;--shiki-dark:#9CDCFE">cost_micros</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:#953800;--shiki-dark:#9CDCFE">request_count</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"> }&gt;;</span></span>
606<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">  };</span></span>
607<span class="line"></span>
608<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"> row</span><span style="color:#CF222E;--shiki-dark:#569CD6"> of</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> rollup</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">by_key</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">) {</span></span>
609<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">    const</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> endUser</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"> lookupUserByQlaudKeyId</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">row</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">key_id</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">);</span></span>
610<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">endUser</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>
611<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">    const</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> upstreamCostUsd</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> =</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> row</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">cost_micros</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> /</span><span style="color:#0550AE;--shiki-dark:#B5CEA8"> 1_000_000</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">;</span></span>
612<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">    const</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> margin</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> =</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> upstreamCostUsd</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> *</span><span style="color:#0550AE;--shiki-dark:#B5CEA8"> 0.5</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">;          </span><span style="color:#6E7781;--shiki-dark:#6A9955">// whatever you charge</span></span>
613<span class="line"><span style="color:#CF222E;--shiki-dark:#569CD6">    const</span><span style="color:#0550AE;--shiki-dark:#4FC1FF"> billUsd</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">upstreamCostUsd</span><span style="color:#CF222E;--shiki-dark:#D4D4D4"> +</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> margin</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">).</span><span style="color:#8250DF;--shiki-dark:#DCDCAA">toFixed</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#0550AE;--shiki-dark:#B5CEA8">4</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">));</span></span>
614<span class="line"><span style="color:#CF222E;--shiki-dark:#C586C0">    await</span><span style="color:#1F2328;--shiki-dark:#9CDCFE"> myBillingTool</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">.</span><span style="color:#8250DF;--shiki-dark:#DCDCAA">charge</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">(</span><span style="color:#1F2328;--shiki-dark:#9CDCFE">endUser</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">, </span><span style="color:#1F2328;--shiki-dark:#9CDCFE">billUsd</span><span style="color:#1F2328;--shiki-dark:#D4D4D4">);</span></span>
615<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">  }</span></span>
616<span class="line"><span style="color:#1F2328;--shiki-dark:#D4D4D4">}</span></span>
617</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>
618<span data-as="p"><code>cost_micros</code> is what qlaud charged YOU (upstream cost × 1.07 markup).
619Whatever margin you put on top of that is yours.</span>
620<h2 class="flex whitespace-pre-wrap group font-semibold" id="what-you-didn’t-build"><div class="absolute" tabindex="-1"><a href="#what-you-didn’t-build" 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.
620083 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">What you didn’t build</span></h2>
621<!-- --><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_l9bb9qnpfb39p7b9snpfiutb_-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;_th]:text-left [&amp;_td[data-numeric]]:tabular-nums [&amp;_td]:min-w-[150px]"><thead><tr><th>If you didn’t have qlaud you’d have written</th><th>Where qlaud handles it</th></tr></thead><tbody><tr><td>Postgres <code>conversations</code> + <code>messages</code> tables</td><td><code>/v1/threads/:id/messages</code> auto-loads history</td></tr><tr><td>”Drop oldest message when context exceeds N tokens”</td><td>History capped automatically; token-aware truncation later</td></tr><tr><td>Tool-call state machine: parse <code>tool_use</code>, dispatch, append <code>tool_result</code>, re-call assistant</td><td><code>runToolLoop</code> — loops up to 8 turns, dispatches in parallel, retries on 5xx</td></tr><tr><td>Embedding pipeline + Pinecone client</td><td>Auto-embed on store, Vectorize-backed <code>/v1/search</code></td></tr><tr><td>Per-user cost attribution table</td><td><code>/v1/usage?by_key</code> rolls up automatically</td></tr><tr><td>Webhook delivery: signing, retries, dedup</td><td>HMAC-SHA256 signing + 3 retries built in</td></tr><tr><td>Streaming SSE handler that ALSO persists the full message after the stream closes</td><td>Tee’d internally — you stream to user, we persist for search</td></tr></tbody></table></div></div></div></div>
622<span data-as="p">Roughly <strong>300–500 lines of glue</strong> per AI app, deleted.</span>
623<h2 class="flex whitespace-pre-wrap group font-semibold" id="next-steps"><div class="absolute" tabindex="-1"><a href="#next-steps" 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.3
62311 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">Next steps</span></h2>
624<ul>
625<li><strong>Switch models per turn</strong> — change <code>model:</code> to <code>gpt-5.4</code> mid-conversation;
626history persists, qlaud translates the shape.</li>
627<li><strong>Use <a class="link" href="/api-reference/jobs">/v1/jobs</a></strong> for long-running batch work that
628shouldn’t block your request thread.</li>
629<li><strong>Parallel tool calls</strong> happen automatically — when the assistant emits
630multiple <code>tool_use</code> blocks, qlaud fans out via <code>Promise.all</code>. No code
631change needed.</li>
632<li><strong>Per-user spend caps</strong> are already enforced gateway-side. Once a user
633hits their <code>max_spend_usd</code> cap, the next request returns 402 before the
634upstream model is ever called.</li>
635</ul>
636<span data-as="p">Need help wiring this into an existing codebase? Email
637<a href="mailto:[email protected]" target="_blank" rel="noreferrer" class="link">[email protected]</a>.</span></div><nav id="pagination" aria-label="Pagination" class="px-0.5 flex items-center gap-6 text-sm font-semibold text-gray-700 dark:text-gray-200"><a rel="prev" aria-label="Previous: Per-user billing" 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="/per-user-billing"><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">Per-user billing</div></a><a rel="next" aria-label="Next: Choosing your API surface" 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="/concepts/api-surfaces"><div class="truncate group-hover:text-gray-900 dark:group-hover:text-white" data-component-part="pagination-title">Choosing your API surface</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 data-assistant-bar="" class="left-0 right-0 sticky bottom-0 w-full overflow-hidden z-20 pointer-events-none print:hidden invisible" aria-hidden="true" inert=""><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-[calc(50%-0.5rem)] sm:before:top-[calc(50%-0.75rem)] before:h-[200px] before:bg-background-light dark:before:bg-background-dark 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/10 focus-within:border-primary dark:focus-within:border-primary-light transition-colors cursor-pointer"><div class="relative flex items-end"><textarea id="chat-assistant-textarea" aria-label="Ask a question..." autoComplete="off" placeholder="Ask a question..." readOnly="" class="chat-assistant-input w-full bg-transparent border-0 peer/input text-gray-900 dark:text-gray-100 placeholder-gray-600 dark:placeholder-gray-300 outline-hidden! focus:outline-hidden! focus:ring-0 py-2.5 pl-3.5 pr-10 font-bodyWeight text-sm" style="resize:none"></textarea><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 dar
637k:border-gray-800/50 pb-28"><div class="flex gap-6 flex-wrap"><a href="https://x.com/qlaud" target="_blank" rel="noopener noreferrer" class="h-fit"><span class="sr-only">x</span><svg class="forced-colors:forced-color-adjust-none forced-colors:bg-[color:CanvasText]! w-5 h-5 bg-gray-400 dark:bg-gray-500 hover:bg-gray-500 dark:hover:bg-gray-400" aria-hidden="true" focusable="false" style="-webkit-mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/brands/x-twitter.svg&quot;);-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-image:url(&quot;https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/brands/x-twitter.svg&quot;);mask-repeat:no-repeat;mask-position:center"></svg></a></div><div class="flex items-center justify-between"><div class="sm:flex"><a href="https://www.mintlify.com?utm_campaign=poweredBy&amp;utm_medium=referral&amp;utm_source=qlaud-866b4636" target="_blank" rel="noreferrer" class="group flex items-baseline gap-1 text-sm text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 text-nowrap"><span>Powered by</span><svg width="1274" height="367" viewBox="0 0 1274 367" fill="none" xmlns="http://www.w3.org/2000/svg" class="h-3.5 w-auto translate-y-0.75"><path d="M1154.38 366.038H1097.86L1137.69 276.14L1058.04 97.1046H1114.93L1161.35 209.337C1162.97 213.26 1168.53 213.253 1170.14 209.325L1216.21 97.1046H1273.49L1154.38 366.038Z" fill="currentColor"></path><path d="M982.714 286.761V142.622H944.403V97.1041H982.714V72.4488C982.714 49.9429 989.542 32.2416 1003.2 19.345C1016.85 6.44832 1034.17 0 1055.16 0C1068.06 0 1079.06 1.39081 1088.16 4.17244V50.0693C1082.09 47.7934 1075.01 46.6555 1066.92 46.6555C1055.54 46.6555 1047.32 49.1843 1042.27 54.2418C1037.21 59.0464 1034.68 67.2648 1034.68 78.8971V97.1041H1088.16V142.622H1034.68V286.761H982.714Z" fill="currentColor"></path><path d="M897.916 66.0005C889.066 66.0005 881.353 62.8395 874.778 56.5176C868.203 49.9429 864.916 42.1037 864.916 33.0002C864.916 23.8967 868.203 16.184 874.778 9.86215C881.353 3.28738 889.066 0 897.916 0C907.273 0 915.112 3.28738 921.434 9.86215C928.008 16.184 931.296 23.8967 931.296 33.0002C931.296 42.1037 928.008 49.9429 921.434 56.5176C915.112 62.8395 907.273 66.0005 897.916 66.0005ZM872.123 286.761V97.1041H924.089V286.761H872.123Z" fill="currentColor"></path><path d="M781.638 286.761V2.27609H833.604V286.761H781.638Z" fill="currentColor"></path><path d="M722.934 289.037C701.693 289.037 684.244 283.221 670.589 271.588C657.187 259.703 650.485 242.634 650.485 220.381V142.622H612.175V97.1044H650.485V44.3799H702.451V97.1044H755.934V142.622H702.451V210.14C702.451 221.772 704.98 230.117 710.038 235.174C715.095 239.979 723.313 242.381 734.693 242.381C742.785 242.381 749.865 241.243 755.934 238.967V284.864C746.831 287.646 735.831 289.037 722.934 289.037Z" fill="currentColor"></path><path d="M417.674 286.761V97.1041H469.64V110.967C469.64 113.311 472.83 114.347 474.382 112.591C485.967 99.4848 502.467 92.9317 523.881 92.9317C546.64 92.9317 564.468 100.518 577.365 115.69C590.514 130.61 597.089 150.587 597.089 175.622V286.761H545.123V184.346C545.123 170.438 542.215 159.691 536.399 152.105C530.583 144.265 522.364 140.346 511.743 140.346C499.1 140.346 488.858 144.898 481.019 154.001C473.433 163.105 469.64 176.507 469.64 194.208V286.761H417.674Z" fill="currentColor"></path><path d="M352.981 66.0005C344.13 66.0005 336.417 62.8395 329.843 56.5176C323.268 49.9429 319.98 42.1037 319.98 33.0002C319.98 23.8967 323.268 16.184 329.843 9.86215C336.417 3.28738 344.13 0 352.981 0C362.337 0 370.176 3.28738 376.498 9.86215C383.073 16.184 386.36 23.8967 386.36 33.0002C386.36 42.1037 383.073 49.9429 376.498 56.5176C370.176 62.8395 362.337 66.0005 352.981 66.0005ZM327.187 286.761V97.1041H379.153V286.761H327.187Z" fill="currentColor"></path><path d="M238.967 286.761V185.484C238.967 155.392 229.105 140.346 209.381 140.346C198.001 140.346 188.898 144.645 182.07 153.242C175.495 161.84 171.955 174.61 171.449 191.553V286.761H119.484V185.484C119.484 155.392 109.621 140.346 89.8972 140.346C78.2649 140.346 69.035 144.898 62.2073 154.001C55.3797 163.105 51.9659 176.507 51.9659 194.208V286.761H0V97.104
6371H51.9659V111.103C51.9659 113.435 55.1014 114.462 56.633 112.704C68.1136 99.5223 83.3741 92.9317 102.415 92.9317C127.436 92.9317 146.283 103.262 158.953 123.923C159.953 125.553 162.412 125.527 163.406 123.894C168.884 114.891 176.496 107.731 186.243 102.415C197.369 96.0926 208.622 92.9317 220.002 92.9317C242.507 92.9317 259.956 100.392 272.347 115.311C284.738 130.231 290.933 150.714 290.933 176.76V286.761H238.967Z" fill="currentColor"></path></svg><span class="sr-only">This documentation is built and hosted on Mintlify, a developer documentation platform</span></a></div></div></footer></div></div></main></div><!--$--><!--/$--></div></div></div>
637<script src="/mintlify-assets/_next/static/chunks/3fcb76f539c93820.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP" id="_R_" async=""></script>
637<script>(self.__next_f=self.__next_f||[]).push([0])</script>
637<script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\nb:I[168027,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"default\"]\n:HL[\"/mintlify-assets/_next/static/chunks/462bacc63bed9960.css?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"style\"]\n:HL[\"/mintlify-assets/_next/static/chunks/663a923474cdb1e6.css?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"style\"]\n:HL[\"/mintlify-assets/_next/static/media/83afe278b6a6bb3c.p.3a6ba036.woff2\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff2\"}]\n:HL[\"/mintlify-assets/_next/static/media/PaperMono_Variable.p.aa32f7a0.woff2\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff2\"}]\n:HL[\"/mintlify-assets/_next/static/media/f67ad414ed34149c.p.84166d94.woff2\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff2\"}]\n"])</script>
637<script>self.__next_f.push([1,"0:{\"P\":null,\"b\":\"rqYbFb6eANFKMxK-ethr5\",\"p\":\"/mintlify-assets\",\"c\":[\"\",\"_sites\",\"qlaud-866b4636\",\"guides\",\"build-a-chat-app\"],\"i\":false,\"f\":[[[\"\",{\"children\":[\"%5Fsites\",{\"children\":[[\"subdomain\",\"qlaud-866b4636\",\"d\"],{\"children\":[\"(multitenant)\",{\"children\":[[\"slug\",\"guides/build-a-chat-app\",\"oc\"],{\"children\":[\"__PAGE__\",{}]}]}]}]}]},\"$undefined\",\"$undefined\",true],[\"\",[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/mintlify-assets/_next/static/chunks/462bacc63bed9960.css?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}],[\"$\",\"link\",\"1\",{\"rel\":\"stylesheet\",\"href\":\"/mintlify-assets/_next/static/chunks/663a923474cdb1e6.css?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-0\",{\"src\":\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-1\",{\"src\":\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"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=\\\"\\\";\\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\":\"(() =\u003e {\\n  const isIOS =\\n    /iP(hone|ad|od)/.test(navigator.userAgent) ||\\n    (/Macintosh/.test(navigator.userAgent) \u0026\u0026 navigator.maxTouchPoints \u003e 1);\\n  if (!isIOS) return;\\n  const apply = () =\u003e {\\n    for (const meta of document.querySelectorAll('meta[name=\\\"viewport\\\"]')) {\\n      const content = meta.getAttribute('content') || '';\\n      if (!content.includes('maximum-scale')) {\\n        meta.setAttribute('content', content + ', maximum-scale=1');\\n      }\\n    }\\n  };\\n  apply();\\n  new MutationObserver(apply).observe(document.head, {\\n    childList: true,\\n    subtree: true,\\n    attributes: true,\\n    attributeFilter: ['content'],\\n  });\\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){}}();\"}}],\"$L2\",\"$L3\",false]}],\"$L4\"]}]]}],{\"children\":[\"%5Fsites\",\"$L5\",{\"children\":[[\"subdomain\",\"qlaud-866b4636\",\"d\"],\"$L6\",{\"children\":[\"(multitenant)\",\"$L7\",{\"children\":[[\"slug\",\"guides/build-a-chat-app\",\"oc\"],\"$L8\",{\"children\":[\"__PAGE__\",\"$L9\",{}
637,null,false]},null,false]},null,false]},null,false]},null,false]},null,false],\"$La\",false]],\"m\":\"$undefined\",\"G\":[\"$b\",[\"$Lc\",\"$Ld\"]],\"s\":false,\"S\":true}\n"])</script>
637<script>self.__next_f.push([1,"e:I[667786,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"MintlifyApiPlaygroundInputsInit\"]\nf:I[339756,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"default\"]\n10:I[556357,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8da4eea58a747cb5.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c50d793b8f34b10b.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/54f6583600c307fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8d0901e40ed4b058.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"default\"]\n11:I[837457,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"default\"]\n"])</script>
637<script>self.__next_f.push([1,"12:I[894587,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/343f3c7f568a2e5d.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c50d793b8f34b10b.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/ccee8d9b3189ccd9.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/54f6583600c307fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3b847e5370bd724e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/4fa3ca58dfaaeff8.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8d0901e40ed4b058.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/468295ca52ed5c09.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3f8f2653ff1ad14e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/da953b59c0c41f06.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/f0ef0acaeece4a23.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/7538d80a516400fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8a19ec8c194a3b47.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/589b24301b3a37b4.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/d2fedac44d815262.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c3a3ab2374198660.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/de5d31edef447a03.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/6fb38247c19b3981.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8176871b020d7070.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"ThemeProvider\"]\n"])</script>
637<script>self.__next_f.push([1,"13:I[152823,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/343f3c7f568a2e5d.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c50d793b8f34b10b.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/ccee8d9b3189ccd9.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/54f6583600c307fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3b847e5370bd724e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/4fa3ca58dfaaeff8.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8d0901e40ed4b058.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/468295ca52ed5c09.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3f8f2653ff1ad14e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/da953b59c0c41f06.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/f0ef0acaeece4a23.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/7538d80a516400fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8a19ec8c194a3b47.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/589b24301b3a37b4.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/d2fedac44d815262.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c3a3ab2374198660.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/de5d31edef447a03.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/6fb38247c19b3981.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8176871b020d7070.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"ColorVariables\"]\n"])</script>
637<script>self.__next_f.push([1,"14:I[531961,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/343f3c7f568a2e5d.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c50d793b8f34b10b.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/ccee8d9b3189ccd9.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/54f6583600c307fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3b847e5370bd724e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/4fa3ca58dfaaeff8.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8d0901e40ed4b058.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/468295ca52ed5c09.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3f8f2653ff1ad14e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/da953b59c0c41f06.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/f0ef0acaeece4a23.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/7538d80a516400fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8a19ec8c194a3b47.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/589b24301b3a37b4.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/d2fedac44d815262.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c3a3ab2374198660.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/de5d31edef447a03.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/6fb38247c19b3981.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8176871b020d7070.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"FontScript\"]\n"])</script>
637<script>self.__next_f.push([1,"15:I[649328,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/343f3c7f568a2e5d.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c50d793b8f34b10b.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/ccee8d9b3189ccd9.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/54f6583600c307fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3b847e5370bd724e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/4fa3ca58dfaaeff8.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8d0901e40ed4b058.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/468295ca52ed5c09.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3f8f2653ff1ad14e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/da953b59c0c41f06.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/f0ef0acaeece4a23.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/7538d80a516400fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8a19ec8c194a3b47.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/589b24301b3a37b4.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/d2fedac44d815262.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c3a3ab2374198660.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/de5d31edef447a03.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/6fb38247c19b3981.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8176871b020d7070.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"RoundedVariables\"]\n"])</script>
637<script>self.__next_f.push([1,"16:I[702910,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c8150bdcfb731039.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c50d793b8f34b10b.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/54f6583600c307fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8d0901e40ed4b058.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"RecommendedPagesList\"]\n17:I[570420,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"DataCurrentPathUpdater\"]\n18:I[341175,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8972ae3ec1dd1025.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c50d793b8f34b10b.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/54f6583600c307fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8d0901e40ed4b058.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"default\"]\n1b:I[897367,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"OutletBoundary\"]\n1d:I[711533,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"AsyncMetadataOutlet\"]\n1f:I[897367,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1"])</script>
637<script>self.__next_f.push([1,"e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"ViewportBoundary\"]\n21:I[897367,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"MetadataBoundary\"]\n22:\"$Sreact.suspense\"\n2:[\"$\",\"script\",null,{\"type\":\"text/javascript\",\"dangerouslySetInnerHTML\":{\"__html\":\"(function(){\\nif(typeof CSS===\\\"undefined\\\"||!(\\\"registerProperty\\\" in CSS))return;\\nif(CSS.supports\u0026\u0026CSS.supports(\\\"-webkit-backdrop-filter:none\\\"))return;\\nvar n=[\\\"--scroll-area-overflow-x-start\\\",\\\"--scroll-area-overflow-x-end\\\",\\\"--scroll-area-overflow-y-start\\\",\\\"--scroll-area-overflow-y-end\\\"];\\nvar d={\\\"syntax\\\":\\\"\u003clength\u003e\\\",\\\"inherits\\\":false,\\\"initialValue\\\":\\\"0px\\\"};\\nfor(var i=0;i\u003cn.length;i++){try{CSS.registerProperty({name:n[i],syntax:d.syntax,inherits:d.inherits,initialValue:d.initialValue})}catch(e){}}\\n})();\"}}]\n"])</script>
637<script>self.__next_f.push([1,"3:[\"$\",\"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)\"}}]\n"])</script>
637<script>self.__next_f.push([1,"4:[\"$\",\"body\",null,{\"className\":\"antialiased\",\"children\":[[\"$\",\"$Le\",null,{}],false,[\"$\",\"$Lf\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$10\",\"errorStyles\":[],\"errorScripts\":[[\"$\",\"script\",\"script-0\",{\"src\":\"/mintlify-assets/_next/static/chunks/8da4eea58a747cb5.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"async\":true}],[\"$\",\"script\",\"script-1\",{\"src\":\"/mintlify-assets/_next/static/chunks/c50d793b8f34b10b.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"async\":true}],[\"$\",\"script\",\"script-2\",{\"src\":\"/mintlify-assets/_next/static/chunks/54f6583600c307fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"async\":true}],[\"$\",\"script\",\"script-3\",{\"src\":\"/mintlify-assets/_next/static/chunks/8d0901e40ed4b058.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"async\":true}]],\"template\":[\"$\",\"$L11\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[\"$\",\"$L12\",null,{\"children\":[[\"$\",\"$L13\",null,{}],[\"$\",\"$L14\",null,{}],[\"$\",\"$L15\",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.\"}],[\"$\",\"$L16\",null,{}]]}]}]}]]}],[]],\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}],false,[\"$\",\"$L17\",null,{}]]}]\n"])</script>
637<script>self.__next_f.push([1,"5:[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$Lf\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L11\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}]\n"])</script>
637<script>self.__next_f.push([1,"6:[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$Lf\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$18\",\"errorStyles\":[],\"errorScripts\":[[\"$\",\"script\",\"script-0\",{\"src\":\"/mintlify-assets/_next/static/chunks/8972ae3ec1dd1025.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"async\":true}],[\"$\",\"script\",\"script-1\",{\"src\":\"/mintlify-assets/_next/static/chunks/c50d793b8f34b10b.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"async\":true}],[\"$\",\"script\",\"script-2\",{\"src\":\"/mintlify-assets/_next/static/chunks/54f6583600c307fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"async\":true}],[\"$\",\"script\",\"script-3\",{\"src\":\"/mintlify-assets/_next/static/chunks/8d0901e40ed4b058.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"async\":true}]],\"template\":[\"$\",\"$L11\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[\"$\",\"$L12\",null,{\"children\":[[\"$\",\"$L13\",null,{}],[\"$\",\"$L14\",null,{}],[\"$\",\"$L15\",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.\"}],[\"$\",\"$L16\",null,{}]]}]}]}]]}],[]],\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}]\n"])</script>
637<script>self.__next_f.push([1,"7:[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"script\",\"script-0\",{\"src\":\"/mintlify-assets/_next/static/chunks/343f3c7f568a2e5d.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-1\",{\"src\":\"/mintlify-assets/_next/static/chunks/c50d793b8f34b10b.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-2\",{\"src\":\"/mintlify-assets/_next/static/chunks/ccee8d9b3189ccd9.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-3\",{\"src\":\"/mintlify-assets/_next/static/chunks/54f6583600c307fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-4\",{\"src\":\"/mintlify-assets/_next/static/chunks/3b847e5370bd724e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-5\",{\"src\":\"/mintlify-assets/_next/static/chunks/4fa3ca58dfaaeff8.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-6\",{\"src\":\"/mintlify-assets/_next/static/chunks/8d0901e40ed4b058.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-7\",{\"src\":\"/mintlify-assets/_next/static/chunks/468295ca52ed5c09.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-8\",{\"src\":\"/mintlify-assets/_next/static/chunks/3f8f2653ff1ad14e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-9\",{\"src\":\"/mintlify-assets/_next/static/chunks/da953b59c0c41f06.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-10\",{\"src\":\"/mintlify-assets/_next/static/chunks/f0ef0acaeece4a23.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-11\",{\"src\":\"/mintlify-assets/_next/static/chunks/7538d80a516400fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-12\",{\"src\":\"/mintlify-assets/_next/static/chunks/8a19ec8c194a3b47.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-13\",{\"src\":\"/mintlify-assets/_next/static/chunks/589b24301b3a37b4.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-14\",{\"src\":\"/mintlify-assets/_next/static/chunks/d2fedac44d815262.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-15\",{\"src\":\"/mintlify-assets/_next/static/chunks/c3a3ab2374198660.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-16\",{\"src\":\"/mintlify-assets/_next/static/chunks/de5d31edef447a03.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-17\",{\"src\":\"/mintlify-assets/_next/static/chunks/6fb38247c19b3981.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-18\",{\"src\":\"/mintlify-assets/_next/static/chunks/8176871b020d7070.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"async\":true,\"nonce\":\"$undefined\"}]],\"$L19\"]}]\n"])</script>
637<script>self.__next_f.push([1,"8:[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$Lf\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L11\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}]\n"])</script>
637<script>self.__next_f.push([1,"9:[\"$\",\"$1\",\"c\",{\"children\":[\"$L1a\",[[\"$\",\"script\",\"script-0\",{\"src\":\"/mintlify-assets/_next/static/chunks/9db9880c49eded60.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-1\",{\"src\":\"/mintlify-assets/_next/static/chunks/41c8239ff6030cd1.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-2\",{\"src\":\"/mintlify-assets/_next/static/chunks/e452a5c043e34035.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-3\",{\"src\":\"/mintlify-assets/_next/static/chunks/fde44643dbef1bcd.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-4\",{\"src\":\"/mintlify-assets/_next/static/chunks/c58283ba69dd38df.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-5\",{\"src\":\"/mintlify-assets/_next/static/chunks/e5dcdb55f621f74a.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-6\",{\"src\":\"/mintlify-assets/_next/static/chunks/1a0bf1d33a977db0.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"async\":true,\"nonce\":\"$undefined\"}]],[\"$\",\"$L1b\",null,{\"children\":[\"$L1c\",[\"$\",\"$L1d\",null,{\"promise\":\"$@1e\"}]]}]]}]\n"])</script>
637<script>self.__next_f.push([1,"a:[\"$\",\"$1\",\"h\",{\"children\":[null,[[\"$\",\"$L1f\",null,{\"children\":\"$L20\"}],null],[\"$\",\"$L21\",null,{\"children\":[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$22\",null,{\"fallback\":null,\"children\":\"$L23\"}]}]}]]}]\nc:[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/mintlify-assets/_next/static/chunks/462bacc63bed9960.css?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}]\nd:[\"$\",\"link\",\"1\",{\"rel\":\"stylesheet\",\"href\":\"/mintlify-assets/_next/static/chunks/663a923474cdb1e6.css?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}]\n"])</script>
637<script>self.__next_f.push([1,"20:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1, viewport-fit=cover\"}]]\n1c:null\n"])</script>
637<script>self.__next_f.push([1,"1e:{\"metadata\":[[\"$\",\"title\",\"0\",{\"children\":\"Build a chat app on qlaud - qlaud\"}],[\"$\",\"meta\",\"1\",{\"name\":\"description\",\"content\":\"End-to-end tutorial: per-user threads, tool integration, semantic search, streaming UX, and per-end-user billing — no Postgres, no vector DB, no message store of your own.\"}],[\"$\",\"meta\",\"2\",{\"name\":\"application-name\",\"content\":\"qlaud\"}],[\"$\",\"meta\",\"3\",{\"name\":\"generator\",\"content\":\"Mintlify\"}],[\"$\",\"meta\",\"4\",{\"name\":\"msapplication-config\",\"content\":\"/mintlify-assets/_mintlify/favicons/qlaud-866b4636/WhlyAxxbPJFJDpk8/_generated/favicon/browserconfig.xml\"}],[\"$\",\"meta\",\"5\",{\"name\":\"apple-mobile-web-app-title\",\"content\":\"qlaud\"}],[\"$\",\"meta\",\"6\",{\"name\":\"msapplication-TileColor\",\"content\":\"#dc2626\"}],[\"$\",\"link\",\"7\",{\"rel\":\"canonical\",\"href\":\"https://docs.qlaud.ai/guides/build-a-chat-app\"}],[\"$\",\"link\",\"8\",{\"rel\":\"alternate\",\"type\":\"application/xml\",\"href\":\"/sitemap.xml\"}],[\"$\",\"link\",\"9\",{\"rel\":\"alternate\",\"type\":\"text/markdown\",\"href\":\"/guides/build-a-chat-app.md\"}],[\"$\",\"meta\",\"10\",{\"property\":\"og:title\",\"content\":\"Build a chat app on qlaud - qlaud\"}],[\"$\",\"meta\",\"11\",{\"property\":\"og:description\",\"content\":\"End-to-end tutorial: per-user threads, tool integration, semantic search, streaming UX, and per-end-user billing — no Postgres, no vector DB, no message store of your own.\"}],[\"$\",\"meta\",\"12\",{\"property\":\"og:url\",\"content\":\"https://docs.qlaud.ai/guides/build-a-chat-app\"}],[\"$\",\"meta\",\"13\",{\"property\":\"og:site_name\",\"content\":\"qlaud\"}],[\"$\",\"meta\",\"14\",{\"property\":\"og:image\",\"content\":\"https://qlaud-866b4636.mintlify.app/mintlify-assets/_next/image?url=%2F_mintlify%2Fapi%2Fog%3Fdivision%3DTutorials%26title%3DBuild%2Ba%2Bchat%2Bapp%2Bon%2Bqlaud%26description%3DEnd-to-end%2Btutorial%253A%2Bper-user%2Bthreads%252C%2Btool%2Bintegration%252C%2Bsemantic%2Bsearch%252C%2Bstreaming%2BUX%252C%2Band%2Bper-end-user%2Bbilling%2B%25E2%2580%2594%2Bno%2BPostgres%252C%2Bno%2Bvector%2BDB%252C%2Bno%2Bmessage%2Bstore%2Bo%26theme%3Da40b06849626ca03336317c0\u0026w=1200\u0026q=100\"}],[\"$\",\"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\":\"Build a chat app on qlaud - qlaud\"}],[\"$\",\"meta\",\"20\",{\"name\":\"twitter:description\",\"content\":\"End-to-end tutorial: per-user threads, tool integration, semantic search, streaming UX, and per-end-user billing — no Postgres, no vector DB, no message store of your own.\"}],[\"$\",\"meta\",\"21\",{\"name\":\"twitter:image\",\"content\":\"https://qlaud-866b4636.mintlify.app/mintlify-assets/_next/image?url=%2F_mintlify%2Fapi%2Fog%3Fdivision%3DTutorials%26title%3DBuild%2Ba%2Bchat%2Bapp%2Bon%2Bqlaud%26description%3DEnd-to-end%2Btutorial%253A%2Bper-user%2Bthreads%252C%2Btool%2Bintegration%252C%2Bsemantic%2Bsearch%252C%2Bstreaming%2BUX%252C%2Band%2Bper-end-user%2Bbilling%2B%25E2%2580%2594%2Bno%2BPostgres%252C%2Bno%2Bvector%2BDB%252C%2Bno%2Bmessage%2Bstore%2Bo%26theme%3Da40b06849626ca03336317c0\u0026w=1200\u0026q=100\"}],[\"$\",\"meta\",\"22\",{\"name\":\"twitter:image:width\",\"content\":\"1200\"}],[\"$\",\"meta\",\"23\",{\"name\":\"twitter:image:height\",\"content\":\"630\"}],[\"$\",\"link\",\"24\",{\"rel\":\"icon\",\"href\":\"/mintlify-assets/_mintlify/favicons/qlaud-866b4636/WhlyAxxbPJFJDpk8/_generated/favicon/android-chrome-192x192.png\",\"type\":\"image/png\",\"sizes\":\"192x192\",\"media\":\"(prefers-color-scheme: light)\"}],[\"$\",\"link\",\"25\",{\"rel\":\"apple-touch-icon\",\"href\":\"/mintlify-assets/_mintlify/favicons/qlaud-866b4636/WhlyAxxbPJFJDpk8/_generated/favicon/apple-touch-icon.png\",\"type\":\"image/png\",\"sizes\":\"180x180\",\"media\":\"$undefined\"}],[\"$\",\"link\",\"26\",{\"rel\":\"icon\",\"href\":\"/mintlify-assets/_mintlify/favicons/qlaud-866b4636/WhlyAxxbPJFJDpk8/_generated/favicon/favicon-16x16.png\",\"type\":\"image/png\",\"sizes\":\"16x16\",\"media\":\"(prefers-color-scheme: light)\"}],\"$L24\",\"$L25\",\"$L26\",\"$L27\",\"$L28\",\"$L29\",\"$L2a\"],\"error\":null,\"digest\":\"$undefined\"}\n"])</script>
637<script>self.__next_f.push([1,"23:\"$1e:metadata\"\n"])</script>
637<script>self.__next_f.push([1,"2b:I[27201,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"IconMark\"]\n24:[\"$\",\"link\",\"27\",{\"rel\":\"icon\",\"href\":\"/mintlify-assets/_mintlify/favicons/qlaud-866b4636/WhlyAxxbPJFJDpk8/_generated/favicon/favicon-32x32.png\",\"type\":\"image/png\",\"sizes\":\"32x32\",\"media\":\"(prefers-color-scheme: light)\"}]\n25:[\"$\",\"link\",\"28\",{\"rel\":\"shortcut icon\",\"href\":\"/mintlify-assets/_mintlify/favicons/qlaud-866b4636/WhlyAxxbPJFJDpk8/_generated/favicon/favicon.ico\",\"type\":\"image/x-icon\",\"sizes\":\"$undefined\",\"media\":\"(prefers-color-scheme: light)\"}]\n26:[\"$\",\"link\",\"29\",{\"rel\":\"icon\",\"href\":\"/mintlify-assets/_mintlify/favicons/qlaud-866b4636/WhlyAxxbPJFJDpk8/_generated/favicon-dark/android-chrome-192x192.png\",\"type\":\"image/png\",\"sizes\":\"192x192\",\"media\":\"(prefers-color-scheme: dark)\"}]\n27:[\"$\",\"link\",\"30\",{\"rel\":\"icon\",\"href\":\"/mintlify-assets/_mintlify/favicons/qlaud-866b4636/WhlyAxxbPJFJDpk8/_generated/favicon-dark/favicon-16x16.png\",\"type\":\"image/png\",\"sizes\":\"16x16\",\"media\":\"(prefers-color-scheme: dark)\"}]\n28:[\"$\",\"link\",\"31\",{\"rel\":\"icon\",\"href\":\"/mintlify-assets/_mintlify/favicons/qlaud-866b4636/WhlyAxxbPJFJDpk8/_generated/favicon-dark/favicon-32x32.png\",\"type\":\"image/png\",\"sizes\":\"32x32\",\"media\":\"(prefers-color-scheme: dark)\"}]\n29:[\"$\",\"link\",\"32\",{\"rel\":\"shortcut icon\",\"href\":\"/mintlify-assets/_mintlify/favicons/qlaud-866b4636/WhlyAxxbPJFJDpk8/_generated/favicon-dark/favicon.ico\",\"type\":\"image/x-icon\",\"sizes\":\"$undefined\",\"media\":\"(prefers-color-scheme: dark)\"}]\n2a:[\"$\",\"$L2b\",\"33\",{}]\n"])</script>
637<script>self.__next_f.push([1,"2c:I[590280,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/343f3c7f568a2e5d.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c50d793b8f34b10b.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/ccee8d9b3189ccd9.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/54f6583600c307fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3b847e5370bd724e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/4fa3ca58dfaaeff8.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8d0901e40ed4b058.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/468295ca52ed5c09.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3f8f2653ff1ad14e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/da953b59c0c41f06.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/f0ef0acaeece4a23.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/7538d80a516400fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8a19ec8c194a3b47.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/589b24301b3a37b4.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/d2fedac44d815262.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c3a3ab2374198660.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/de5d31edef447a03.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/6fb38247c19b3981.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8176871b020d7070.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"LivePreviewProvider\"]\n"])</script>
637<script>self.__next_f.push([1,"2d:I[973254,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/343f3c7f568a2e5d.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c50d793b8f34b10b.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/ccee8d9b3189ccd9.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/54f6583600c307fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3b847e5370bd724e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/4fa3ca58dfaaeff8.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8d0901e40ed4b058.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/468295ca52ed5c09.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3f8f2653ff1ad14e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/da953b59c0c41f06.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/f0ef0acaeece4a23.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/7538d80a516400fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8a19ec8c194a3b47.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/589b24301b3a37b4.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/d2fedac44d815262.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c3a3ab2374198660.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/de5d31edef447a03.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/6fb38247c19b3981.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8176871b020d7070.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"LivePreviewFavicon\"]\n"])</script>
637<script>self.__next_f.push([1,"2e:I[197336,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/343f3c7f568a2e5d.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c50d793b8f34b10b.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/ccee8d9b3189ccd9.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/54f6583600c307fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3b847e5370bd724e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/4fa3ca58dfaaeff8.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8d0901e40ed4b058.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/468295ca52ed5c09.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3f8f2653ff1ad14e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/da953b59c0c41f06.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/f0ef0acaeece4a23.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/7538d80a516400fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8a19ec8c194a3b47.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/589b24301b3a37b4.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/d2fedac44d815262.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c3a3ab2374198660.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/de5d31edef447a03.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/6fb38247c19b3981.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8176871b020d7070.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"default\"]\n"])</script>
637<script>self.__next_f.push([1,"2f:I[91557,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/343f3c7f568a2e5d.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c50d793b8f34b10b.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/ccee8d9b3189ccd9.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/54f6583600c307fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3b847e5370bd724e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/4fa3ca58dfaaeff8.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8d0901e40ed4b058.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/468295ca52ed5c09.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3f8f2653ff1ad14e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/da953b59c0c41f06.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/f0ef0acaeece4a23.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/7538d80a516400fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8a19ec8c194a3b47.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/589b24301b3a37b4.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/d2fedac44d815262.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c3a3ab2374198660.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/de5d31edef447a03.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/6fb38247c19b3981.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8176871b020d7070.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/9db9880c49eded60.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/41c8239ff6030cd1.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/e452a5c043e34035.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/fde44643dbef1bcd.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c58283ba69dd38df.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/e5dcdb55f621f74a.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1a0bf1d33a977db0.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"AuthProvider\"]\n"])</script>
637<script>self.__next_f.push([1,"30:I[91557,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/343f3c7f568a2e5d.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c50d793b8f34b10b.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/ccee8d9b3189ccd9.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/54f6583600c307fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3b847e5370bd724e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/4fa3ca58dfaaeff8.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8d0901e40ed4b058.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/468295ca52ed5c09.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3f8f2653ff1ad14e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/da953b59c0c41f06.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/f0ef0acaeece4a23.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/7538d80a516400fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8a19ec8c194a3b47.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/589b24301b3a37b4.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/d2fedac44d815262.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c3a3ab2374198660.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/de5d31edef447a03.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/6fb38247c19b3981.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8176871b020d7070.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/9db9880c49eded60.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/41c8239ff6030cd1.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/e452a5c043e34035.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/fde44643dbef1bcd.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c58283ba69dd38df.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/e5dcdb55f621f74a.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1a0bf1d33a977db0.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"DeploymentMetadataProvider\"]\n"])</script>
637<script>self.__next_f.push([1,"31:I[91557,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/343f3c7f568a2e5d.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c50d793b8f34b10b.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/ccee8d9b3189ccd9.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/54f6583600c307fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3b847e5370bd724e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/4fa3ca58dfaaeff8.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8d0901e40ed4b058.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/468295ca52ed5c09.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3f8f2653ff1ad14e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/da953b59c0c41f06.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/f0ef0acaeece4a23.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/7538d80a516400fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8a19ec8c194a3b47.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/589b24301b3a37b4.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/d2fedac44d815262.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c3a3ab2374198660.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/de5d31edef447a03.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/6fb38247c19b3981.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8176871b020d7070.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/9db9880c49eded60.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/41c8239ff6030cd1.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/e452a5c043e34035.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/fde44643dbef1bcd.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c58283ba69dd38df.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/e5dcdb55f621f74a.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1a0bf1d33a977db0.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"DocsConfigProvider\"]\n"])</script>
637<script>self.__next_f.push([1,"19:[[\"$\",\"script\",null,{\"type\":\"application/ld+json\",\"dangerouslySetInnerHTML\":{\"__html\":\"{\\\"@context\\\":\\\"https://schema.org\\\",\\\"@type\\\":\\\"WebSite\\\",\\\"name\\\":\\\"qlaud\\\",\\\"creator\\\":{\\\"@type\\\":\\\"Organization\\\",\\\"name\\\":\\\"Mintlify\\\",\\\"url\\\":\\\"https://mintlify.com\\\"}}\"}}],false,[\"$\",\"$L2c\",null,{\"isLivePreviewRoute\":false,\"children\":[[\"$\",\"$L2d\",null,{}],[\"$\",\"$L12\",null,{\"appearance\":\"$undefined\",\"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\":\"/llms.txt\",\"tabIndex\":-1,\"children\":\"/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}\"}}],null,null,[\"$\",\"script\",null,{\"id\":\"_mintlify-banner-script\",\"dangerouslySetInnerHTML\":{\"__html\":\"(function i(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)\"},\"suppressHydrationWarning\":true}],[\"$\",\"$L2e\",null,{\"appId\":\"$undefined\",\"autoBoot\":true,\"children\":[\"$\",\"$L2f\",null,{\"value\":{\"auth\":\"$undefined\",\"userAuth\":\"$undefined\"},\"children\":[\"$\",\"$L30\",null,{\"value\":{\"subdomain\":\"qlaud-866b4636\",\"hasAudioNarration\":false,\"actualSubdomain\":\"qlaud-866b4636\",\"customDomains\":[\"docs.qlaud.ai\"],\"gitSource\":{\"type\":\"github\",\"owner\":\"qlaudai\",\"repo\":\"docs\",\"deployBranch\":\"main\",\"contentDirectory\":\"\",\"isPrivate\":true,\"mountPath\":\"\",\"label\":\"\"},\"chroma\":{\"liveDeploymentHistoryId\":\"6a21ddb7ac32c8aaa6f52031\",\"collectionId\":\"bb82fdb3-ac87-4bc7-97ca-cfe12826e06b\",\"schemaVersion\":\"v2\"},\"feedback\":\"$undefined\",\"entitlements\":{\"AI_CHAT\":{\"status\":\"DISABLED\"}},\"buildId\":\"6a21ddb7ac32c8aaa6f52031:success\",\"clientVersion\":\"0.0.3777\",\"preview\":\"$undefined\",\"searchFilterCounts\":[{\"language\":\"default\",\"tag\":\"API Reference\",\"count\":13},{\"language\":\"default\",\"tag\":\"Guides\",\"count\":11},{\"language\":\"default\",\"tag\":\"Substrate\",\"count\":9},{\"language\":\"default\",\"tag\":\"Concepts\",\"count\":4},{\"language\":\"default\",\"tag\":\"Integrations\",\"count\":3},{\"language\":\"default\",\"tag\":\"Get started\",\"count\":3},{\"language\":\"default\",\"tag\":\"Inference\",\"count\":2},{\"language\":\"default\",\"tag\":\"Account\",\"count\":2},{\"language\":\"default\",\"tag\":\"Tutorials\",\"count\":1}],\"searchSettings\":\"$undefined\",\"disableKonamiCode\":\"$undefined\"},\"children\":[\"$\",\"$L31\",null,{\"value\":{\"docsConfig\":{\"theme\":\"mint\",\"$schema\":\"https://mintlify.com/docs.json\",\"name\":\"qlaud\",\"description\":\"Mint a key per user. Cap their spend. Get paid. The billing layer for AI apps.\",\"colors\":{\"primary\":\"#dc2626\",\"light\":\"#ef4444\",\"dark\":\"#b91c1c\"},\"logo\":{\"light\":\"https://mintcdn.com/qlaud-866b4636/irr8qn1NjuWyoP5V/logo/light.svg?fit=max\u0026auto=format\u0026n=irr8qn1NjuWyoP5V\u0026q=85\u0026s=a357c282d60388dc78ecf8bb6365e605\",\"dark\":\"https://mintcdn.com/qlaud-866b4636/irr8qn1NjuWyoP5V/logo/dark.svg?fit=max\u0026auto=format\u0026n=irr8qn1NjuWyoP5V\u0026q=85\u0026s=0c7b71ef8c4dd2f2107047b2abc4a666\"},\"favicon\":\"https://mintcdn.com/qlaud-866b4636/irr8qn1NjuWyoP5V/favicon.svg?fit=max\u0026auto=format\u0026n=irr8qn1NjuWyoP5V\u0026q=85\u0026s=1f87d064d851f880b
63765fb8a67f7e0980\",\"navbar\":{\"links\":[{\"href\":\"https://qlaud.ai/dashboard\",\"label\":\"Dashboard\"}],\"primary\":{\"type\":\"button\",\"label\":\"Get an API key\",\"href\":\"https://qlaud.ai/sign-up\"}},\"footer\":{\"socials\":{\"x\":\"https://x.com/qlaud\"}},\"styling\":{\"latex\":true,\"codeblocks\":\"system\"},\"navigation\":{\"pages\":[]}},\"docsNavWithMetadata\":\"$undefined\",\"anonymizedNav\":\"$undefined\",\"hasFullNav\":false},\"children\":\"$L32\"}]}]}]}]]}]]}]]\n"])</script>
637<script>self.__next_f.push([1,"33:I[604804,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/343f3c7f568a2e5d.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c50d793b8f34b10b.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/ccee8d9b3189ccd9.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/54f6583600c307fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3b847e5370bd724e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/4fa3ca58dfaaeff8.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8d0901e40ed4b058.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/468295ca52ed5c09.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3f8f2653ff1ad14e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/da953b59c0c41f06.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/f0ef0acaeece4a23.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/7538d80a516400fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8a19ec8c194a3b47.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/589b24301b3a37b4.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/d2fedac44d815262.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c3a3ab2374198660.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/de5d31edef447a03.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/6fb38247c19b3981.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8176871b020d7070.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"LoginButtonProvider\"]\n"])</script>
637<script>self.__next_f.push([1,"34:I[141180,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/343f3c7f568a2e5d.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c50d793b8f34b10b.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/ccee8d9b3189ccd9.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/54f6583600c307fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3b847e5370bd724e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/4fa3ca58dfaaeff8.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8d0901e40ed4b058.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/468295ca52ed5c09.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3f8f2653ff1ad14e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/da953b59c0c41f06.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/f0ef0acaeece4a23.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/7538d80a516400fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8a19ec8c194a3b47.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/589b24301b3a37b4.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/d2fedac44d815262.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c3a3ab2374198660.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/de5d31edef447a03.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/6fb38247c19b3981.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8176871b020d7070.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"SidebarLoginButtonProvider\"]\n"])</script>
637<script>self.__next_f.push([1,"35:I[343590,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/343f3c7f568a2e5d.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c50d793b8f34b10b.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/ccee8d9b3189ccd9.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/54f6583600c307fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3b847e5370bd724e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/4fa3ca58dfaaeff8.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8d0901e40ed4b058.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/468295ca52ed5c09.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3f8f2653ff1ad14e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/da953b59c0c41f06.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/f0ef0acaeece4a23.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/7538d80a516400fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8a19ec8c194a3b47.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/589b24301b3a37b4.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/d2fedac44d815262.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c3a3ab2374198660.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/de5d31edef447a03.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/6fb38247c19b3981.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8176871b020d7070.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"NavigationContextController\"]\n"])</script>
637<script>self.__next_f.push([1,"36:I[378486,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/343f3c7f568a2e5d.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c50d793b8f34b10b.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/ccee8d9b3189ccd9.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/54f6583600c307fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3b847e5370bd724e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/4fa3ca58dfaaeff8.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8d0901e40ed4b058.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/468295ca52ed5c09.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3f8f2653ff1ad14e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/da953b59c0c41f06.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/f0ef0acaeece4a23.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/7538d80a516400fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8a19ec8c194a3b47.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/589b24301b3a37b4.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/d2fedac44d815262.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c3a3ab2374198660.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/de5d31edef447a03.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/6fb38247c19b3981.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8176871b020d7070.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"PageListProvider\"]\n"])</script>
637<script>self.__next_f.push([1,"37:I[742977,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/343f3c7f568a2e5d.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c50d793b8f34b10b.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/ccee8d9b3189ccd9.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/54f6583600c307fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3b847e5370bd724e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/4fa3ca58dfaaeff8.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8d0901e40ed4b058.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/468295ca52ed5c09.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3f8f2653ff1ad14e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/da953b59c0c41f06.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/f0ef0acaeece4a23.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/7538d80a516400fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8a19ec8c194a3b47.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/589b24301b3a37b4.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/d2fedac44d815262.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c3a3ab2374198660.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/de5d31edef447a03.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/6fb38247c19b3981.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8176871b020d7070.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"PrefetchProvider\"]\n"])</script>
637<script>self.__next_f.push([1,"38:I[237978,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/343f3c7f568a2e5d.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c50d793b8f34b10b.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/ccee8d9b3189ccd9.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/54f6583600c307fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3b847e5370bd724e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/4fa3ca58dfaaeff8.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8d0901e40ed4b058.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/468295ca52ed5c09.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3f8f2653ff1ad14e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/da953b59c0c41f06.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/f0ef0acaeece4a23.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/7538d80a516400fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8a19ec8c194a3b47.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/589b24301b3a37b4.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/d2fedac44d815262.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c3a3ab2374198660.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/de5d31edef447a03.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/6fb38247c19b3981.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8176871b020d7070.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"PageModeOverrideProvider\"]\n"])</script>
637<script>self.__next_f.push([1,"39:I[378896,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/343f3c7f568a2e5d.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c50d793b8f34b10b.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/ccee8d9b3189ccd9.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/54f6583600c307fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3b847e5370bd724e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/4fa3ca58dfaaeff8.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8d0901e40ed4b058.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/468295ca52ed5c09.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3f8f2653ff1ad14e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/da953b59c0c41f06.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/f0ef0acaeece4a23.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/7538d80a516400fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8a19ec8c194a3b47.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/589b24301b3a37b4.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/d2fedac44d815262.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c3a3ab2374198660.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/de5d31edef447a03.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/6fb38247c19b3981.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8176871b020d7070.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"ConfiguredVariationProvider\"]\n"])</script>
637<script>self.__next_f.push([1,"3a:I[557611,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/343f3c7f568a2e5d.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c50d793b8f34b10b.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/ccee8d9b3189ccd9.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/54f6583600c307fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3b847e5370bd724e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/4fa3ca58dfaaeff8.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8d0901e40ed4b058.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/468295ca52ed5c09.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3f8f2653ff1ad14e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/da953b59c0c41f06.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/f0ef0acaeece4a23.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/7538d80a516400fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8a19ec8c194a3b47.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/589b24301b3a37b4.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/d2fedac44d815262.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c3a3ab2374198660.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/de5d31edef447a03.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/6fb38247c19b3981.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8176871b020d7070.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"Fonts\"]\n"])</script>
637<script>self.__next_f.push([1,"3b:I[330080,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/343f3c7f568a2e5d.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c50d793b8f34b10b.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/ccee8d9b3189ccd9.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/54f6583600c307fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3b847e5370bd724e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/4fa3ca58dfaaeff8.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8d0901e40ed4b058.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/468295ca52ed5c09.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3f8f2653ff1ad14e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/da953b59c0c41f06.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/f0ef0acaeece4a23.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/7538d80a516400fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8a19ec8c194a3b47.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/589b24301b3a37b4.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/d2fedac44d815262.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c3a3ab2374198660.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/de5d31edef447a03.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/6fb38247c19b3981.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8176871b020d7070.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"BannerProvider\"]\n"])</script>
637<script>self.__next_f.push([1,"3c:I[864506,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/343f3c7f568a2e5d.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c50d793b8f34b10b.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/ccee8d9b3189ccd9.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/54f6583600c307fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3b847e5370bd724e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/4fa3ca58dfaaeff8.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8d0901e40ed4b058.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/468295ca52ed5c09.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3f8f2653ff1ad14e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/da953b59c0c41f06.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/f0ef0acaeece4a23.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/7538d80a516400fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8a19ec8c194a3b47.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/589b24301b3a37b4.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/d2fedac44d815262.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c3a3ab2374198660.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/de5d31edef447a03.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/6fb38247c19b3981.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8176871b020d7070.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"NavbarTransitionScript\"]\n"])</script>
637<script>self.__next_f.push([1,"3d:T9e0,"])</script>
637<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>
637<script>self.__next_f.push([1,"32:[\"$\",\"$L33\",null,{\"children\":[\"$\",\"$L34\",null,{\"children\":[\"$\",\"$L35\",null,{\"children\":[\"$\",\"$L36\",null,{\"pageListDataMap\":{},\"children\":[\"$\",\"$L37\",null,{\"disabled\":\"$undefined\",\"children\":[\"$\",\"$L38\",null,{\"children\":[\"$\",\"$L39\",null,{\"children\":[[\"$\",\"$L14\",null,{\"fonts\":\"$undefined\",\"theme\":\"mint\",\"subdomain\":\"qlaud-866b4636\"}],[[\"$\",\"$L13\",null,{\"docsConfig\":\"$19:2:props:children:1:props:children:5: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        \"}]],[\"$\",\"$L15\",null,{\"theme\":\"mint\"}],[\"$\",\"$L3a\",null,{\"fonts\":\"$undefined\",\"children\":[\"$\",\"$L3b\",null,{\"bannersByLocale\":{},\"subdomain\":\"qlaud-866b4636\",\"children\":[[\"$\",\"$L3c\",null,{\"theme\":\"mint\"}],[\"$\",\"script\",null,{\"id\":\"_mintlify-scroll-margin-script\",\"dangerouslySetInnerHTML\":{\"__html\":\"$3d\"},\"suppressHydrationWarning\":true}],\"$L3e\"]}]}]]]}]}]}]}]}]}]}]\n"])</script>
637<script>self.__next_f.push([1,"3f:I[540345,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/343f3c7f568a2e5d.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c50d793b8f34b10b.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/ccee8d9b3189ccd9.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/54f6583600c307fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3b847e5370bd724e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/4fa3ca58dfaaeff8.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8d0901e40ed4b058.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/468295ca52ed5c09.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3f8f2653ff1ad14e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/da953b59c0c41f06.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/f0ef0acaeece4a23.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/7538d80a516400fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8a19ec8c194a3b47.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/589b24301b3a37b4.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/d2fedac44d815262.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c3a3ab2374198660.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/de5d31edef447a03.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/6fb38247c19b3981.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8176871b020d7070.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"ConsentProvider\"]\n"])</script>
637<script>self.__next_f.push([1,"40:I[529058,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/343f3c7f568a2e5d.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c50d793b8f34b10b.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/ccee8d9b3189ccd9.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/54f6583600c307fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3b847e5370bd724e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/4fa3ca58dfaaeff8.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8d0901e40ed4b058.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/468295ca52ed5c09.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3f8f2653ff1ad14e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/da953b59c0c41f06.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/f0ef0acaeece4a23.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/7538d80a516400fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8a19ec8c194a3b47.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/589b24301b3a37b4.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/d2fedac44d815262.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c3a3ab2374198660.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/de5d31edef447a03.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/6fb38247c19b3981.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8176871b020d7070.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"LocalStorageAndAnalyticsProviders\"]\n"])</script>
637<script>self.__next_f.push([1,"41:I[958547,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/343f3c7f568a2e5d.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c50d793b8f34b10b.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/ccee8d9b3189ccd9.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/54f6583600c307fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3b847e5370bd724e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/4fa3ca58dfaaeff8.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8d0901e40ed4b058.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/468295ca52ed5c09.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3f8f2653ff1ad14e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/da953b59c0c41f06.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/f0ef0acaeece4a23.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/7538d80a516400fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8a19ec8c194a3b47.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/589b24301b3a37b4.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/d2fedac44d815262.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c3a3ab2374198660.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/de5d31edef447a03.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/6fb38247c19b3981.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8176871b020d7070.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"default\"]\n"])</script>
637<script>self.__next_f.push([1,"42:I[604780,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/343f3c7f568a2e5d.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c50d793b8f34b10b.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/ccee8d9b3189ccd9.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/54f6583600c307fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3b847e5370bd724e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/4fa3ca58dfaaeff8.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8d0901e40ed4b058.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/468295ca52ed5c09.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3f8f2653ff1ad14e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/da953b59c0c41f06.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/f0ef0acaeece4a23.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/7538d80a516400fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8a19ec8c194a3b47.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/589b24301b3a37b4.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/d2fedac44d815262.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c3a3ab2374198660.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/de5d31edef447a03.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/6fb38247c19b3981.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8176871b020d7070.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"CaptchaProvider\"]\n"])</script>
637<script>self.__next_f.push([1,"43:I[859465,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/343f3c7f568a2e5d.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c50d793b8f34b10b.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/ccee8d9b3189ccd9.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/54f6583600c307fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3b847e5370bd724e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/4fa3ca58dfaaeff8.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8d0901e40ed4b058.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/468295ca52ed5c09.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3f8f2653ff1ad14e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/da953b59c0c41f06.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/f0ef0acaeece4a23.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/7538d80a516400fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8a19ec8c194a3b47.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/589b24301b3a37b4.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/d2fedac44d815262.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c3a3ab2374198660.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/de5d31edef447a03.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/6fb38247c19b3981.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8176871b020d7070.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"AssistantUiProvider\"]\n"])</script>
637<script>self.__next_f.push([1,"44:I[832740,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/343f3c7f568a2e5d.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c50d793b8f34b10b.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/ccee8d9b3189ccd9.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/54f6583600c307fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3b847e5370bd724e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/4fa3ca58dfaaeff8.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8d0901e40ed4b058.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/468295ca52ed5c09.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3f8f2653ff1ad14e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/da953b59c0c41f06.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/f0ef0acaeece4a23.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/7538d80a516400fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8a19ec8c194a3b47.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/589b24301b3a37b4.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/d2fedac44d815262.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c3a3ab2374198660.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/de5d31edef447a03.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/6fb38247c19b3981.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8176871b020d7070.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"AssistantTransportProviderSelector\"]\n"])</script>
637<script>self.__next_f.push([1,"45:I[601054,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/343f3c7f568a2e5d.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c50d793b8f34b10b.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/ccee8d9b3189ccd9.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/54f6583600c307fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3b847e5370bd724e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/4fa3ca58dfaaeff8.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8d0901e40ed4b058.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/468295ca52ed5c09.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3f8f2653ff1ad14e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/da953b59c0c41f06.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/f0ef0acaeece4a23.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/7538d80a516400fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8a19ec8c194a3b47.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/589b24301b3a37b4.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/d2fedac44d815262.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c3a3ab2374198660.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/de5d31edef447a03.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/6fb38247c19b3981.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8176871b020d7070.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"SearchProvider\"]\n"])</script>
637<script>self.__next_f.push([1,"3e:[\"$\",\"$L3f\",null,{\"privacy\":\"$undefined\",\"children\":[\"$\",\"$L40\",null,{\"subdomain\":\"qlaud-866b4636\",\"isAtlas\":false,\"children\":[\"$\",\"$L41\",null,{\"toggles\":[{\"name\":\"dashboard-editor-theseus\",\"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\":\"agent-mintlify-slack\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"editor-v7-file-tree\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"agent-integrations-settings\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"automations-pr-grouping\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"custom-prefix\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"analytics-v7\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"user-flows-analytics\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"no-publish-flow\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"llms-txt-v2\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"pause-universal-search-reconcile\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"snapshot-serving-live\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"stripTemperatureMiddleware\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"per-site-search-delta\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"support-platform-pylon-zendesk\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"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\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"instant-rollback\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"granular-notifications-server\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"granular-notifications\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"editor-private-page-search\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"automations-fable\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"fixed-ai-action-pricing\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"automation-resolve-merge-conflict\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"scoped-publishing\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"mintql\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"page-level-analytics\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"teamspace\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"editor-version-history-v2\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"assistant-v5\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"byok-sep-25\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"revalidation-jwt\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false},{\"name\":\"editor-agent-model-picker\",\"enabled\":true,\"variant\":{\"name\":\"disabled\",\"enabled\":false,\"feature_enabled\":true},\"impressionData\":false}],\"children\":[\"$\",\"$L42\",null,{\"enabled\":false,\"children\":[\"$\",\"$L43\",\"qlaud-866b4636\",{\"children\":[\"$\",\"$L44\",null,{\"children\":[\"$\",\"$L45\",null,{\"subdomain\":\"qlaud-866b4636\",\"hasChatPermissions\":false,\"isLoggedInCli\":false,\"assistantConfig\":{\"enableAskAiButton\":false,\"enableStarterQuestions\":false,\"enableContextualStarterQuestions\":false,\"enableAskAiSearchBar\":true},\"starterQuestions\":\"$undefined\",\"children\":[\"$L46\",\"$L47\",\"$L48\",\"$L49\"]}]}]}]}]}]}]}]\n"])</script>
637<script>self.__next_f.push([1,"4a:I[28330,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/343f3c7f568a2e5d.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c50d793b8f34b10b.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/ccee8d9b3189ccd9.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/54f6583600c307fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3b847e5370bd724e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/4fa3ca58dfaaeff8.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8d0901e40ed4b058.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/468295ca52ed5c09.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3f8f2653ff1ad14e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/da953b59c0c41f06.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/f0ef0acaeece4a23.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/7538d80a516400fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8a19ec8c194a3b47.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/589b24301b3a37b4.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/d2fedac44d815262.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c3a3ab2374198660.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/de5d31edef447a03.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/6fb38247c19b3981.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8176871b020d7070.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"SkipToContent\"]\n"])</script>
637<script>self.__next_f.push([1,"4b:I[382229,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/343f3c7f568a2e5d.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c50d793b8f34b10b.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/ccee8d9b3189ccd9.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/54f6583600c307fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3b847e5370bd724e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/4fa3ca58dfaaeff8.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8d0901e40ed4b058.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/468295ca52ed5c09.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3f8f2653ff1ad14e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/da953b59c0c41f06.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/f0ef0acaeece4a23.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/7538d80a516400fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8a19ec8c194a3b47.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/589b24301b3a37b4.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/d2fedac44d815262.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c3a3ab2374198660.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/de5d31edef447a03.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/6fb38247c19b3981.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8176871b020d7070.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"AssistantLayoutScript\"]\n"])</script>
637<script>self.__next_f.push([1,"4c:I[87732,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/343f3c7f568a2e5d.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c50d793b8f34b10b.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/ccee8d9b3189ccd9.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/54f6583600c307fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3b847e5370bd724e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/4fa3ca58dfaaeff8.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8d0901e40ed4b058.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/468295ca52ed5c09.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3f8f2653ff1ad14e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/da953b59c0c41f06.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/f0ef0acaeece4a23.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/7538d80a516400fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8a19ec8c194a3b47.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/589b24301b3a37b4.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/d2fedac44d815262.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c3a3ab2374198660.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/de5d31edef447a03.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/6fb38247c19b3981.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8176871b020d7070.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"AssistantLayoutWrapper\"]\n"])</script>
637<script>self.__next_f.push([1,"4d:I[118717,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/343f3c7f568a2e5d.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c50d793b8f34b10b.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/ccee8d9b3189ccd9.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/54f6583600c307fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3b847e5370bd724e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/4fa3ca58dfaaeff8.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8d0901e40ed4b058.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/468295ca52ed5c09.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3f8f2653ff1ad14e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/da953b59c0c41f06.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/f0ef0acaeece4a23.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/7538d80a516400fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8a19ec8c194a3b47.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/589b24301b3a37b4.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/d2fedac44d815262.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c3a3ab2374198660.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/de5d31edef447a03.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/6fb38247c19b3981.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8176871b020d7070.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/6cb3e8b7f002b825.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"NotFoundHydrator\"]\n"])</script>
637<script>self.__next_f.push([1,"46:[\"$\",\"$L4a\",null,{}]\n47:[\"$\",\"$L4b\",null,{\"hasChatPermissions\":false}]\n48:[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"html{--assistant-sheet-width:0px!important}\"}}]\n49:[\"$\",\"$L4c\",null,{\"children\":[[\"$\",\"$Lf\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L11\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[\"$\",\"$L4d\",null,{\"source\":\"multitenant\"}],[]],\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}],\"$undefined\"]}]\n"])</script>
637<script>self.__next_f.push([1,"4e:I[597003,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/343f3c7f568a2e5d.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c50d793b8f34b10b.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/ccee8d9b3189ccd9.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/54f6583600c307fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3b847e5370bd724e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/4fa3ca58dfaaeff8.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8d0901e40ed4b058.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/468295ca52ed5c09.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3f8f2653ff1ad14e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/da953b59c0c41f06.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/f0ef0acaeece4a23.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/7538d80a516400fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8a19ec8c194a3b47.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/589b24301b3a37b4.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/d2fedac44d815262.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c3a3ab2374198660.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/de5d31edef447a03.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/6fb38247c19b3981.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8176871b020d7070.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/9db9880c49eded60.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/41c8239ff6030cd1.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/e452a5c043e34035.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/fde44643dbef1bcd.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c58283ba69dd38df.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/e5dcdb55f621f74a.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1a0bf1d33a977db0.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"ScopedNavProvider\"]\n"])</script>
637<script>self.__next_f.push([1,"4f:I[763509,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/343f3c7f568a2e5d.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c50d793b8f34b10b.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/ccee8d9b3189ccd9.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/54f6583600c307fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3b847e5370bd724e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/4fa3ca58dfaaeff8.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8d0901e40ed4b058.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/468295ca52ed5c09.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3f8f2653ff1ad14e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/da953b59c0c41f06.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/f0ef0acaeece4a23.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/7538d80a516400fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8a19ec8c194a3b47.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/589b24301b3a37b4.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/d2fedac44d815262.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c3a3ab2374198660.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/de5d31edef447a03.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/6fb38247c19b3981.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8176871b020d7070.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/9db9880c49eded60.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/41c8239ff6030cd1.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/e452a5c043e34035.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/fde44643dbef1bcd.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c58283ba69dd38df.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/e5dcdb55f621f74a.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1a0bf1d33a977db0.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"ThemeLayout\"]\n"])</script>
637<script>self.__next_f.push([1,"50:I[91557,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/343f3c7f568a2e5d.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c50d793b8f34b10b.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/ccee8d9b3189ccd9.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/54f6583600c307fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3b847e5370bd724e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/4fa3ca58dfaaeff8.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8d0901e40ed4b058.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/468295ca52ed5c09.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3f8f2653ff1ad14e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/da953b59c0c41f06.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/f0ef0acaeece4a23.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/7538d80a516400fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8a19ec8c194a3b47.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/589b24301b3a37b4.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/d2fedac44d815262.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c3a3ab2374198660.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/de5d31edef447a03.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/6fb38247c19b3981.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8176871b020d7070.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/9db9880c49eded60.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/41c8239ff6030cd1.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/e452a5c043e34035.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/fde44643dbef1bcd.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c58283ba69dd38df.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/e5dcdb55f621f74a.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1a0bf1d33a977db0.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"ApiReferenceProvider\"]\n"])</script>
637<script>self.__next_f.push([1,"51:I[114793,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/343f3c7f568a2e5d.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c50d793b8f34b10b.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/ccee8d9b3189ccd9.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/54f6583600c307fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3b847e5370bd724e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/4fa3ca58dfaaeff8.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8d0901e40ed4b058.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/468295ca52ed5c09.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3f8f2653ff1ad14e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/da953b59c0c41f06.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/f0ef0acaeece4a23.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/7538d80a516400fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8a19ec8c194a3b47.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/589b24301b3a37b4.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/d2fedac44d815262.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c3a3ab2374198660.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/de5d31edef447a03.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/6fb38247c19b3981.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8176871b020d7070.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/9db9880c49eded60.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/41c8239ff6030cd1.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/e452a5c043e34035.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/fde44643dbef1bcd.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c58283ba69dd38df.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/e5dcdb55f621f74a.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1a0bf1d33a977db0.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"PageProvider\"]\n"])</script>
637<script>self.__next_f.push([1,"1a:[\"$\",\"$L4e\",null,{\"scopedNav\":{\"global\":null,\"tabs\":[{\"tab\":\"Guides\",\"groups\":[{\"group\":\"Get started\",\"pages\":[{\"title\":\"What is qlaud?\",\"description\":\"The billing layer for AI apps. Mint a key per user, cap their spend, get paid.\",\"href\":\"/introduction\"},{\"title\":\"Quickstart\",\"description\":\"Sign up, mint a master key, send your first request in 60 seconds.\",\"href\":\"/quickstart\"},{\"title\":\"Per-user billing\",\"description\":\"Mint a qlaud key for every end-user, cap their spend, invoice them through Stripe.\",\"href\":\"/per-user-billing\"}]},{\"group\":\"Tutorials\",\"pages\":[{\"title\":\"Build a chat app on qlaud\",\"description\":\"End-to-end tutorial: per-user threads, tool integration, semantic search, streaming UX, and per-end-user billing — no Postgres, no vector DB, no message store of your own.\",\"href\":\"/guides/build-a-chat-app\"}]},{\"group\":\"Concepts\",\"pages\":[{\"title\":\"Choosing your API surface\",\"description\":\"qlaud exposes two API surfaces: /v1/messages (just routing + billing) and /v1/threads/:id/messages (full backend with auto-discovered connectors, threads, and semantic search). Pick the right one — most chat apps want Threads.\",\"href\":\"/concepts/api-surfaces\"},{\"title\":\"Keys \u0026 scopes\",\"description\":\"qlaud has two key scopes: standard (inference only) and admin (mint + revoke other keys).\",\"href\":\"/concepts/keys-and-scopes\"},{\"title\":\"Wallet \u0026 spending caps\",\"description\":\"How qlaud's two-layer billing model works: account wallet + per-key cap.\",\"href\":\"/concepts/wallet-and-caps\"},{\"title\":\"Usage \u0026 invoicing\",\"description\":\"How qlaud records every request, surfaces it per-key, and lets you bill end-users at month-end.\",\"href\":\"/concepts/usage-and-billing\"}]},{\"group\":\"Integrations\",\"pages\":[{\"title\":\"Claude Code\",\"description\":\"Point Anthropic's official CLI at qlaud — same workflow, your billing layer underneath.\",\"href\":\"/integrations/claude-code\"},{\"title\":\"OpenAI SDK\",\"description\":\"openai-py, openai-node, LangChain, Vercel AI SDK — all work with one base-URL change.\",\"href\":\"/integrations/openai-sdk\"},{\"title\":\"Anthropic SDK\",\"description\":\"anthropic-py, anthropic-ts — point at qlaud, get cache_control + thinking blocks preserved verbatim.\",\"href\":\"/integrations/anthropic-sdk\"}]}]},{\"tab\":\"API Reference\",\"pages\":[{\"title\":\"API Reference\",\"href\":\"/api-reference/messages\"}]}]},\"maps\":{\"firstHrefInVersion\":{},\"firstHrefInLanguage\":{}},\"children\":[\"$\",\"$L4f\",null,{\"theme\":\"mint\",\"pageMetadata\":{\"title\":\"Build a chat app on qlaud\",\"description\":\"End-to-end tutorial: per-user threads, tool integration, semantic search, streaming UX, and per-end-user billing — no Postgres, no vector DB, no message store of your own.\",\"href\":\"/guides/build-a-chat-app\"},\"children\":[\"$\",\"$L50\",null,{\"value\":{\"apiReferenceData\":{},\"graphqlReferenceData\":\"$undefined\"},\"children\":[\"$\",\"$L51\",null,{\"value\":{\"pageMetadata\":\"$1a:props:children:props:pageMetadata\",\"lastModified\":\"2026-04-27T07:56:40.974Z\",\"gitLastModified\":\"$undefined\",\"originalFileLocation\":\"guides/build-a-chat-app.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: \\\"End-to-end tutorial: per-user threads, tool integration, semantic search, streaming UX, and per-end-user billing — no Postgres, no vector DB, no message store of your own.\\\"\\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\":\"Prerequisites\",\"slug\":\"prerequisites\",\"depth\":2,\"children\":[]},{\"title\":\"Architecture in one paragraph\",\"slug\":\"architecture-in-one-paragraph\",\"depth\":2,\"children\":[]},{\"title\":\"Step 1 — On signup, mint a per-user key + thread\",\"slug\":\"step-1-%E2%80%94-on-signup%2C-mint-a-per-user-key-%2B-thread\",\"depth\":2,\"children\":[]},{\"title\":\"Step 2 — Send a message in a conversation\",\"slug\":\"step-2-%E2%80%94-send-a-message-in-a-conversation\",\"depth\":2,\"children\":[]}
637,{\"title\":\"Step 3 — Stream the response (token-by-token UX)\",\"slug\":\"step-3-%E2%80%94-stream-the-response-token-by-token-ux\",\"depth\":2,\"children\":[]},{\"title\":\"Step 4 — Add a tool\",\"slug\":\"step-4-%E2%80%94-add-a-tool\",\"depth\":2,\"children\":[{\"title\":\"Register the tool (one-time)\",\"slug\":\"register-the-tool-one-time\",\"depth\":3,\"children\":[]},{\"title\":\"Host the webhook (your backend)\",\"slug\":\"host-the-webhook-your-backend\",\"depth\":3,\"children\":[]},{\"title\":\"Use the tool in a conversation\",\"slug\":\"use-the-tool-in-a-conversation\",\"depth\":3,\"children\":[]}]},{\"title\":\"Step 5 — Search the user’s history\",\"slug\":\"step-5-%E2%80%94-search-the-user%E2%80%99s-history\",\"depth\":2,\"children\":[]},{\"title\":\"Step 6 — Bill at month-end\",\"slug\":\"step-6-%E2%80%94-bill-at-month-end\",\"depth\":2,\"children\":[]},{\"title\":\"What you didn’t build\",\"slug\":\"what-you-didn%E2%80%99t-build\",\"depth\":2,\"children\":[]},{\"title\":\"Next steps\",\"slug\":\"next-steps\",\"depth\":2,\"children\":[]}],\"codeExamples\":{}},\"pageType\":\"$undefined\",\"panelMdxSource\":\"$undefined\",\"panelMdxSourceWithNoJs\":\"$undefined\",\"contextualStarterQuestions\":\"$undefined\",\"relatedPages\":\"$undefined\",\"relatedPagesConfig\":\"$undefined\",\"narration\":\"$undefined\"},\"children\":\"$L52\"}]}]}]}]\n"])</script>
637<script>self.__next_f.push([1,"53:I[91557,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/343f3c7f568a2e5d.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c50d793b8f34b10b.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/ccee8d9b3189ccd9.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/54f6583600c307fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3b847e5370bd724e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/4fa3ca58dfaaeff8.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8d0901e40ed4b058.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/468295ca52ed5c09.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3f8f2653ff1ad14e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/da953b59c0c41f06.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/f0ef0acaeece4a23.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/7538d80a516400fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8a19ec8c194a3b47.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/589b24301b3a37b4.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/d2fedac44d815262.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c3a3ab2374198660.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/de5d31edef447a03.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/6fb38247c19b3981.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8176871b020d7070.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/9db9880c49eded60.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/41c8239ff6030cd1.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/e452a5c043e34035.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/fde44643dbef1bcd.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c58283ba69dd38df.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/e5dcdb55f621f74a.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1a0bf1d33a977db0.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"OpenApiProvider\"]\n"])</script>
637<script>self.__next_f.push([1,"54:I[525343,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/343f3c7f568a2e5d.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c50d793b8f34b10b.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/ccee8d9b3189ccd9.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/54f6583600c307fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3b847e5370bd724e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/4fa3ca58dfaaeff8.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8d0901e40ed4b058.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/468295ca52ed5c09.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3f8f2653ff1ad14e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/da953b59c0c41f06.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/f0ef0acaeece4a23.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/7538d80a516400fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8a19ec8c194a3b47.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/589b24301b3a37b4.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/d2fedac44d815262.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c3a3ab2374198660.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/de5d31edef447a03.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/6fb38247c19b3981.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8176871b020d7070.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/9db9880c49eded60.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/41c8239ff6030cd1.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/e452a5c043e34035.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/fde44643dbef1bcd.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c58283ba69dd38df.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/e5dcdb55f621f74a.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1a0bf1d33a977db0.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"TabSyncContextProvider\"]\n"])</script>
637<script>self.__next_f.push([1,"56:I[228341,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/343f3c7f568a2e5d.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c50d793b8f34b10b.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/ccee8d9b3189ccd9.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/54f6583600c307fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3b847e5370bd724e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/4fa3ca58dfaaeff8.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8d0901e40ed4b058.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/468295ca52ed5c09.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3f8f2653ff1ad14e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/da953b59c0c41f06.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/f0ef0acaeece4a23.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/7538d80a516400fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8a19ec8c194a3b47.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/589b24301b3a37b4.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/d2fedac44d815262.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c3a3ab2374198660.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/de5d31edef447a03.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/6fb38247c19b3981.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8176871b020d7070.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/9db9880c49eded60.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/41c8239ff6030cd1.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/e452a5c043e34035.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/fde44643dbef1bcd.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c58283ba69dd38df.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/e5dcdb55f621f74a.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1a0bf1d33a977db0.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"PageModeUpdater\"]\n"])</script>
637<script>self.__next_f.push([1,"57:I[575126,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/343f3c7f568a2e5d.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c50d793b8f34b10b.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/ccee8d9b3189ccd9.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/54f6583600c307fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3b847e5370bd724e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/4fa3ca58dfaaeff8.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8d0901e40ed4b058.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/468295ca52ed5c09.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3f8f2653ff1ad14e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/da953b59c0c41f06.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/f0ef0acaeece4a23.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/7538d80a516400fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8a19ec8c194a3b47.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/589b24301b3a37b4.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/d2fedac44d815262.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c3a3ab2374198660.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/de5d31edef447a03.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/6fb38247c19b3981.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8176871b020d7070.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/9db9880c49eded60.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/41c8239ff6030cd1.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/e452a5c043e34035.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/fde44643dbef1bcd.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c58283ba69dd38df.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/e5dcdb55f621f74a.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1a0bf1d33a977db0.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"Background\"]\n"])</script>
637<script>self.__next_f.push([1,"58:I[36098,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/343f3c7f568a2e5d.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c50d793b8f34b10b.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/ccee8d9b3189ccd9.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/54f6583600c307fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3b847e5370bd724e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/4fa3ca58dfaaeff8.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8d0901e40ed4b058.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/468295ca52ed5c09.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3f8f2653ff1ad14e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/da953b59c0c41f06.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/f0ef0acaeece4a23.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/7538d80a516400fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8a19ec8c194a3b47.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/589b24301b3a37b4.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/d2fedac44d815262.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c3a3ab2374198660.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/de5d31edef447a03.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/6fb38247c19b3981.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8176871b020d7070.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/9db9880c49eded60.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/41c8239ff6030cd1.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/e452a5c043e34035.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/fde44643dbef1bcd.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c58283ba69dd38df.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/e5dcdb55f621f74a.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1a0bf1d33a977db0.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"CustomJsFiles\"]\n"])</script>
637<script>self.__next_f.push([1,"59:I[530359,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/343f3c7f568a2e5d.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c50d793b8f34b10b.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/ccee8d9b3189ccd9.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/54f6583600c307fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3b847e5370bd724e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/4fa3ca58dfaaeff8.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8d0901e40ed4b058.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/468295ca52ed5c09.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3f8f2653ff1ad14e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/da953b59c0c41f06.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/f0ef0acaeece4a23.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/7538d80a516400fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8a19ec8c194a3b47.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/589b24301b3a37b4.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/d2fedac44d815262.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c3a3ab2374198660.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/de5d31edef447a03.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/6fb38247c19b3981.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8176871b020d7070.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/9db9880c49eded60.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/41c8239ff6030cd1.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/e452a5c043e34035.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/fde44643dbef1bcd.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c58283ba69dd38df.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/e5dcdb55f621f74a.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1a0bf1d33a977db0.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"MDXContentController\"]\n"])</script>
637<script>self.__next_f.push([1,"5a:I[448287,[\"/mintlify-assets/_next/static/chunks/607c8643ad3fc16c.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1e7a188add93a653.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/343f3c7f568a2e5d.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c50d793b8f34b10b.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/ccee8d9b3189ccd9.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/54f6583600c307fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3b847e5370bd724e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/4fa3ca58dfaaeff8.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8d0901e40ed4b058.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/468295ca52ed5c09.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/3f8f2653ff1ad14e.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/da953b59c0c41f06.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/f0ef0acaeece4a23.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/7538d80a516400fa.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8a19ec8c194a3b47.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/589b24301b3a37b4.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/d2fedac44d815262.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c3a3ab2374198660.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/de5d31edef447a03.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/6fb38247c19b3981.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/8176871b020d7070.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/9db9880c49eded60.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/41c8239ff6030cd1.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/e452a5c043e34035.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/fde44643dbef1bcd.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/c58283ba69dd38df.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/e5dcdb55f621f74a.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\",\"/mintlify-assets/_next/static/chunks/1a0bf1d33a977db0.js?dpl=dpl_AdgF69PdgrU7nYyZAbxVCHc36KNP\"],\"default\"]\n"])</script>
637<script>self.__next_f.push([1,"55:T7d4,"])</script>
637<script>self.__next_f.push([1,"{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.qlaud.ai/#organization\",\"name\":\"qlaud\",\"url\":\"https://docs.qlaud.ai\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/qlaud-866b4636/irr8qn1NjuWyoP5V/logo/light.svg?fit=max\u0026auto=format\u0026n=irr8qn1NjuWyoP5V\u0026q=85\u0026s=a357c282d60388dc78ecf8bb6365e605\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.qlaud.ai#website\",\"name\":\"qlaud\",\"url\":\"https://docs.qlaud.ai\",\"publisher\":{\"@id\":\"https://docs.qlaud.ai/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.qlaud.ai/guides/build-a-chat-app#webpage\",\"url\":\"https://docs.qlaud.ai/guides/build-a-chat-app\",\"name\":\"Build a chat app on qlaud\",\"description\":\"End-to-end tutorial: per-user threads, tool integration, semantic search, streaming UX, and per-end-user billing — no Postgres, no vector DB, no message store of your own.\",\"dateModified\":\"2026-04-27T07:56:40.974Z\",\"isPartOf\":{\"@id\":\"https://docs.qlaud.ai#website\"},\"breadcrumb\":{\"@id\":\"https://docs.qlaud.ai/guides/build-a-chat-app#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.qlaud.ai/guides/build-a-chat-app#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"qlaud\",\"item\":\"https://docs.qlaud.ai\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Build a chat app on qlaud\",\"item\":\"https://docs.qlaud.ai/guides/build-a-chat-app\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.qlaud.ai/guides/build-a-chat-app#article\",\"headline\":\"Build a chat app on qlaud\",\"name\":\"Build a chat app on qlaud\",\"description\":\"End-to-end tutorial: per-user threads, tool integration, semantic search, streaming UX, and per-end-user billing — no Postgres, no vector DB, no message store of your own.\",\"url\":\"https://docs.qlaud.ai/guides/build-a-chat-app\",\"mainEntityOfPage\":{\"@id\":\"https://docs.qlaud.ai/guides/build-a-chat-app#webpage\"},\"dateModified\":\"2026-04-27T07:56:40.974Z\",\"publisher\":{\"@id\":\"https://docs.qlaud.ai/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.qlaud.ai#website\"}}]}"])</script>
637<script>self.__next_f.push([1,"5b:T3591c,"])</script>
637<script>self.__next_f.push([1,"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,em:`em`,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,Table}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!CodeGroup)_missingMdxReference(`CodeGroup`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Table)_missingMdxReference(`Table`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`This tutorial walks the full stack of a user-facing AI chat product on\nqlaud. By the end you’ll have a chat backend with:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Per-end-user conversations`}),` — each of your users has their own thread`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Tool integration`}),` — the assistant calls your business logic (lookups,\nactions) via webhooks; qlaud handles the dispatch loop`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Semantic search`}),` — your end-user can search their own conversation\nhistory; you don’t run a vector DB`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Streaming UX`}),` — text appears word-by-word, like every modern chat`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Per-user billing`}),` — hard spend caps; you bill how you want at month-end`]}),`\n`]}),`\n`,_jsx(_components.p,{children:`What you DON’T build: Postgres tables, message store, context-window loader,\ntool-call state machine, embedding pipeline, vector store, conversation\nsearch, per-user cost attribution.`}),`\n`,_jsxs(_components.p,{children:[`Estimated time end-to-end: `,_jsx(_components.strong,{children:`~30 minutes`}),`, mostly waiting on\n`,_jsx(_components.code,{children:`pip install`}),` / `,_jsx(_components.code,{children:`npm install`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`prerequisites`,children:`Prerequisites`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`A qlaud account (`,_jsx(_components.a,{href:`https://qlaud.ai/sign-up`,children:`sign up free, $5 starter credit`}),`)`]}),`\n`,_jsxs(_components.li,{children:[`Your master key from `,_jsx(_components.a,{href:`https://qlaud.ai/keys`,children:`/keys`}),`, exported as `,_jsx(_components.code,{children:`QLAUD_MASTER_KEY`})]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Python 3.9+`}),` (using plain `,_jsx(_components.code,{children:`requests`}),`) or `,_jsx(_components.strong,{children:`Node 18+`}),` (using built-in\n`,_jsx(_components.code,{children:`fetch`}),`). No qlaud SDK required for any of this.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`architecture-in-one-paragraph`,children:`Architecture in one paragraph`}),`\n`,_jsx(_components.p,{children:`Each of your end-users gets:`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`A qlaud per-user API key (`,_jsx(_components.code,{children:`qlk_live_…`}),`) with a hard spend cap, minted on\nsignup using your master key.`]}),`\n`,_jsxs(_components.li,{children:[`A qlaud thread tagged with their `,_jsx(_components.code,{children:`end_user_id`}),`.`]}),`\n`]}),`\n`,_jsx(_components.p,{children:`That’s it. Their messages go to qlaud; qlaud calls the model, optionally\nfires tools, persists everything, exposes search, and meters cost — all\nkeyed off their thread + their per-user key. Your backend only orchestrates.`}),`\n`,_jsx(Heading,{level:`2`,id:`step-1-%E2%80%94-on-signup%2C-mint-a-per-user-key-%2B-thread`,children:`Step 1 — On signup, mint a per-user key + thread`}),`\n`,_jsx(_components.p,{children:`Whenever a new user signs up in your app, run this once:`}),`\n`,_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`Python`,numberOfLines:`31`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes g
637ithub-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:`31`,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:` os, requests`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`QLAUD`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"https://api.qlaud.ai\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`MASTER`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` os.environ[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"QLAUD_MASTER_KEY\"`}),_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:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` onboard_qlaud`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`end_user_id`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`str`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`monthly_budget_usd`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`float`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 5.0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`):`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`    \"\"\"Provision a qlaud per-user key + an initial thread for a new user.\"\"\"`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    headers `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"x-api-key\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`MASTER`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"content-type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#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`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`    # 1. Mint a standard-scoped key with a hard cap.`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    key `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` requests.post(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`}
637,children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`QLAUD`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`/v1/keys\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},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:`headers, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`json`}),_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:`        \"name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"end_user_`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`end_user_id`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`        \"scope\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"standard\"`}),_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:`        \"max_spend_usd\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: monthly_budget_usd,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    }).json()`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`    # 2. Create their first thread, tagged with your end_user_id.`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    thread `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` requests.post(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`QLAUD`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`/v1/threads\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},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:`        \"x-api-key\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: key[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"secret\"`}),_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`}
637,children:`\"application/json\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    }, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`json`}),_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:`        \"end_user_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: end_user_id,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`        \"metadata\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"plan\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"free\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`},`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    }).json()`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`    # Store both in YOUR users table.`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`    return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`        \"qlaud_key_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: key[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`],`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`        \"qlaud_secret\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: key[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"secret\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`],   `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# only returned once — store it`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`        \"qlaud_thread_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: thread[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"id\"`}),_jsx(_components.span,{style:{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:`TypeScript`,numberOfLines:`44`,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`,
637numberOfLines:`44`,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:` QLAUD`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'https://api.qlaud.ai'`}),_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:` MASTER`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},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:`env`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`QLAUD_MASTER_KEY`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`!`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`type`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` OnboardResult`}),_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:`  qlaudKeyId`}),_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:`  qlaudSecret`}),_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:`  qlaudThreadId`}),_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`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`/** Provision a qlaud per-user key + an initial thread for a new user. */`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`export`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` async`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` function`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` onboardQlaud`}),_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:`  endUserId`}),_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:`  monthlyBudgetUsd`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 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\":`#D4D4D4`},children:`)`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` Promise`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`OnboardResult`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`\u003e {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`  // 1. Mint a standard-scoped key with a hard cap.`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`}
637,children:`  const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` keyResp`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` fetch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`\"}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`QLAUD`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"/v1/keys`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    method:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'POST'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    headers:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'x-api-key'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` MASTER`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'content-type'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'application/json'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    body:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` JSON`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`stringify`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`      name:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\" `end_user_\"}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`endUserId`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`      scope:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'standard'`}),_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:`      max_spend_usd:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` monthlyBudgetUsd`}),_jsx(_components.span,{style:{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:`#CF222E`,\"--shiki-dark\":`#569CD6`}
637,children:`  const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` key`}),_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:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` keyResp`}),_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:`()) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},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:`; `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`secret`}),_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`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`  // 2. Create their first thread, tagged with your end_user_id.`})}),`\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:` threadResp`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` fetch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`\"}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`QLAUD`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"/v1/threads`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    method:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'POST'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    headers:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'x-api-key'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` key`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`secret`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'content-type'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'application/json'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    body:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` JSON`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`stringify`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`      end_user_id:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` endUserId`}),_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:`      metadata:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`plan:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'free'`}),_jsx(_components.span,{style:{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:`#CF222E`,\"--shiki-dark\":`#569CD6`}
637,children:`  const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` thread`}),_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:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` threadResp`}),_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:`()) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},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`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`  // Store both in YOUR users table.`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`  return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    qlaudKeyId:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` key`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`id`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    qlaudSecret:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` key`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`secret`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,    `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// only returned once — store it`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    qlaudThreadId:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` thread`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`id`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_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:`You now have one place per user that holds their entire AI footprint.\nThat’s all the per-user state you need to track on your side.`}),`\n`,_jsx(Heading,{level:`2`,id:`step-2-%E2%80%94-send-a-message-in-a-conversation`,children:`Step 2 — Send a message in a conversation`}),`\n`,_jsxs(_components.p,{children:[`Once you have a user’s `,_jsx(_components.c
637ode,{children:`qlaud_secret`}),` and `,_jsx(_components.code,{children:`qlaud_thread_id`}),`, sending a turn\nis one call. qlaud loads the prior history server-side; you only send the\nnew user content:`]}),`\n`,_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`Python`,numberOfLines:`12`,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:`12`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` chat`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`qlaud_secret`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`str`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`thread_id`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`str`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`user_msg`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`str`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) -\u003e `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`str`}),_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:`    r `}),_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:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`        f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`QLAUD`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`/v1/threads/`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`thread_id`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},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:`#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:`{`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"x-api-key\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: qlaud_secret, `}),_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`}
637,children:`\"application/json\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`},`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`        json`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`            \"model\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"claude-sonnet-4-6\"`}),_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:`            \"max_tokens\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1024`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`            \"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: user_msg,   `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:\"# NOT a `messages` array\"})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`        },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    )`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    body `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` r.json()`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`    return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` body[`}),_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:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_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:`]`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:`TypeScript`,numberOfLines:`17`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,
637numberOfLines:`17`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`export`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` async`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` function`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` chat`}),_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:`  qlaudSecret`}),_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:`  threadId`}),_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:`  userMsg`}),_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:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` Promise`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`\u003e {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`  const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` r`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` fetch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`\"}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`QLAUD`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`/v1/threads/`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`threadId`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},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\":`#9CDCFE`},children:`    method:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'POST'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    headers:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'x-api-key'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` qlaudSecret`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'content-type'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'application/json'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    body:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` JSON`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`stringify`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`      model:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'claude-sonnet-4-6'`}),_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:`      max_tokens:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1024`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`      content:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` userMsg`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,           `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:\"// NOT a `messages` array\"})]}),`\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:`#CF222E`,\"--shiki-dark\":`#569CD6`}
637,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:`#1F2328`,\"--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:` r`}),_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:`()) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`as`}),_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:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` Array`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c{ `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`text`}),_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:` }\u003e };`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`  return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` body`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`content`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_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:`text`}),_jsx(_components.span,{style:{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:[`That’s a complete chat backend. No message store, no context loader, no\n“how do I keep history under N tokens” code. qlaud caps at the last 50\nturns automatically and you never see the upstream `,_jsx(_components.code,{children:`messages`}),` array.`]}),`\n`,_jsx(Heading,{level:`2`,id:`step-3-%E2%80%94-stream-the-response-token-by-token-ux`,children:`Step 3 — Stream the response (token-by-token UX)`}),`\n`,_jsxs(_components.p,{children:[`For a real chat UI you want text to appear word-by-word. Add `,_jsx(_components.code,{children:`stream: true`}),`\nand read the SSE stream:`]}),`\n`,_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`Python`,numberOfLines:`22`,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:`22`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` json`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`}
637,children:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` chat_stream`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`qlaud_secret`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`str`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`thread_id`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`str`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`user_msg`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`str`}),_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:`    with`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` requests.post(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`        f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`QLAUD`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`/v1/threads/`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`thread_id`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},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:`#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:`{`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"x-api-key\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: qlaud_secret, `}),_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`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`        json`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`            \"model\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"claude-sonnet-4-6\"`}),_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:`            \"max_tokens\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1024`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`            \"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: user_msg,`})]}),`\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`}
637,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`,_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`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    ) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` r:`})]}),`\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:` r.iter_lines(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`decode_unicode`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`True`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`):`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`            if`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` not`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` line `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`or`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` not`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` line.startswith(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"data: \"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`):`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`                continue`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`            event `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` json.loads(line[`}),_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:` event.get(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`==`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"content_block_delta\"`}),_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:`                delta `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` event.get(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"delta\"`}),_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:` delta.get(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`==`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"text_delta\"`}),_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:`                    yield`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` delta[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"text\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})]}),`\n`]})})}
637),_jsx(CodeBlock,{filename:`TypeScript`,numberOfLines:`43`,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:`43`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`export`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` async`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` function*`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` chatStream`}),_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:`  qlaudSecret`}),_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:`  threadId`}),_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:`  userMsg`}),_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:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` AsyncGenerator`}),_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:`\u003e {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`  const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` r`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` fetch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`\"}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`QLAUD`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`/v1/threads/`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`threadId`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`}
637,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\":`#9CDCFE`},children:`    method:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'POST'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    headers:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'x-api-key'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` qlaudSecret`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'content-type'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'application/json'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    body:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` JSON`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`stringify`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`      model:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'claude-sonnet-4-6'`}),_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:`      max_tokens:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1024`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`      content:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` userMsg`}),_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`,_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:`#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:`r`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`body`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`return`}),_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`}
637,children:`  const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` reader`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` r`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`body`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`getReader`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`  const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` dec`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` TextDecoder`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`  let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` buffer`}),_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:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`  while`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`true`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`    const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`done`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`value`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` reader`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`read`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`    if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`done`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`break`}),_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:`    buffer`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` +=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` dec`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`decode`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`value`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`}
637,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:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`    let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` idx`}),_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:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`    while`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ((`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`idx`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` buffer`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`indexOf`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\n`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)) `}),_jsx(_components.span,{style:{color:`#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\":`#569CD6`},children:`      const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` line`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` buffer`}),_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:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`idx`}),_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:`      buffer`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` buffer`}),_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:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`idx`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` +`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\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`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`      try`}),_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`}
637,children:`        const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` event`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` JSON`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`parse`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`line`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`slice`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`6`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`));`})]}),`\n`,_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:` (`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`          event`}),_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:` 'content_block_delta'`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` \u0026\u0026`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`          event`}),_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:`type`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ===`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'text_delta'`})]}),`\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:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`          yield`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` event`}),_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:`text`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` as`}),_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`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`      } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`catch`}),_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:`        // partial JSON between chunks — wait for next read`})}),`\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:`Frontend: pipe each yielded chunk straight into your UI. After the stream\ncloses, qlaud has already persisted the full assistant turn for you.`}),`\n`,_jsx(Heading,{level:`2`,id:`step-4-%E2%80%94-add-a-tool`,children:`Step 4 — Add a tool`}),`\n`,_jsx(_components.p,{children:`Let’s give the assistant the ability to look up user account info. Two\nparts: register the tool with qlaud, then host the webhook.`}),`\n`,_jsx(Heading,{level:`3`,id:`register-the-tool-one-time`,children:`Register the tool (one-time)`}),`\n`,_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`Python`,numberOfLines:`18`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes g
637ithub-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:`18`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` register_account_lookup_tool`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`():`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    r `}),_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:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`        f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`QLAUD`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`/v1/tools\"`}),_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:`{`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"x-api-key\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`MASTER`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"content-type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#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`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`        json`}),_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:`            \"name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"lookup_account\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`            \"description\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Look up a customer's account info by email\"`}),_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_schema\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`                \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"object\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`                \"properties\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`                    \"email\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"string\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"description\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Customer email\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`                },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`                \"required\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"email\"`}),_jsx(_components.span,{style:{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:`            \"webhook_url\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"https://my-app.example/qlaud/tools/account-lookup\"`}),_jsx(_components.span,{style:{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:`    ).json()`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`    return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` r[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`], r[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"secret\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]   `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# store both — secret is returned ONCE`})]}),`\n`]})})}
637),_jsx(CodeBlock,{filename:`TypeScript`,numberOfLines:`20`,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:`20`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`export`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` async`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` function`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` registerAccountLookupTool`}),_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:` r`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` fetch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`\"}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`QLAUD`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"/v1/tools`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    method:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'POST'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    headers:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'x-api-key'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` MASTER`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'content-type'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'application/json'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    body:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` JSON`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`stringify`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`      name:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'lookup_account'`}),_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:`      description:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Look up a customer's account info by email\"`}),_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_schema:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`        type:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'object'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`        properties:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`          email:`}),_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:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'string'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`description:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'Customer email'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`        },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`        required:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'email'`}),_jsx(_components.span,{style:{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:`      webhook_url:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'https://my-app.example/qlaud/tools/account-lookup'`}),_jsx(_components.span,{style:{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:`#CF222E`,\"--shiki-dark\":`#569CD6`}
637,children:`  const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` t`}),_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:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_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:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`json`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`()) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},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:`; `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`secret`}),_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:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`  return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`id:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` t`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`id`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`secret:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` t`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`secret`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` };  `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// store both — secret is returned ONCE`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})})]}),`\n`,_jsx(Heading,{level:`3`,id:`host-the-webhook-your-backend`,children:`Host the webhook (your backend)`}),`\n`,_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`Python`,numberOfLines:`35`,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:`35`,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:` hmac, hashlib`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` flask `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Flask, request, jsonify`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`app `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Flask(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#9CDCFE`},children:`__name__`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`TOOL_SECRET`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` os.environ[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"QLAUD_TOOL_SECRET_LOOKUP_ACCOUNT\"`}),_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`}
637,children:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` verify_signature`}),_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:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`body_bytes`}),_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:`    ts `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` headers.get(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"X-Qlaud-Timestamp\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    sig `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` headers.get(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"X-Qlaud-Signature\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    expected `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` hmac.new(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`        TOOL_SECRET`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.encode(),`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`        f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`ts`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`.`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`body_bytes.decode()`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.encode(),`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`        hashlib.sha256,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    ).hexdigest()`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`    return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` hmac.compare_digest(sig, expected)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`@app.post`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"/qlaud/tools/account-lookup\"`}),_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`}
637,children:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` account_lookup`}),_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:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` not`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` verify_signature(request.headers, request.get_data()):`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`        return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` jsonify({`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"bad signature\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}), `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`401`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    payload `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` request.get_json()`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    email `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` payload[`}),_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:`\"email\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`    # Your business logic — DB query, internal API, etc.`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    account `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` my_db.find_account(email)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`    if`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` not`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` account:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`        return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` jsonify({`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"output\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"no account found\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"is_error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`}
637,children:`True`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`})`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`    return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` jsonify({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`        \"output\"`}),_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:`            \"plan\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: account.plan,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`            \"credits_remaining\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: account.credits,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`            \"joined_at\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: account.joined_at.isoformat(),`})]}),`\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:`TypeScript`,numberOfLines:`38`,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`,
637numberOfLines:`38`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`Hono`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'hono'`}),_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:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`createHmac`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`timingSafeEqual`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'node:crypto'`}),_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:` app`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` Hono`}),_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:` TOOL_SECRET`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},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:`env`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`QLAUD_TOOL_SECRET_LOOKUP_ACCOUNT`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`!`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`function`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` verifySignature`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},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:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` Headers`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`bodyText`}),_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:` boolean`}),_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`}
637,children:`  const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` ts`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--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:`'x-qlaud-timestamp'`}),_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:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` ''`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`  const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` sig`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--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:`'x-qlaud-signature'`}),_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:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` ''`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`  const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` expected`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` createHmac`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'sha256'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`TOOL_SECRET`}),_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:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`update`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`\"}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`ts`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`.`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`bodyText`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`}
637,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:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    .`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`digest`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'hex'`}),_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:`sig`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#9CDCFE`},children:`length`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` !==`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` expected`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#9CDCFE`},children:`length`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`return`}),_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:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`  return`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` timingSafeEqual`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`Buffer`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`sig`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`), `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`Buffer`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`expected`}),_jsx(_components.span,{style:{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:`app`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`post`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'/qlaud/tools/account-lookup'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`}
637,children:`async`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`c`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=\u003e`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`  // Read raw body BEFORE parsing — HMAC needs the exact bytes.`})}),`\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:` bodyText`}),_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:` c`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`req`}),_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`,_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:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`verifySignature`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`c`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`req`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`raw`}),_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:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`bodyText`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`    return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` c`}),_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:`({ `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`error:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'bad signature'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`401`}),_jsx(_components.span,{style:{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:`#CF222E`,\"--shiki-dark\":`#569CD6`}
637,children:`  const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` payload`}),_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:`bodyText`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`input`}),_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:`email`}),_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`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`  // Your business logic — DB query, internal API, etc.`})}),`\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:` account`}),_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:` myDb`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`findAccount`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`payload`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`input`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`email`}),_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:`account`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`    return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` c`}),_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:`({ `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`output:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'no account found'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`is_error:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`}
637,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`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`  return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` c`}),_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:`    output:`}),_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:`      plan:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` account`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`plan`}),_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:`      credits_remaining:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` account`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`credits`}),_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:`      joined_at:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` account`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`joinedAt`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`toISOString`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(),`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  });`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`]})})})]}),`\n`,_jsx(Heading,{level:`3`,id:`use-the-tool-in-a-conversation`,children:`Use the tool in a conversation`}),`\n`,_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`Python`,numberOfLines:`12`,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:`12`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` chat_with_tools`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`qlaud_secret`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`thread_id`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`user_msg`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`tool_ids`}),_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:`    r `}),_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:`#CF222E`,\"--shiki-dark\":`#569CD6`}
637,children:`        f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`QLAUD`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`/v1/threads/`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`thread_id`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},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:`#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:`{`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"x-api-key\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: qlaud_secret, `}),_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`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`        json`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`            \"model\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"claude-sonnet-4-6\"`}),_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:`            \"max_tokens\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1024`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`            \"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: user_msg,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`            \"tools\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: tool_ids,`})]}),`\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:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`    return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` r.json()[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})]}),`\n`]})})}
637),_jsx(CodeBlock,{filename:`TypeScript`,numberOfLines:`19`,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:`19`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`export`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` async`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` function`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` chatWithTools`}),_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:`  qlaudSecret`}),_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:`  threadId`}),_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:`  userMsg`}),_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:`  toolIds`}),_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:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` Promise`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`unknown`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[]\u003e {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`  const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` r`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` fetch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`\"}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`QLAUD`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`}
637,children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`/v1/threads/`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`threadId`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},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\":`#9CDCFE`},children:`    method:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'POST'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    headers:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'x-api-key'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` qlaudSecret`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'content-type'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'application/json'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`    body:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` JSON`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`stringify`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`      model:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'claude-sonnet-4-6'`}),_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:`      max_tokens:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1024`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`      content:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` userMsg`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`      tools:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` toolIds`}),_jsx(_components.span,{style:{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:`#CF222E`,\"--shiki-dark\":`#569CD6`}
637,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:`#1F2328`,\"--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:` r`}),_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:`()) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`as`}),_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:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` unknown`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[] };`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`  return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` body`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`content`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})})]}),`\n`,_jsxs(_components.p,{children:[`What happens when the user asks `,_jsx(_components.em,{children:`“what plan am I on?”`}),` and you pass\n`,_jsx(_components.code,{children:`tool_ids=[lookup_account_id]`}),`:`]}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsx(_components.li,{children:`qlaud sends the question + tool definition to Claude`}),`\n`,_jsxs(_components.li,{children:[`Claude emits a `,_jsx(_components.code,{children:`tool_use`}),` block: `,_jsx(_components.code,{children:`lookup_account({email: \"[email protected]\"})`})]}),`\n`,_jsx(_components.li,{children:`qlaud POSTs to your webhook with the input`}),`\n`,_jsxs(_components.li,{children:[`Your handler queries your DB and returns `,_jsx(_components.code,{children:`{output: {plan: \"pro\", ...}}`})]}),`\n`,_jsxs(_components.li,{children:[`qlaud appends a `,_jsx(_components.code,{children:`tool_result`}),` to the conversation`]}),`\n`,_jsxs(_components.li,{children:[`Claude reads the tool result and responds: `,_jsx(_components.em,{children:`“You’re on the Pro plan…”`})]}),`\n`,_jsx(_components.li,{children:`You get the final text response`}),`\n`]}),`\n`,_jsx(_components.p,{children:`You wrote ~20 lines (one webhook handler). qlaud orchestrated the rest —\nincluding signature verification, retries on transient failures, parallel\ndispatch when multiple tools fire at once, and persistence of the entire\ndance for audit.`}),`\n`,_jsx(Heading,{level:`2`,id:`step-5-%E2%80%94-search-the-user%E2%80%99s-history`,children:`Step 5 — Search the user’s history`}),`\n`,_jsxs(_components.p,{children:[`Your end-user wants to find a past conversation: `,_jsx(_components.em,{children:`“What did we discuss\nabout refunds last week?”`}),` No vector DB to provision; semantic search is\nalready indexed:`]}),`\n`,_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`Python`,numberOfLines:`7`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`}
637,language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`7`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` search_user_history`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`end_user_id`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`str`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`query`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`str`}),_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:`    r `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` requests.get(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`        f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`QLAUD`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`/v1/search\"`}),_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:`{`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"x-api-key\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`MASTER`}),_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:`        params`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"q\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: query, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"end_user_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: end_user_id, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"limit\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`10`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`},`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    ).json()`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`    return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` r[`}),_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:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# list of {thread_id, seq, role, snippet, score, created_at}`})]}),`\n`]})})}
637),_jsx(CodeBlock,{filename:`TypeScript`,numberOfLines:`19`,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:`19`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`export`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` async`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` function`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` searchUserHistory`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`endUserId`}),_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:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`query`}),_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:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`  const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` url`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` URL`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`\"}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`QLAUD`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"/v1/search`\"}),_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:`  url`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`searchParams`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`set`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'q'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`query`}),_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:`  url`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`searchParams`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`set`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'end_user_id'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`endUserId`}),_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:`  url`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`searchParams`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`set`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'limit'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'10'`}),_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`}
637,children:`  const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` r`}),_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:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`url`}),_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:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'x-api-key'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` MASTER`}),_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:`#1F2328`,\"--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:` r`}),_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:`()) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`as`}),_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:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` Array`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c{`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`      thread_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:`      seq`}),_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:`      role`}),_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:`      snippet`}),_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:`      score`}),_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:`      created_at`}),_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`,_jsx(_components.span,{className:`line`,children:_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`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`  return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` body`}),_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`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})})]}
637),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`end_user_id`}),` filter scopes results to ONE of your end-users — they only\nsee their own past conversations, never any other customer’s. The\nunderlying Vectorize index handles that filter at the metadata layer.`]}),`\n`,_jsx(Heading,{level:`2`,id:`step-6-%E2%80%94-bill-at-month-end`,children:`Step 6 — Bill at month-end`}),`\n`,_jsx(_components.p,{children:`End of month, pull per-key usage and invoice however you want\n(Stripe, Paddle, in-app credits, custom):`}),`\n`,_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`Python`,numberOfLines:`21`,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:`21`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` datetime `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` datetime, timezone, timedelta`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` monthly_bill_run`}),_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:`    now `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` datetime.now(timezone.utc)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    from_ms `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` int`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`((now `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`-`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` timedelta(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`days`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`30`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)).timestamp() `}),_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`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    to_ms `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` int`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(now.timestamp() `}),_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`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`    rollup `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` requests.get(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`}
637,children:`        f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`QLAUD`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`/v1/usage\"`}),_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:`{`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"x-api-key\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`MASTER`}),_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:`        params`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"from_ms\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: from_ms, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"to_ms\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: to_ms},`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_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:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`    for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` row `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`in`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` rollup[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"by_key\"`}),_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:`        end_user `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` lookup_user_by_qlaud_key_id(row[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"key_id\"`}),_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:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` not`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` end_user:`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`            continue`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`        upstream_cost_usd `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` row[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"cost_micros\"`}),_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\":`#B5CEA8`},children:` 1_000_000`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`        margin `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` upstream_cost_usd `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0.50`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`          # whatever you charge`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`        bill_usd `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` round`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(upstream_cost_usd `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`+`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` margin, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`4`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`        my_billing_tool.charge(end_user, bill_usd)`})}),`\n`]})})}
637),_jsx(CodeBlock,{filename:`TypeScript`,numberOfLines:`22`,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:`22`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`export`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` async`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` function`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` monthlyBillRun`}),_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:` now`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` Date`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`now`}),_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:` fromMs`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` now`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` -`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 30`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` *`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 24`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` *`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 60`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` *`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 60`}),_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`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`  const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` url`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` URL`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`\"}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`QLAUD`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"/v1/usage`\"}),_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:`  url`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`searchParams`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`set`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'from_ms'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`String`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`fromMs`}),_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:`  url`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`searchParams`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`set`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'to_ms'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`String`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`now`}),_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`}
637,children:`  const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` r`}),_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:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`url`}),_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:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'x-api-key'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` MASTER`}),_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:` rollup`}),_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:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_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:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`json`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`()) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`as`}),_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:`    by_key`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` Array`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c{ `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`key_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:`; `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`cost_micros`}),_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:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`request_count`}),_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:` }\u003e;`})]}),`\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:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`}
637,children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` row`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` of`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` rollup`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`by_key`}),_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:` endUser`}),_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:` lookupUserByQlaudKeyId`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`row`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`key_id`}),_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:`endUser`}),_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`,_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:` upstreamCostUsd`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` row`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`cost_micros`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` /`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1_000_000`}),_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:` margin`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` upstreamCostUsd`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` *`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0.5`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;          `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// whatever you charge`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`}
637,children:`    const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` billUsd`}),_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:`upstreamCostUsd`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` +`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` margin`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`).`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`toFixed`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`4`}),_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:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` myBillingTool`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`charge`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`endUser`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`billUsd`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`  }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})})]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`cost_micros`}),` is what qlaud charged YOU (upstream cost × 1.07 markup).\nWhatever margin you put on top of that is yours.`]}),`\n`,_jsx(Heading,{level:`2`,id:`what-you-didn%E2%80%99t-build`,children:`What you didn’t build`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`If you didn’t have qlaud you’d have written`}),_jsx(_components.th,{children:`Where qlaud handles it`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[`Postgres `,_jsx(_components.code,{children:`conversations`}),` + `,_jsx(_components.code,{children:`messages`}),` tables`]}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`/v1/threads/:id/messages`}),` auto-loads history`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`”Drop oldest message when context exceeds N tokens”`}),_jsx(_components.td,{children:`History capped automatically; token-aware truncation later`})]}),_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[`Tool-call state machine: parse `,_jsx(_components.code,{children:`tool_use`}),`, dispatch, append `,_jsx(_components.code,{children:`tool_result`}),`, re-call assistant`]}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`runToolLoop`}),` — loops up to 8 turns, dispatches in parallel, retries on 5xx`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Embedding pipeline + Pinecone client`}),_jsxs(_components.td,{children:[`Auto-embed on store, Vectorize-backed `,_jsx(_components.code,{children:`/v1/search`})]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Per-user cost attribution table`}
637),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`/v1/usage?by_key`}),` rolls up automatically`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Webhook delivery: signing, retries, dedup`}),_jsx(_components.td,{children:`HMAC-SHA256 signing + 3 retries built in`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Streaming SSE handler that ALSO persists the full message after the stream closes`}),_jsx(_components.td,{children:`Tee’d internally — you stream to user, we persist for search`})]})]})]}),`\n`,_jsxs(_components.p,{children:[`Roughly `,_jsx(_components.strong,{children:`300–500 lines of glue`}),` per AI app, deleted.`]}),`\n`,_jsx(Heading,{level:`2`,id:`next-steps`,children:`Next steps`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Switch models per turn`}),` — change `,_jsx(_components.code,{children:`model:`}),` to `,_jsx(_components.code,{children:`gpt-5.4`}),` mid-conversation;\nhistory persists, qlaud translates the shape.`]}),`\n`,_jsxs(_components.li,{children:[_jsxs(_components.strong,{children:[`Use `,_jsx(_components.a,{href:`/api-reference/jobs`,children:`/v1/jobs`})]}),` for long-running batch work that\nshouldn’t block your request thread.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Parallel tool calls`}),` happen automatically — when the assistant emits\nmultiple `,_jsx(_components.code,{children:`tool_use`}),` blocks, qlaud fans out via `,_jsx(_components.code,{children:`Promise.all`}),`. No code\nchange needed.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Per-user spend caps`}),` are already enforced gateway-side. Once a user\nhits their `,_jsx(_components.code,{children:`max_spend_usd`}),` cap, the next request returns 402 before the\nupstream model is ever called.`]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`Need help wiring this into an existing codebase? Email\n`,_jsx(_components.a,{href:`mailto:[email protected]`,children:`[email protected]`}),`.`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}"])</script>
637<script>self.__next_f.push([1,"52:[\"$\",\"$L53\",null,{\"pageMetadata\":\"$1a:props:children:props:pageMetadata\",\"mdxExtracts\":\"$1a:props:children:props:children:props:children:props:value:mdxExtracts\",\"openApiReferenceData\":\"$undefined\",\"children\":[\"$\",\"$L54\",null,{\"children\":[[\"$\",\"script\",null,{\"type\":\"application/ld+json\",\"dangerouslySetInnerHTML\":{\"__html\":\"$55\"}}],[[\"$\",\"script\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"document.documentElement.setAttribute('data-page-mode', \\\"none\\\");\"}}],[\"$\",\"$L56\",null,{\"pageMetadata\":\"$1a:props:children:props:pageMetadata\"}]],[\"$\",\"$L57\",null,{\"pageMetadata\":\"$1a:props:children:props:pageMetadata\"}],[],[\"$\",\"$L58\",null,{\"customJsDisabled\":false,\"jsFiles\":[]}],[\"$\",\"$L59\",null,{\"slug\":\"guides/build-a-chat-app\",\"pageMetadata\":\"$1a:props:children:props:pageMetadata\",\"theme\":\"mint\",\"children\":[\"$\",\"$L5a\",null,{\"mdxSource\":{\"compiledSource\":\"$5b\",\"frontmatter\":{},\"scope\":{\"config\":{},\"pageMetadata\":{\"title\":\"Build a chat app on qlaud\",\"description\":\"End-to-end tutorial: per-user threads, tool integration, semantic search, streaming UX, and per-end-user billing — no Postgres, no vector DB, no message store of your own.\",\"href\":\"/guides/build-a-chat-app\"}}},\"mdxSourceWithNoJs\":\"$undefined\",\"displayDomain\":\"docs.qlaud.ai\"}]}]]}]}]\n"])</script>
637</body></html>

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.