Python SDK
lagclient
Sync and async clients, fully typed with Pydantic v2 models. Python 3.9 through 3.13.
pip install lagclientDevelopers
Official SDKs for Python and TypeScript. Typed, tested, and open source. Ship bots, integrations, and tooling on the Lag API in minutes.
lagclient
Sync and async clients, fully typed with Pydantic v2 models. Python 3.9 through 3.13.
pip install lagclient@lagapp/sdk
Zero runtime dependencies, ESM first, ships .d.ts declarations. Node 18+ with the global fetch.
npm install @lagapp/sdkfrom lagclient import Client
with Client(token="lag_pat_...") as client:
who = client.identity()
print(f"Hello, {who.display_name}")
for server in client.servers.list():
print(server.name) AsyncClient:import asyncio
from lagclient import AsyncClient
async def main() -> None:
async with AsyncClient(token="lag_pat_...") as client:
me = await client.users.me()
async for page in client.servers.paginate():
for server in page.items:
print(server.name)
asyncio.run(main())import { LagClient } from '@lagapp/sdk';
const client = new LagClient({ token: 'lag_pat_...' });
const who = await client.identity();
console.log(`Hello, ${who.displayName}`);
const servers = await client.servers.list();
for (const server of servers) {
console.log(server.name);
} Requires Node 18+. Uses the global fetch, no extra HTTP client to install.
The SDK accepts a Personal Access Token (lag_pat_*) for code acting on behalf of a user, or a robot API key (lag_robot_*) for bots that act as their own server-scoped identity. Same parameter, same methods, same shapes.
from lagclient import Client
# Robot API keys (lag_robot_*) use the same Client.
with Client(token="lag_robot_abcd1234_...") as bot:
me = bot.identity()
print(me.display_name, me.permissions)
bot.servers.rooms.messages.send(
me.server_id, "room_id", content="Hello from a robot"
)import { LagClient } from '@lagapp/sdk';
// Robot API keys (lag_robot_*) use the same LagClient.
const bot = new LagClient({ token: 'lag_robot_abcd1234_...' });
const me = await bot.identity();
console.log(me.displayName, me.permissions);
await bot.servers.rooms.messages.send(me.serverId!, 'room_id', {
content: 'Hello from a robot',
});The SDK detects the token prefix and switches the Authorization scheme automatically. Server-scoped methods route to the right endpoints under the hood.
Every request, response, and error has a type. Your editor does the work so you can ship faster.
Transient 5xx, 429, and network errors retry with exponential backoff. Retry-After on 429 is honored.
Walk large result sets with async iterators. No manual cursor juggling, no off-by-one bugs.
Auth, permission, conflict, rate limit, and server errors are distinct exception classes you can catch.
Both SDKs are open source under the MIT license. Fork them, audit them, ship them.
Issues, PRs, and roadmap are public on GitHub. File a bug or ship a feature.
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.
API referenceAlso open source
Written in Rust. Join voice rooms, send messages, and manage servers straight from your terminal. MIT licensed and built in the open.
Ready to build