Skip to content

Repository files navigation

Grok Box

Grok Box

The AI news network that runs itself.

Grok finds a real story, verifies it, writes the jokes, generates the anchors and the studio, and broadcasts live on X around the clock. Humans only approve what airs.


What this is

Grok Box is a television network with no staff. It watches the news cycle through X, verifies stories against the web, writes a two host comedy segment bound to cited evidence, renders it with generative video, masters it like broadcast television, and streams it continuously to X over RTMP. When nobody asks for anything, it commissions its own stories. When viewers reply to the show's post with a topic, the network turns the request into an episode and cites their post on air.

The desk The field report
Desk format Remote report format
AI Elon anchors every episode with a rotating co host. A split screen live remote. The AI picks its own filming locations.

Every factual line in every episode traces to a real, provider returned source, and every episode ships with clickable citations. If a story cannot be verified, the network refuses to make the episode.

How an episode gets made

flowchart LR
  REQ["Operator or audience request"] --> ED["Assignment editor"]
  AUTO["Self commissioned story"] --> R
  ED --> R["Research: X Search + Web Search"]
  R --> W["Structured script writer"]
  W --> G["Editorial gates"]
  G --> IMG["Reference frames"]
  IMG --> VID["Video chunks"]
  VID --> FF["FFmpeg master + stitch"]
  FF --> REV["Operator review"]
  REV --> LIVE["RTMP broadcast on X"]
Loading
  1. Assignment desk. Type anything: a question, a meme, a pasted X post link. A structured model call rewrites the raw request into a verifiable, research ready assignment and extracts referenced posts so the show can feature them on air. Request text is treated as content to report on, never as instructions.
  2. Research. Agentic X Search finds the story and the best reactions. Web Search verifies the event into a dossier of atomic claims. Only claim level, provider cited evidence survives. Operator requested stories may ground themselves in cited X posts alone, since viral topics often live nowhere else.
  3. Writing. A strict JSON schema produces the script: two hosts, per turn vocal direction, camera assignments, and a format. Either a desk two shot, or a split screen live remote with a field correspondent somewhere fitting, or somewhere absurd, like a midnight grocery aisle. The writer references evidence IDs that the server resolves back to real source records, so it cannot invent a URL.
  4. Editorial gates. Hard checks, not suggestions: no repeating a story covered in the last twelve episodes, AI Elon is the permanent anchor, topics stay safely satirical (business, tech, markets, culture, never geopolitics or partisan politics), and the operator can lock the format from the UI.
  5. Rendering. One center frame is generated from a fixed studio image, and every other camera angle is derived from it, which keeps faces, wardrobe, and graphics consistent across roughly ten independent video generations. Each chunk carries one speaker per turn lip sync direction.
  6. Mastering. FFmpeg trims trailing silence with a short reaction tail, normalizes every clip to identical geometry and codecs, applies dialogue compression and loudness normalization to broadcast standards, and stitches the final cut with a poster frame.
  7. Broadcast. A playout loop pushes 1080p to X Live Studio over RTMP. Fresh episodes air once after approval, then the newest episodes replay with generated station bumpers between them. Because every clip is codec identical by construction, playout is a zero re-encode remux.

The autonomy loop

A producer ticks every five seconds with a strict priority ladder: resume failed renders (only missing chunks re-render, paid work is never regenerated), then start queued requests, then commission a discovery story if auto generation is on. Provider hiccups are absorbed at three levels: every API call retries with backoff, failed renders auto resume, and queue items lost to transient upstream errors re-queue themselves. Content level failures always stop and wait for a human.

Nothing airs without approval. Aired and approved episode IDs persist to disk, so a crash or deploy restart can never slip an unreviewed episode onto the air. The server supervises itself under pm2 and re-arms both the producer and the RTMP push on every boot.

Quick start

Requirements: Node.js 20.9+, npm, FFmpeg and ffprobe on PATH, an xAI API key.

npm install
cp .env.example .env.local   # add XAI_API_KEY
npm run dev                  # video desk on http://localhost:3000

