Speech Streaming, OpenAI, Elevenlabs streaming, Vite, Fastify, ModelFusion Server
Given a prompt, the server returns both a text and a speech stream response.
- ModelFusion Flow:
src/flow/duplexStreamingFlow.ts - Server:
src/server/server.ts - Client:
src/App.tsx
-
Create
.envfile with the following content:OPENAI_API_KEY="YOUR_OPENAI_API_KEY" ELEVENLABS_API_KEY="YOUR_ELEVENLABS_API_KEY" -
Increase the max completion tokens in
duplexStreamingFlow.ts(by default it generates a very short text) -
Start the server:
pnpm run server
-
Start the client:
pnpm run client
-
Go to the URL from the client run