PageSourceSearch

https://trylag.com/_app/immutable/nodes/34.BBjULvJd.js

js trylag.com collected 2026-10-02 01:48:42 UTC 19,839 bytes, 47 lines download raw bytes

1import{a as p,t as Ge,f as x}from"../chunks/XBPcOMAO.js";import"../chunks/C7ToEaLh.js";import{p as kr,f as _,a as wr,g as d,s as t,c as r,m as Pr,n as c,r as e,t as A}from"../chunks/BS5htO1W.js";import{s as m}from"../chunks/BJC_Ma-R.js";import{e as L}from"../chunks/BMYI38h-.js";import{a as v}from"../chunks/6PmB5ybw.js";import{s as ee}from"../chunks/5tDKdvOm.js";import{i as Sr}from"../chunks/DqQZZe7L.js";import{B as h}from"../chunks/DVA1rhza.js";import{F as n}from"../chunks/BO3ZoEoB.js";import{b as re,c as te,d as y,e as Cr}from"../chunks/EgswUD8K.js";import{B as K,C as $r,D as Oe,E as Dr,F as Ir,G as Tr,o as Ar,H as Lr,s as Kr,I as Rr,J as jr,K as Me,L as We,i as Nr}from"../chunks/bSiEWsuN.js";import{S as Br}from"../chunks/BTx1qHaC.js";import{w as Hr,b as Er}from"../chunks/BPspio9G.js";import{s as u}from"../chunks/937ubDn0.js";var Fr=x("Quickstart <!>",1),qr=x('<article class="flex flex-col rounded-lg border border-border bg-surface p-6"><div class="flex items-center gap-3"><div class="inline-flex h-10 w-10 items-center justify-center rounded-lg border border-border bg-background text-lag-accent"><!></div> <div><h2 class="text-sm font-semibold uppercase tracking-[0.06em] text-foreground"> </h2> <p class="font-mono text-[11px] text-text-secondary"> </p></div></div> <p class="mt-4 flex-1 text-xs leading-relaxed text-muted-foreground"> </p> <div class="mt-4 flex items-center gap-2 rounded-lg border border-border bg-background px-3 py-2 font-mono text-[11px] text-foreground"><!> <code> </code></div> <div class="mt-4 flex flex-wrap gap-2"><a rel="noopener" target="_blank" class="inline-flex items-center gap-1.5 rounded-lg border border-border bg-background px-3 py-1.5 text-[10px] font-semibold uppercase tracking-[0.08em] text-foreground hover:border-lag-accent/40 hover:bg-surface-hover transition-colors duration-150"><!> </a> <a rel="noopener" target="_blank" class="inline-flex items-center gap-1.5 rounded-lg border border-border bg-background px-3 py-1.5 text-[10px] font-semibold uppercase tracking-[0.08em] text-foreground hover:border-lag-accent/40 hover:bg-surface-hover transition-colors duration-150"><!> Source</a></div></article>'),Ur=x('<article class="bg-background flex flex-col p-5"><div class="inline-flex h-9 w-9 items-center justify-center rounded-lg border border-border bg-surface text-primary"><!></div> <h3 class="mt-3 text-sm font-semibold text-foreground"> </h3> <p class="mt-1.5 text-xs leading-relaxed text-muted-foreground"> </p></article>'),Gr=x('<li class="flex items-start gap-2"><!> <span class="text-xs text-foreground"> </span></li>'),Or=x('<a rel="noopener" target="_blank" class="group flex items-center gap-3 bg-background p-5 hover:bg-surface-hover transition-colors duration-150"><div class="inline-flex h-9 w-9 items-center justify-center rounded-lg border border-border bg-surface text-lag-accent"><!></div> <span class="flex-1 text-xs font-semibold text-foreground"> </span> <!></a>'),Mr=x("<!> Source",1),Wr=x("<!> Get Python SDK",1),Jr=x("<!> Get Node SDK",1),zr=x(`<!> <div class="px-6 py-8"><div class="mx-auto w-full max-w-[1180px] space-y-10"><section class="relative overflow-hidden px-8 py-16 text-center md:px-12 md:py-24"><div class="absolute inset-0 pointer-events-none"><div class="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[700px] h-[700px] rounded-full bg-[radial-gradient(circle,rgba(98,187,193,0.10)_0%,rgba(98,187,193,0.03)_40%,transparent_70%)]"></div></div> <div class="relative z-10"><p class="text-[11px] font-semibold uppercase tracking-[0.08em] text-text-secondary">Developers</p> <h1 class="mx-auto mt-3 max-w-[720px] text-4xl font-medium tracking-[-0.03em] text-foreground md:text-5xl">Build on Lag.</h1> <p class="mx-auto mt-4 max-w-[620px] text-sm leading-relaxed text-muted-foreground">Official SDKs for Python and TypeScript. Typed, tested, and open source. Ship bots, integrations, and tooling on the Lag API in minutes.</p> <div class="mt-7 flex flex-wrap justify-center gap-2"><!> <!></div></div></section> <section class="grid gap-4 md:grid-cols-2" aria-label="Official SDKs"></section> <section id="quickstart" class="border border-border bg-surface rounded-lg scroll-mt-20"><div class="border-b border-border px-6 py-4 text-[11px] font-semibold uppercase tracking-[0.08em] text-text-secondary">Quickstart</div> <div class="grid gap-px bg-border md:grid-cols-2"><div class="bg-background p-6"><div class="flex items-center gap-2"><!> <h3 class="text-sm font-semibold uppercase tracking-[0.06em] text-foreground">Python</h3></div> <pre class="mt-4 overflow-x-auto rounded-lg border border-border bg-card p-4 font-mono text-[11px] leading-relaxed text-foreground"><code></code></pre> <div class="mt-4 flex items-center gap-2"><!> <span class="text-[11px] text-text-secondary">Also ships an <code class="font-mono text-foreground">AsyncClient</code>:</span></div> <pre class="mt-2 overflow-x-auto rounded-lg border border-border bg-card p-4 font-mono text-[11px] leading-relaxed text-foreground"><code></code></pre></div> <div class="bg-background p-6"><div class="flex items-center gap-2"><!> <h3 class="text-sm font-semibold uppercase tracking-[0.06em] text-foreground">Node / TypeScript</h3></div> <pre class="mt-4 overflow-x-auto rounded-lg border border-border bg-card p-4 font-mono text-[11px] leading-relaxed text-foreground"><code></code></pre> <div class="mt-4 rounded-lg border border-border bg-card p-4"><p class="text-[11px] text-text-secondary"><!> Requires Node 18+. Uses the global <code class="font-mono text-foreground">fetch</code>, no extra HTTP client to install.</p></div></div></div></section> <section class="border border-border bg-surface rounded-lg"><div class="border-b border-border px-6 py-4 text-[11px] font-semibold uppercase tracking-[0.08em] text-text-secondary">One client, two credential types</div> <div class="grid gap-px bg-border md:grid-cols-[1fr_1.5fr]"><div class="bg-background p-6 md:p-8"><div class="inline-flex h-10 w-10 items-center justify-center rounded-lg border border-border bg-surface text-lag-accent"><!></div> <h2 class="mt-4 text-2xl font-medium tracking-[-0.02em] text-foreground">Personal tokens or robot keys.</h2> <p class="mt-3 text-sm leading-relaxed text-muted-foreground">The SDK accepts a Personal Access Token (<code class="font-mono text-foreground">lag_pat_*</code>) for code acting on behalf of a user, or a robot API key (<code class="font-mono text-foreground">lag_robot_*</code>) for bots that act as their own server-scoped identity. Same parameter, same methods, same shapes.</p> <a href="/docs/robots/creating-robots" class="mt-4 inline-flex items-center gap-1.5 text-xs font-semibold uppercase tracking-[0.08em] text-primary hover:underline">How to create a robot <!></a></div> <div class="bg-background p-6 md:p-8 space-y-3"><div class="flex items-center gap-2"><!> <h3 class="text-sm font-semibold uppercase tracking-[0.06em] text-foreground">Robot quickstart</h3></div> <div class="grid gap-3 lg:grid-cols-2"><div><div class="text-[10px] font-semibold uppercase tracking-[0.08em] text-text-secondary mb-1.5">Python</div> <pre class="overflow-x-auto rounded-lg border border-border bg-card p-4 font-mono text-[11px] leading-relaxed text-foreground"><code></code></pre></div> <div><div class="text-[10px] font-semibold uppercase tracking-[0.08em] text-text-secondary mb-1.5">TypeScript</div> <pre class="overflow-x-auto rounded-lg border border-border bg-card p-4 font-mono text-[11px] leading-relaxed text-foreground"><code></code></pre></div></div> <p class="text-[11px] text-text-secondary"><!> The SDK detects the token prefix and switches the Authorization scheme automatically. Server-scoped methods route to the right endpoints under the hood.</p></div></div></section> <section class="border border-border bg-surface rounded-lg"><div class="border-b border-border px-6 py-4 text-[11px] font-semibold uppercase tracking-[0.08em] text-text-secondary">What's in the box</div> <div class="grid gap-px bg-border sm:grid-cols-2 lg:grid-cols-3"></div></section> <section class="border border-border bg-surface rounded-lg"><div class="border-b border-border px-6 py-4 text-[11px] font-semibold uppercase tracking-[0.08em] text-text-secondary">
1API coverage</div> <div class="grid gap-px bg-border md:grid-cols-[1fr_1.5fr]"><div class="bg-background p-6 md:p-8"><h2 class="text-2xl font-medium tracking-[-0.02em] text-foreground">Everything you need for REST.</h2> <p class="mt-3 text-sm leading-relaxed text-muted-foreground">Both SDKs cover the full public REST surface. WebSocket and voice are intentionally out of scope - use the native apps or the CLI for those.</p> <a href="/docs/robots/api-reference" class="mt-4 inline-flex items-center gap-1.5 text-xs font-semibold uppercase tracking-[0.08em] text-primary hover:underline">API reference <!></a></div> <div class="bg-background p-6 md:p-8"><ul class="grid gap-3 sm:grid-cols-2"></ul></div></div></section> <section class="border border-border bg-surface rounded-lg"><div class="border-b border-border px-6 py-4 text-[11px] font-semibold uppercase tracking-[0.08em] text-text-secondary">Resources</div> <div class="grid gap-px bg-border sm:grid-cols-2 lg:grid-cols-4"></div></section> <section class="border border-border bg-surface rounded-lg"><div class="grid gap-px bg-border md:grid-cols-[2fr_1fr]"><div class="bg-background p-6 md:p-8"><p class="text-[11px] font-semibold uppercase tracking-[0.08em] text-primary"><!> Also open source</p> <h2 class="mt-2 text-2xl font-medium tracking-[-0.02em] text-foreground">The Lag CLI is open source too.</h2> <p class="mt-3 text-sm leading-relaxed text-muted-foreground">Written in Rust. Join voice rooms, send messages, and manage servers straight from your terminal. MIT licensed and built in the open.</p> <div class="mt-5 flex flex-wrap gap-2"><!> <!></div></div> <div class="bg-background p-6 md:p-8 flex items-center justify-center"><div class="inline-flex h-20 w-20 items-center justify-center rounded-lg border border-border bg-card text-lag-accent"><!></div></div></div></section> <section class="border border-border bg-foreground p-6 text-background md:p-8 rounded-lg"><p class="text-[11px] font-semibold uppercase tracking-[0.08em]">Ready to build</p> <h2 class="mt-2 text-3xl font-medium tracking-[-0.02em]">Install an SDK and ship your first integration.</h2> <div class="mt-6 flex flex-wrap gap-2"><!> <!></div></section></div></div>`,1);function lt(Je,ze){kr(ze,!1);const oe="https://trylag.com",R=`${oe}/developers`,Qe=[{name:"Python SDK",package:"lagclient",install:"pip install lagclient",icon:re,registryLabel:"PyPI",registryUrl:"https://pypi.org/project/lagclient/",github:"https://github.com/lag-app/sdk-python",description:"Sync and async clients, fully typed with Pydantic v2 models. Python 3.9 through 3.13."},{name:"Node / TypeScript SDK",package:"@lagapp/sdk",install:"npm install @lagapp/sdk",icon:te,registryLabel:"npm",registryUrl:"https://www.npmjs.com/package/@lagapp/sdk",github:"https://github.com/lag-app/sdk-node",description:"Zero runtime dependencies, ESM first, ships .d.ts declarations. Node 18+ with the global fetch."}],Ye=[{title:"Fully typed",description:"Every request, response, and error has a type. Your editor does the work so you can ship faster.",icon:Lr},{title:"Automatic retries",description:"Transient 5xx, 429, and network errors retry with exponential backoff. Retry-After on 429 is honored.",icon:Kr},{title:"Cursor pagination",description:"Walk large result sets with async iterators. No manual cursor juggling, no off-by-one bugs.",icon:Rr},{title:"Typed errors",description:"Auth, permission, conflict, rate limit, and server errors are distinct exception classes you can catch.",icon:jr},{title:"MIT licensed",description:"Both SDKs are open source under the MIT license. Fork them, audit them, ship them.",icon:Me},{title:"Developed in the open",description:"Issues, PRs, and roadmap are public on GitHub. File a bug or ship a feature.",icon:y}],Ze=[{name:"Python SDK on GitHub",url:"https://github.com/lag-app/sdk-python",icon:y},{name:"lagclient on PyPI",url:"https://pypi.org/project/lagclient/",icon:We},{name:"Node SDK on GitHub",url:"https://github.com/lag-app/sdk-node",icon:y},{name:"@lagapp/sdk on npm",url:"https://www.npmjs.com/package/@lagapp/sdk",icon:Cr}],ae="Developers | Lag Python and TypeScript SDKs",se="Official Lag SDKs for Python and Node. Install, quickstart, and reference links for lagclient (PyPI) and @lagapp/sdk (npm).";Sr();var ne=zr(),ie=_(ne);{let a=Pr(()=>[Hr(ae,se,R),Er([{name:"Home",url:oe},{name:"Developers",url:R}])]);Br(ie,{title:ae,description:se,canonicalUrl:R,get jsonLd(){return d(a)}})}var de=t(ie,2),ce=r(de),k=r(ce),le=t(r(k),2),pe=t(r(le),6),ge=r(pe);h(ge,{href:"#quickstart",class:"h-10 rounded-lg border border-primary bg-primary px-4 text-xs font-semibold uppercase tracking-[0.08em] text-primary-foreground hover:bg-primary/90",children:(a,o)=>{c();var s=Fr(),i=t(_(s));n(i,{get icon(){return K},class:"ml-2 h-3 w-3"}),p(a,s)},$$slots:{default:!0}});var Ve=t(ge,2);h(Ve,{href:"/docs/robots",variant:"outline",class:"h-10 rounded-lg border-border px-4 text-xs font-semibold uppercase tracking-[0.08em]",children:(a,o)=>{c();var s=Ge("API reference");p(a,s)},$$slots:{default:!0}}),e(pe),e(le),e(k),v(k,a=>{var o;return(o=u)==null?void 0:o(a)});var w=t(k,2);L(w,5,()=>Qe,a=>a.package,(a,o)=>{var s=qr(),i=r(s),g=r(i),l=r(g);n(l,{get icon(){return d(o).icon},class:"h-4 w-4"}),e(g);var f=t(g,2),b=r(f),Y=r(b,!0);e(b);var He=t(b,2),br=r(He,!0);e(He),e(f),e(i);var Z=t(i,2),fr=r(Z,!0);e(Z);var V=t(Z,2),Ee=r(V);n(Ee,{get icon(){return Nr},class:"h-3 w-3 text-text-secondary"});var Fe=t(Ee,2),hr=r(Fe,!0);e(Fe),e(V);var qe=t(V,2),T=r(qe),Ue=r(T);n(Ue,{get icon(){return We},class:"h-3 w-3"});var _r=t(Ue);e(T);var X=t(T,2),yr=r(X);n(yr,{get icon(){return y},class:"h-3 w-3"}),c(),e(X),e(qe),e(s),A(()=>{m(Y,d(o).name),m(br,d(o).package),m(fr,d(o).description),m(hr,d(o).install),ee(T,"href",d(o).registryUrl),m(_r,` ${d(o).registryLabel??""}`),ee(X,"href",d(o).github)}),p(a,s)}),e(w),v(w,a=>{var o;return(o=u)==null?void 0:o(a)});var P=t(w,2),me=t(r(P),2),j=r(me),N=r(j),Xe=r(N);n(Xe,{get icon(){return re},class:"h-4 w-4 text-lag-accent"}),c(2),e(N);var B=t(N,2),er=r(B);er.textContent=`from lagclient import Client
2
3with Client(token="lag_pat_...") as client:
4    who = client.identity()
5    print(f"Hello, {who.display_name}")
6
7    for server in client.servers.list():
8        print(server.name)`,e(B);var H=t(B,2),rr=r(H);n(rr,{get icon(){return $r},class:"h-3.5 w-3.5 text-text-secondary"}),c(2),e(H);var ve=t(H,2),tr=r(ve);tr.textContent=`import asyncio
9from lagclient import AsyncClient
10
11async def main() -> None:
12    async with AsyncClient(token="lag_pat_...") as client:
13        me = await client.users.me()
14        async for page in client.servers.paginate():
15            for server in page.items:
16                print(server.name)
17
18asyncio.run(main())`,e(ve),e(j);var ue=t(j,2),E=r(ue),or=r(E);n(or,{get icon(){return te},class:"h-4 w-4 text-lag-accent"}),c(2),e(E);var F=t(E,2),ar=r(F);ar.textContent=`import { LagClient } from '@lagapp/sdk';
19
20const client = new LagClient({ token: 'lag_pat_...' });
21
22const who = await client.identity();
23console.log(\`Hello, \${who.displayName}\`);
24
25const servers = await client.servers.list();
26for (const server of servers) {
27  console.log(server.name);
28}`,e(F);var xe=t(F,2),be=r(xe),sr=r(be);n(sr,{get icon(){return Oe},class:"mr-1.5 h-3 w-3 text-lag-accent"}),c(3),e(be),e(xe),e(ue),e(me),e(P),v(P,a=>{var o;return(o=u)==null?void 0:o(a)});var S=t(P,2),fe=t(r(S),2),q=r(fe),U=r(q),nr=r(U);n(nr,{get icon(){return Dr},class:"h-4 w-4"}),e(U);var he=t(U,6),ir=t(r(he));n(ir,{get icon(){return K},class:"h-2.5 w-2.5"}),e(he),e(q);var _e=t(q,2),G=r(_e),dr=r(G);n(dr,{get icon(){return Ir},class:"h-4 w-4 text-lag-accent"}),c(2),e(G);var O=t(G,2),M=r(O),ye=t(r(M),2),cr=r(ye);cr.textContent=`from lagclient import Client
29
30# Robot API keys (lag_robot_*) use the same Client.
31with Client(token="lag_robot_abcd1234_...") as bot:
32    me = bot.identity()
33    print(me.display_name, me.permissions)
34
35    bot.servers.rooms.messages.send(
36        me.server_id, "room_id", content="Hello from a robot"
37    )`,e(ye),e(M);var ke=t(M,2),we=t(r(ke),2),lr=r(we);lr.textContent=`import { LagClient } from '@lagapp/sdk';
38
39// Robot API keys (lag_robot_*) use the same LagClient.
40const bot = new LagClient({ token: 'lag_robot_abcd1234_...' });
41
42const me = await bot.identity();
43console.log(me.displayName, me.permissions);
44
45await bot.servers.rooms.messages.send(me.serverId!, 'room_id', {
46  content: 'Hello from a robot',
47});`,e(we),e(ke),e(O);var Pe=t(O,2),pr=r(Pe);n(pr,{get icon(){return Oe},class:"mr-1.5 h-3 w-3 text-lag-accent"}),c(),e(Pe),e(_e),e(fe),e(S),v(S,a=>{var o;return(o=u)==null?void 0:o(a)});var C=t(S,2),Se=t(r(C),2);L(Se,5,()=>Ye,a=>a.title,(a,o)=>{var s=Ur(),i=r(s),g=r(i);n(g,{get icon(){return d(o).icon},class:"h-4 w-4"}),e(i);var l=t(i,2),f=r(l,!0);e(l);var b=t(l,2),Y=r(b,!0);e(b),e(s),A(()=>{m(f,d(o).title),m(Y,d(o).description)}),p(a,s)}),e(Se),e(C),v(C,a=>{var o;return(o=u)==null?void 0:o(a)});var $=t(C,2),Ce=t(r($),2),W=r(Ce),$e=t(r(W),4),gr=t(r($e));n(gr,{get icon(){return K},class:"h-2.5 w-2.5"}),e($e),e(W);var De=t(W,2),Ie=r(De);L(Ie,4,()=>["Users & profiles","Friends & requests","Direct messages","Servers","Rooms & room messages","Events","Image uploads","Personal access tokens"],a=>a,(a,o)=>{var s=Gr(),i=r(s);n(i,{get icon(){return Me},class:"mt-0.5 h-3.5 w-3.5 text-lag-accent"});var g=t(i,2),l=r(g,!0);e(g),e(s),A(()=>m(l,o)),p(a,s)}),e(Ie),e(De),e(Ce),e($),v($,a=>{var o;return(o=u)==null?void 0:o(a)});var D=t($,2),Te=t(r(D),2);L(Te,5,()=>Ze,a=>a.url,(a,o)=>{var s=Or(),i=r(s),g=r(i);n(g,{get icon(){return d(o).icon},class:"h-4 w-4"}),e(i);var l=t(i,2),f=r(l,!0);e(l);var b=t(l,2);n(b,{get icon(){return K},class:"h-3 w-3 text-text-secondary group-hover:text-lag-accent group-hover:translate-x-0.5 transition-all duration-150"}),e(s),A(()=>{ee(s,"href",d(o).url),m(f,d(o).name)}),p(a,s)}),e(Te),e(D),v(D,a=>{var o;return(o=u)==null?void 0:o(a)});var I=t(D,2),Ae=r(I),J=r(Ae),z=r(J),mr=r(z);n(mr,{get icon(){return Tr},class:"mr-1 h-3 w-3"}),c(),e(z);var Le=t(z,6),Ke=r(Le);h(Ke,{href:"/apps/cli",class:"h-10 rounded-lg border border-primary bg-primary px-4 text-xs font-semibold uppercase tracking-[0.08em] text-primary-foreground hover:bg-primary/90",children:(a,o)=>{c();var s=Ge("Learn more");p(a,s)},$$slots:{default:!0}});var vr=t(Ke,2);h(vr,{href:"https://github.com/lag-app/cli",variant:"outline",class:"h-10 rounded-lg border-border px-4 text-xs font-semibold uppercase tracking-[0.08em]",children:(a,o)=>{var s=Mr(),i=_(s);n(i,{get icon(){return y},class:"mr-2 h-3 w-3"}),c(),p(a,s)},$$slots:{default:!0}}),e(Le),e(J);var Re=t(J,2),je=r(Re),ur=r(je);n(ur,{get icon(){return Ar},class:"h-8 w-8"}),e(je),e(Re),e(Ae),e(I),v(I,a=>{var o;return(o=u)==null?void 0:o(a)});var Q=t(I,2),Ne=t(r(Q),4),Be=r(Ne);h(Be,{href:"https://pypi.org/project/lagclient/",rel:"noopener",target:"_blank",class:"h-10 rounded-lg border border-[#62BBC1] bg-[#62BBC1] px-4 text-xs font-semibold uppercase tracking-[0.08em] text-[#080808] hover:bg-[#7ECCD1]",children:(a,o)=>{var s=Wr(),i=_(s);n(i,{get icon(){return re},class:"mr-2 h-3 w-3"}),c(),p(a,s)},$$slots:{default:!0}});var xr=t(Be,2);h(xr,{href:"https://www.npmjs.com/package/@lagapp/sdk",rel:"noopener",target:"_blank",variant:"outline",class:"h-10 rounded-lg border-background bg-transparent px-4 text-xs font-semibold uppercase tracking-[0.08em] text-background hover:bg-background/10",children:(a,o)=>{var s=Jr(),i=_(s);n(i,{get icon(){return te},class:"mr-2 h-3 w-3"}),c(),p(a,s)},$$slots:{default:!0}}),e(Ne),e(Q),v(Q,a=>{var o;return(o=u)==null?void 0:o(a)}),e(ce),e(de),p(Je,ne),wr()}export{lt as component};

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.