Skip to Content
šŸš€ Orga AI is in open beta.
DocumentationServer SdksNodeIntroduction

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 install @orga-ai/node

Requires Node.js v18+ (for native fetch and async context).


Supported Environments

EnvironmentExample Usage
Express / FastifyRoute handler that returns orga.getSessionConfig()
Next.js API RoutesAsync function responding to frontend requests
Cloud FunctionsMinimal integration for token issuance
Edge runtimesCompatible 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.
Last updated on