Quickstart
From a new API key to a live room and your first speech AI call.
In this guide you will:
- Create an API key.
- Run a small backend that issues participant tokens.
- Join a room from two browser tabs.
- Make your first AI call.
You need Node.js 22 or newer. The whole thing costs a fraction of a cent and fits in the Free plan.
1. Create an API key
Section titled “1. Create an API key”- Sign in to the dTelecom Cloud dashboard.
- Open API keys and click Create a key.
- Copy the key and the secret. The secret is shown once.
2. Set up the project
Section titled “2. Set up the project”mkdir dtelecom-quickstart && cd dtelecom-quickstartnpm init -ynpm install @dtelecom/server-sdk-js@4.4.0 @dtelecom/livekit-client@1.12.28 expressPut your credentials in the environment. The SDK reads these variables by default.
export DTELECOM_API_KEY="dtk_live_..."export DTELECOM_API_SECRET="..."export DTELECOM_CLOUD_URL="https://cloud.dtelecom.org"Keep the secret on the server. Never ship it in a browser or a mobile app.
3. Issue participant tokens
Section titled “3. Issue participant tokens”Create server.js. It serves one page and one endpoint that returns a token for a room.
const path = require('path');const express = require('express');const { CloudClient } = require('@dtelecom/server-sdk-js');
const cloud = new CloudClient(); // reads DTELECOM_API_KEY, DTELECOM_API_SECRET, DTELECOM_CLOUD_URLconst app = express();
app.use(express.static(__dirname));// serve the browser build of the client SDKapp.use('/sdk', express.static(path.join(__dirname, 'node_modules/@dtelecom/livekit-client/dist')));
app.get('/token', async (req, res) => { try { const { token, wsUrl, fallbackUrls } = await cloud.createToken({ room: 'quickstart', identity: `user-${Math.floor(Math.random() * 10000)}`, }); res.json({ token, wsUrl, fallbackUrls }); } catch (err) { res.status(err.status || 500).json({ error: err.code || err.message }); }});
app.listen(3000, '127.0.0.1', () => console.log('Open http://127.0.0.1:3000'));createToken checks your balance and limits and returns the participant’s token, primary signaling URL (wsUrl) and ranked signaling URLs (fallbackUrls). Forward all three to the browser so it can try the next available node if the primary is unreachable. Some participants receive only the primary URL. The room is created when the first participant joins.
Every token takes one of your plan’s concurrent participant slots from the moment it is issued until the participant leaves or the token expires. The Free plan has 100. A token lasts 6 hours by default, and that is the lifetime we recommend. A token that nobody uses holds its slot until it expires, so issue tokens right before joining.
4. Join the room from the browser
Section titled “4. Join the room from the browser”Create index.html next to server.js.
<!DOCTYPE html><html> <body> <button id="join">Join room</button> <div id="videos"></div>
<script type="module"> import { Room, RoomEvent, Track } from '/sdk/livekit-client.esm.mjs';
document.getElementById('join').onclick = async () => { const { token, wsUrl, fallbackUrls } = await (await fetch('/token')).json();
const room = new Room({ adaptiveStream: true, dynacast: true });
// show other participants' audio and video room.on(RoomEvent.TrackSubscribed, (track) => { if (track.kind === Track.Kind.Video || track.kind === Track.Kind.Audio) { document.getElementById('videos').appendChild(track.attach()); } });
await room.connect(wsUrl, token, { fallbackUrls }); await room.localParticipant.enableCameraAndMicrophone(); }; </script> </body></html>Run it:
node server.jsOpen http://127.0.0.1:3000 in two tabs and click Join room in each. You should see and hear yourself across the tabs. In the dashboard, the room appears under Sessions as live.
5. Make your first AI call
Section titled “5. Make your first AI call”The same CloudClient calls the AI services. Create ai.js:
const fs = require('fs');const { CloudClient } = require('@dtelecom/server-sdk-js');
const cloud = new CloudClient();
async function main() { // Translate a sentence const translation = await cloud.translate({ q: 'Hello from dTelecom Cloud', target: 'es', idempotencyKey: 'quickstart-translate-1', }); // a long request can come back as 'running': poll until it is completed let done = translation; while (done.status === 'running') { await new Promise((r) => setTimeout(r, 1000)); done = await cloud.getTranslation(done.id); } console.log(done.result?.translatedText);
// Turn text into a WAV file let job = await cloud.wav.create({ text: 'Hello from dTelecom Cloud', idempotencyKey: 'quickstart-wav-1', }); while (!['completed', 'failed', 'cancelled'].includes(job.status)) { await new Promise((r) => setTimeout(r, 1000)); job = await cloud.wav.get(job.id); } if (job.status !== 'completed') { throw new Error(`WAV job ${job.status}: ${job.error}`); } const audio = await cloud.wav.download(job.id); fs.writeFileSync('hello.wav', Buffer.from(await audio.arrayBuffer())); console.log('Saved hello.wav');}
main().catch((err) => console.error(err.status, err.code || err.message));node ai.jsBoth calls show up in the dashboard under AI services within a minute.
What you just used
Section titled “What you just used”| Step | API | Billed as |
|---|---|---|
| Token for a participant | cloud.createToken() |
free |
| Two tabs in a room | client SDK | participant-minutes, per second |
| Translation | cloud.translate() |
per character |
| WAV file | cloud.wav.create() |
per character |
Next steps
Section titled “Next steps”- Build a voice agent: add an AI participant that talks.
- Tokens and permissions: viewers, hosts, token lifetime.
- Connect from your app: join from a browser or React web app.
- Join from React Native to use the same rooms on iOS and Android.
- AI services overview: pick the right service and call pattern.
- HTTP API reference: the same calls from Python or curl.
- Errors: what to retry and how.
- FAQ and troubleshooting.