TanStack AI Just Learned to Compose Music
This title could be clearer and more informative.Try out Clickbait Shieldfor free (5 uses left this month).
TanStack AI has released a new generateAudio() activity that provides a single typed API for AI-generated music, sound effects, speech, and transcription across providers. It ships with adapters for Gemini Lyria and fal (covering models like MiniMax, DiffRhythm, and Stable Audio 2.5), streaming support via SSE, and framework hooks for React, Solid, Vue, and Svelte. The API normalizes provider-specific quirks like differing duration parameter names and output formats (URL vs base64) so developers avoid writing repetitive glue code.
Table of contents
One activity, any audio model #Streaming, because audio generation takes seconds #Framework hooks that feel like the others #Providers that shipped in this release #Try it #Questions this post answers
How do I generate music or sound effects in a React app using TanStack AI?
Use the new generateAudio() activity from @tanstack/ai with either the geminiAudio or falAudio adapter, passing a text prompt. It returns a GeneratedAudio object with either a url or b64Json field. In React, the useGenerateAudio hook from @tanstack/ai-react exposes generate, result, isLoading, stop, and reset for building a UI around it. Developers wiring AI audio generation into their apps can track framework updates like this on daily.dev.
How does TanStack AI handle streaming for slow AI audio generation models like Stable Audio or Lyria?
generateAudio supports a stream: true option that returns an AsyncIterable of StreamChunk objects, which can be piped through toServerSentEventsResponse() for a single SSE connection delivering progress events and the final audio. This avoids blocking the UI while models like Lyria 3 Pro or Stable Audio, which take several seconds or longer, finish generating. Teams handling slow AI generation UX can follow patterns like this on daily.dev.
Which AI audio models does the fal adapter for TanStack AI support?
The fal adapter in @tanstack/ai-fal supports multiple audio models in fal's catalog, including MiniMax, DiffRhythm, and Stable Audio 2.5, exposed through three tree-shakeable subpath adapters. TanStack AI normalizes differing parameter names across these models, such as music_length_ms, seconds_total, and duration, into one consistent typed interface. Comparing AI audio provider options is easier when developers track ecosystem changes on daily.dev.