Skip to main content
TwelveLabs provides state-of-the-art video understanding technology that makes video content instantly searchable and intelligently analyzable. Combined with SambaNova’s high-performance AI models, you can transform educational videos into interactive games and learning experiences.

Prerequisites

  • A SambaCloud account and API key.
  • A TwelveLabs account and API key.
  • At least one TwelveLabs index with a video already uploaded (note the index ID).
  • Python 3.9 or higher installed.
  • Node.js 18 or later (required for the frontend).
  • The Video2Game repository cloned to your local machine.

Setup

This integration uses TwelveLabs for video understanding and SambaNova for game code generation, enabling you to convert educational videos into interactive learning experiences. The Video2Game project ships with two services that must run at the same time:
  • Backend (Flask, :8000) — handles TwelveLabs analysis and SambaNova generation.
  • Frontend (Next.js, :3000) — the UI you interact with.
1

Configure environment variables

Create backend/.env:
Pick any model ID listed on the SambaCloud models page (for example, DeepSeek-V3.1, Meta-Llama-3.3-70B-Instruct, Llama-4-Maverick-17B-128E-Instruct). Avoid deprecated IDs from the Model deprecations page.
TWELVELABS_INDEX_ID is required — the backend throws RuntimeError: Missing required configuration if it is unset.
SAMBANOVA_MODEL is a workaround for an upstream bug where Video2Game hardcodes a deprecated model in backend/config.py:18. Until the upstream fix lands (Hrishikesh332/Video2Game#1), patch config.py to read from the env var:
2

Install backend dependencies

Install the required Python packages:
3

Start the backend

From the backend/ directory:
The backend runs at http://127.0.0.1:8000.
4

Configure the frontend

In a new terminal, from the repo root, create www.video2game.vercel.app/.env.local:
5

Install and start the frontend

The app opens at http://localhost:3000.
6

Generate a game from a video

  1. Open http://localhost:3000.
  2. Click the TwelveLabs tab.
  3. Enter your TwelveLabs API key and click Connect.
  4. Select a Video Index (only indexes with uploaded videos appear).
  5. Select a Video.
  6. Click Generate from TwelveLabs to build an interactive game powered by SambaNova.
Once generation completes, the right panel renders an interactive game built from your video content. Switch between App (live preview) and Code (generated HTML) tabs.
Video2Game app showing generated interactive game in the right panel

Troubleshooting

The upstream Video2Game backend/config.py:18 hardcodes a deprecated SambaCloud model. Patch the line to:
Then add SAMBANOVA_MODEL=DeepSeek-V3.1 to backend/.env. Tracked upstream at Hrishikesh332/Video2Game#1.
All six .env keys must be set in backend/.env, especially TWELVELABS_INDEX_ID.
Confirm your TwelveLabs API key has at least one index with an uploaded video. Verify with:
Backend caches generated games per video_id. Trigger a fresh run via:

Additional resources