# Cookbook

Recipes and examples for building with SpaceXSI.

- [Article to Read-Along](https://docs.x.ai/cookbook/examples/article-to-read-along.md): Turn any article into audio that highlights each word as it's spoken, using the per-character timestamps from text to speech, and click a word to jump there.
- [Live Interpreter](https://docs.x.ai/cookbook/examples/live-interpreter.md): Speak one language and hear Grok say it in another a moment later, from a page that connects straight to the realtime voice API with a short-lived token.
- [Photo to Talking Character](https://docs.x.ai/cookbook/examples/photo-to-talking-character.md): Make a drawing, a mascot, or a pet photo talk in a voice you pick, and have a second character answer, with Grok Imagine reference-to-video.
- [Podcast from a Link](https://docs.x.ai/cookbook/examples/podcast-from-a-link.md): Turn an article or a PDF into a two-host podcast episode, and watch it being written and recorded live in a small web app.
- [Screenshot to React Component](https://docs.x.ai/cookbook/examples/screenshot-to-component.md): Turn a screenshot of a UI into a React component styled with Tailwind, then have Grok compare the result with the original and fix what doesn't match.
- [Company to Call Brief](https://docs.x.ai/cookbook/examples/company-to-call-brief.md): Prep for a sales call with a one-page brief, as Grok searches the web and 𝕏 and looks up the account through CRM functions that run in your app.
- [CSV to Answers](https://docs.x.ai/cookbook/examples/csv-to-answers.md): Drop in a CSV and ask questions about it. Grok writes and runs pandas in a sandbox, shows the code it ran, and answers with computed numbers and a chart.
- [Database over MCP](https://docs.x.ai/cookbook/examples/database-over-mcp.md): Serve a SQLite database as a small MCP server that only reads, and watch Grok list its tables, read their schemas, and run SQL through it to answer a question.
- [Docs to Cited Answers](https://docs.x.ai/cookbook/examples/docs-to-cited-answers.md): Ask questions about a folder of documents and get answers that cite the passages they came from, with a metadata filter that decides which documents count.
- [Mobile Voice Apps](https://docs.x.ai/cookbook/examples/voice-agent-mobile.md): Native iOS and Android apps for real-time voice conversations with Grok, plus text-to-speech on iOS.
- [Phone Voice Agent](https://docs.x.ai/cookbook/examples/voice-agent-phone.md): A voice agent you can call on the phone, using Twilio.
- [Photo to Time-Lapse](https://docs.x.ai/cookbook/examples/photo-to-time-lapse.md): Turn one photo into a time-lapse, like a street through the four seasons, by editing it for each stage and pinning every edit in one Grok Imagine video.
- [Product Photo to Video Ad](https://docs.x.ai/cookbook/examples/product-video-ad.md): Turn one product photo into a vertical video ad with a voiceover, as Grok writes the brief, places the product in three scenes, picks one, and animates it.
- [Prompt Caching](https://docs.x.ai/cookbook/examples/prompt-caching.md): Play one 30-message chat three ways to see what the prompt cache saves, how the time at the top of the system prompt breaks it, and what compaction costs.
- [Prompt Injection Defenses](https://docs.x.ai/cookbook/examples/prompt-injection-defenses.md): Watch poisoned pages try to make an agent leak private data, see each of four defenses miss an attack another catches, and stop all ten with all four on.
- [Reasoning Effort Evals](https://docs.x.ai/cookbook/examples/reasoning-effort-evals.md): Run a prompt's test cases at every reasoning effort, grade the answers with code checks and a judge, and find the cheapest effort that's still good enough.
- [Receipts to Spreadsheet](https://docs.x.ai/cookbook/examples/receipts-to-spreadsheet.md): Turn receipt photos and PDF invoices into a spreadsheet that adds up, with Grok reading each one twice and flagging the cells where the reads disagree.
- [Reviews to Themes](https://docs.x.ai/cookbook/examples/reviews-to-themes.md): Turn a thousand app reviews into ranked themes with counts, trends, and quotes by labeling every review in one Batch API job.
- [Storyboard to Short Film](https://docs.x.ai/cookbook/examples/storyboard-to-film.md): Turn a one-line premise into a four-shot short film with Grok Imagine keyframes, image-to-video, and narration, and watch it being made in a small web app.
- [Topics to Morning Briefing](https://docs.x.ai/cookbook/examples/topics-to-morning-briefing.md): Turn a few topics into a two-minute spoken briefing from 𝕏 and the web, with Grok skipping the stories it already told you about and a cost cap on every run.
- [Web Voice Agent](https://docs.x.ai/cookbook/examples/voice-agent-web.md): A React client with swappable Python and Node.js backends that talk to the Voice Agent API over WebSocket.
- [𝕏 Post to Fact-Check](https://docs.x.ai/cookbook/examples/x-post-fact-check.md): Paste a link to a post on 𝕏, and Grok checks each claim on the web and on 𝕏 at the same time and writes a note where every sentence cites a source.
- [𝕏 Sentiment Tracker](https://docs.x.ai/cookbook/examples/x-sentiment-tracker.md): Score the sentiment about any topic from live 𝕏 posts with Grok's X Search tool, on a dashboard with a score for every post and the sentiment day by day.
- [Bug Report to Fix](https://docs.x.ai/cookbook/examples/bug-report-to-fix.md): Describe a bug in a small repo, and watch Grok reproduce it with a failing test, fix it, and rerun the tests, checking every command before it runs.
- [Meeting to Action Items](https://docs.x.ai/cookbook/examples/meeting-to-action-items.md): Caption a call live by speaker, keep a running list of decisions and action items, and ask questions whose answers link to the moment in the transcript.
- [Refund Agent with Human Approval](https://docs.x.ai/cookbook/examples/refund-agent-human-approval.md): Build a support agent that stops before a refund, waits for a person to approve it, and resumes the same run from a stored response, even after a restart.
- [Video Dubbing](https://docs.x.ai/cookbook/examples/video-dubbing.md): Dub a video into another language, with each line timed to the original speech, shortened by Grok when it runs long, and mixed over the original background.
- [WebRTC Voice Agent](https://docs.x.ai/cookbook/examples/voice-agent-webrtc.md): A low-latency browser voice agent that uses WebRTC between the browser and a server, which connects to xAI over WebSocket.
