Skip to content
Docs
Get started

Quickstart

From a new API key to a live room and your first speech AI call.

In this guide you will:

  1. Create an API key.
  2. Run a small backend that issues participant tokens.
  3. Join a room from two browser tabs.
  4. 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. Sign in to the dTelecom Cloud dashboard.
  2. Open API keys and click Create a key.
  3. Copy the key and the secret. The secret is shown once.
mkdir dtelecom-quickstart && cd dtelecom-quickstart
npm init -y
npm install @dtelecom/server-sdk-js@4.4.0 @dtelecom/livekit-client@1.12.28 express

Put 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.

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_URL
const app = express();
app.use(express.static(__dirname));
// serve the browser build of the client SDK
app.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.

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.js

Open 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.

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.js

Both calls show up in the dashboard under AI services within a minute.

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