Quantum AI logoQUANTUM REALTIME
Quantum developer docs

Overview

Quantum helps developers build interactive video experiences that respond to live camera input, prompts, and reference images in real time. Realtime generation turns video into something an application can adapt and shape as people interact.

Use the Quantum API and SDK to connect your application to realtime generation, start and stop sessions, and receive usage receipts through your own product experience.

See what you can build

Explore realtime video use cases. These sample clips illustrate the experiences customers can build with the SDK.

1. Get access through Telegram

Your Quantum key is issued for your account by the Quantum API bot.

Open the Quantum API bot

Send /start, choose My SDK, then select JavaScript. Follow the bot’s steps to request your customer key.

Open Telegram ↗

Keep your permanent key on your backend only. Do not send it in browser code or commit it to a public repository.

2. JavaScript SDK

Install Quantum's Web SDK through npm and import it in your app.

npm install quantum-realtime-web-sdk

The public npm package is available. See the package page for version details and release notes.

3. Set up your backend

The permanent customer key belongs on the customer’s server. The included example proxy is for FastAPI.

1

Store the key privately

Save it in a private file such as secrets/Quantum_key.txt, outside the public website folder. Add that path to .gitignore.

2

Mount the authenticated proxy

Copy backend/quantum_realtime_proxy.py from the SDK and mount it behind your application’s real login dependency. Do not use a no-op login check.

3

Set server configuration

Configure QUANTUM_API_ORIGIN=https://quantum-api-gateway.netlify.app and QUANTUM_API_KEY_FILE to the private key file path.

Important: Never put the permanent Quantum API key in browser JavaScript, a public folder, a mobile app package, or source control.

4. Connect your browser app

Serve the SDK’s web/ files over HTTPS, preserving all engine assets and subfolders. Make your authenticated backend proxy available at /api/quantum/realtime on the same origin.

// In your app’s JavaScript module
import { QuantumRealtimeClient } from "/quantum-sdk/quantum-realtime.js";

const sdk = new QuantumRealtimeClient({
  viewElement: document.getElementById("output"),
  backendUrl: "/api/quantum/realtime",
  onStatus: (message) => {
    document.getElementById("status").textContent = message;
  },
});

// Call from your app’s Start button
await sdk.start({
  prompt: "Describe the realtime transformation",
  referenceFile: document.getElementById("reference-image").files[0],
  cameraPosition: "front",
});

// Call from Stop; this closes the session and returns its receipt
const receipt = await sdk.stop();
console.log(receipt.billed_credits);

The quick-start file includes the complete event-handler example and the FastAPI proxy setup. Other backend frameworks need an equivalent authenticated proxy.

Reference images and camera

The JavaScript SDK accepts an optional JPG, PNG, or WebP reference image. It uploads the selected image when generation starts so the realtime service can use it.

Camera access

Browser camera permission is required. Use HTTPS in deployed apps; localhost is allowed for local development.

Session lifecycle

Start generation only when ready. Call stop() when finished so the session closes and the Quantum billing receipt is returned.

Security and key handling

The browser receives only a short-lived session credential from the authenticated backend proxy. Your permanent key stays server-side.

  • Use the app’s real authentication dependency on the proxy.
  • Keep Quantum_key.txt outside public directories and source control.
  • Do not expose the permanent key in frontend bundles, browser storage, or client apps.

Need help?

Contact our support account on Telegram. Include your programming language and a short description of your backend framework. Never include your API key in a support message.

Contact support on Telegram ↗