How-toSelected

SpaceXAI Cookbook adds 5 new Grok API sample apps

Why we picked it

The cookbook doubles as an architecture reference: the pattern of using Grok for decisions and Imagine models for execution, plus cross-shot consistency via image editing instead of regeneration, applies to any agentic media pipeline. Developers building voice agents or content workflows can clone the repos on GitHub and adapt them directly. The itemised per-run costs also make budgeting for video generation pipelines more concrete.

SpaceXAI expanded its open-source xAI Cookbook with 5 new apps, bringing the total to 10 built on the new SpaceXAI TypeScript SDK.

Body

The collection covers four real-time voice agent variants (browser WebSocket, WebRTC, Twilio phone, mobile with ephemeral tokens), four multimodal generation pipelines, and two X real-time sentiment analysis examples.

The product-video-ad pipeline produces an 8-second vertical ad from one product photo at roughly US$1.35 per run, while storyboard-to-film generates a four-shot short film for about US$5 per run.

The sentiment examples use a two-pass cost-tiered design that filters posts cheaply before deep scoring with grok-4.

7.

Original · shao__meng

SpaceXAI Cookbook 更新了 5 个新 App,加上原先的 5 个,组成了 Grok API “能力教科书”,每个都围绕一个真实可跑的产品级场景,覆盖四条主线:实时语音智能体(4 个)、多模态生成流水线(4 个)、𝕏 实时数据分析(2 个) 开源地址 github.com/xai-org/xai-co… 9 # 实时语音智能体系列(4 个示例,同一 API 的四种接入形态) 这四个项目演示的是同一个 Realtime Voice API(wss://api.x.ai/v1/realtime)在不同传输通道上的落地,难度递进、彼此互补: · voice-agent-web:浏览器 WebSocket,最基础的参考实现 · voice-agent-webrtc:浏览器 WebRTC,低延迟 + 连接质量监控 · voice-agent-phone:Twilio 电话线路(PSTN),打电话给 AI · voice-agent-mobile:iOS/Android 原生,移动端 + 临时令牌 # 多模态生成流水线系列(4 个示例,难度递增) 这组示例展示了如何把“理解 + 结构化输出 + 图像生成/编辑 + 视频生成 + TTS”串成完整产品,共同范式是:Grok 当导演(决策),Imagine 模型当摄影师(执行)。 · podcast-from-a-link(入门):URL/PDF → 双主持人播客 · screenshot-to-component(入门):截图 → React + Tailwind 组件,核心是自校验闭环——第一轮生成后给组件截图,Grok 对比原图提错,第二轮修复 · product-video-ad(进阶):单张产品照 → 8 秒竖版视频广告,约 $1.35/次。流程是 Grok 全程做创意决策:写 brief → 并行生成 3 张候选场景图(images.edit() 保持产品还原度)→ 单次请求对比多图选出最佳并给理由 → 视频生成与配音并行跑 → ffmpeg 混音(压低原声垫旁白) · storyboard-to-film(进阶):一句话 → 四镜头短片,约 $5/次。最关键的洞见在跨镜头一致性:先正常生成首帧,后续关键帧全部用图像编辑(以首帧为参考)而非重新生成 # 𝕏 实时数据分析系列(2 个示例) · x-sentiment-analysis(高阶,Jupyter notebook):两遍式设计——X Search 抓帖 → 低推理档廉价快筛去噪 → grok-4.7 默认档深度打分。这是典型的成本分层架构 · x-sentiment-tracker(应用化版本):完整仪表盘,展示了许多实战细节 eric zakariasson @ericzakariasson we added five apps to our cookbook, all built on the new @spacexai typescript sdk: - premise to short film - picture to video ad - screenshot to react component - 𝕏 posts to sentiment dashboard - link to podcast demos and code ↓

Industry Coordinates & Source Verification

This report is categorized under AITOP's "How-to" desk, focusing on US frontier AI labs and Silicon Valley technology leaders. Within our cross-regional analytical framework, it directly maps to AI developer toolchains, coding agents, and engineering workflows. Key entities and technical topics under continuous tracking include Grok, xAI, coding assistants, MCP and tools.

Source attribution: curated from shao__meng (@shao__meng). Cross-source corroboration: 2 independent sources have covered this development (including rohanpaul_ai), confirming industry-wide signal strength.