Introduction
What Is the Node SDK?
The Orga Node SDK (@orgaāai/node) provides a secure way to connect your server or backend service to the Orga Cloud API.
Itās designed to generate shortālived ephemeral tokens and ICE configurations for your client applicationsākeeping your Orga API key safe on the server.
Use it as the backend companion to the React and React Native SDKs.
- Built on the same core runtime as other Orga SDKs.
- Ideal for Express, Next.js API Routes, Cloud Functions, or any Node.js environment.
- Exchanges your longālived API key for a shortālived ephemeral token to power secure realātime AI sessions.
- Compatible with Node 18+ and both ESM / CommonJS syntax.
Why Use It?
- Security first ā Keep your Orga API key serverāside; clients receive only ephemeral credentials.
- Dropāin simplicity ā One class, one function call to get a full session config.
- Frameworkāagnostic ā Works in any Node runtime (Express, Next.js, NestJS, Cloudflare, etc.).
- Consistent architecture ā The same authentication model used by web and mobile SDKs.
How It Works
At runtime, your backend uses the OrgaAI class to request a session configuration
that includes both an ephemeral token and the ICE server list used for WebRTC connections.
Your client SDK (@orgaāai/react or @orgaāai/reactānative) then uses that response
to initialize its WebRTC session with Orgaās realātime models.
Features
- š Credential Exchange ā Turns permanent API keys into secure, shortālived ephemeral tokens.
- š§© Simple API ā
getSessionConfig()returns everything your client needs to connect. - š Autoāfetch ICE servers ā SDK handles both token and connectivity config in one call.
- āļø Timeout & Debug options ā Control request timeouts and verbose logging.
Installation
npm
npm install @orga-ai/nodeRequires Node.js v18+ (for native fetch and async context).
Supported Environments
| Environment | Example Usage |
|---|---|
| Express / Fastify | Route handler that returns orga.getSessionConfig() |
| Next.js API Routes | Async function responding to frontend requests |
| Cloud Functions | Minimal integration for token issuance |
| Edge runtimes | Compatible with Edgeālike environments supporting Fetch and WebCrypto |
Example At a Glance
import { OrgaAI } from "@orga-ai/node";
const orga = new OrgaAI({
apiKey: process.env.ORGA_API_KEY!,
userEmail: process.env.USER_EMAIL!, // required (will be optional soon)
debug: true,
});
async function handler(req, res) {
try {
const creds = await orga.getSessionConfig();
res.json(creds);
} catch (err) {
console.error("Failed to get session config", err);
res.status(500).json({ error: "Internal error" });
}
}Your Orga API key must always remain on the server and never be exposed to client code.
Next Steps
- Quick Start ā Build a secure backend route in minutes.
- Architecture ā Learn how the Node SDK fits into the Orga ecosystem.
- API Reference ā Reference for the OrgaAI class.