Without an API key, generation is disabled but saved episodes remain playable.

npm run build     # production build
npm start         # production server
npm test          # unit tests (invokes local FFmpeg, no paid API calls)
npm run test:ui   # Playwright browser tests
npm run lint      # ESLint
npm run typecheck # TypeScript

Configuration

Variable Purpose
XAI_API_KEY Server side credential for all generation.
XAI_FEED_RESEARCH_MODEL, XAI_FEED_SCRIPT_MODEL Research and writing (default grok-4.5).
XAI_FEED_IMAGE_MODEL, XAI_FEED_VIDEO_MODEL Reference frames and video chunks (default grok-imagine).
STREAM_RTMP_URL, STREAM_KEY RTMP(S) ingest for live playout, e.g. X Live Studio.
STREAM_UPSCALE 720 or 1080 to upscale the outgoing stream.
STREAM_AUTOSTART, STREAM_AUTOGEN Resume broadcasting and auto commission stories on boot.
VIDEO_FEED_ARTIFACT_ROOT Persistent root for episodes, manifests, queue, and ledger.

See .env.example for the full set. The intended deployment splits environments: .env.production carries stream credentials so only the production instance can broadcast, while .env.development points at an isolated artifact sandbox so development never touches the live channel.

Operating the channel

The video desk is one page. A focus field for one off episodes, a story queue with optional X coverage fields (event search query, featured post URL), and a live stream panel with the broadcast controls: start and stop, hold new episodes for review, auto generate when idle, and the episode format lock (writer's pick, desk, or live remote). Held episodes appear with an Air now button.

Completed episodes persist as files with JSON manifests, survive restarts, and stream to the browser with byte range support. There is no database.

Field notes

  • Prompts are advisory, gates are law. Every rule that mattered began as an instruction the model leaked past and ended as a cheap hard check that kills a bad script before the expensive stages.
  • Identity consistency across many video generations comes from derivation, not description: generate one frame, derive every other shot from it.
  • Text inside generated video decays. On screen text lives in the reference image at headline scale or gets burned in post, never left to the video model.
  • Vague requests starve verification. The assignment desk exists because "PLTR earnings, we cooked or nah?" is not a searchable event until something rewrites it into one.
  • Deterministic mastering beats hoping ten independent generations match loudness, timing, and codecs.

Bug discovery

Development surfaced an intermittent HTTP 500 (internal error during token parsing) from the xAI /responses endpoint. We reported a minimal reproduction, and the cause was confirmed upstream: x_search and web_search run a server side agent loop, and tool_choice: "required" applies to every iteration, which can prevent the model from ever emitting its final response. The research calls here use tool_choice: "auto" with explicit search instructions as a result.

Limitations

Single tenant, single process, one render at a time. Run coordination is process local, storage is the filesystem, and there is no authentication. Public figure likeness and voice quality vary by provider output and moderation. Generated video is slow and costs real money: a full episode is roughly a dozen generation calls. Operators should review portrayals, factual claims, and overlay spelling before public distribution.

Project map

Path Responsibility
src/lib/video-feed-pipeline.ts Research, assignment editor, writing, gates, image and video generation, FFmpeg assembly.
src/lib/video-feed-runner.ts Run coordination, resume, disk restoration, manifests.
src/lib/stream-runner.ts Producer loop, story queue, review ledger, RTMP playout, bumper rotation.
src/lib/video-feed-contracts.ts, src/lib/stream-contracts.ts Zod contracts for every handoff.
src/lib/bumpers.ts Generated station bumpers.
src/components/video-feed-panel.tsx The video desk UI.
src/app/api/ Run, queue, stream, library, and media routes.
prompts/ Editable prompt documents and the fixed studio image.
tests/, e2e/ Vitest and Playwright coverage.

Everything on screen is clearly labeled synthetic parody of public figures, not actual footage or audio. Sources attached. Episodes retained.

About

Fully autonomous AI TV network: Grok finds the news, writes the jokes, generates the show, and broadcasts live on X

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages