Choose your client
The official clients share the same defaults: Bot authentication, a 15-second timeout, standard Lyra errors and support for self-hosted nodes. Resource helpers cover users, communities, channels, messages and webhooks; a generic request method exposes the rest of the API.
| Language | Package | Runtime |
|---|---|---|
| Python | lyra-sdk | Python 3.9+ |
| Node.js / TypeScript | @lyra-social/sdk | Node.js 18+ |
| Rust | lyra-sdk | Async with Tokio |
Python
Install with pip, create a bot client and use the typed resource helpers. The Python client is synchronous and has no runtime dependency.
import os
from lyra import LyraClient
lyra = LyraClient.bot(os.environ["LYRA_BOT_TOKEN"])
me = lyra.users.me()
message = lyra.channels.send(os.environ["LYRA_CHANNEL_ID"], "Hello from Python!")
print(me["username"], message["id"])Node.js and TypeScript
The Node.js client uses the built-in Fetch API and ships TypeScript declarations. Resource methods return typed objects while preserving fields added by newer Lyra nodes.
import { LyraClient } from '@lyra-social/sdk'
const lyra = LyraClient.bot(process.env.LYRA_BOT_TOKEN!)
const me = await lyra.users.me()
const message = await lyra.channels.send(
process.env.LYRA_CHANNEL_ID!,
'Hello from Node.js!',
)
console.log(me.username, message.id)Rust
The Rust client is asynchronous, uses rustls for HTTPS and keeps unknown response fields so applications remain forward-compatible.
use lyra_sdk::LyraClient;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let lyra = LyraClient::bot(std::env::var("LYRA_BOT_TOKEN")?)?;
let me = lyra.me().await?;
let message = lyra.send_message(
&std::env::var("LYRA_CHANNEL_ID")?,
"Hello from Rust!",
).await?;
println!("{} {}", me.username, message.id);
Ok(())
}Self-hosted nodes and raw requests
Set baseUrl (Node.js), base_url (Python) or use the Rust builder to target another node. Always include /api/v1. Use request() for a supported endpoint that does not yet have a dedicated helper. Webhook execution deliberately omits the client Authorization header so bot credentials are never sent to a webhook-token route.
Package availability
The SDK sources and tests live in the Lyra repository under sdks/. Registry publication can be automated independently for npm, PyPI and crates.io.