Skip to content

Latest commit

 

History

History

README.md

Duplex Speech Streaming (using Vite/React & ModelFusion Server/Fastify)

Speech Streaming, OpenAI, Elevenlabs streaming, Vite, Fastify, ModelFusion Server

Given a prompt, the server returns both a text and a speech stream response.

Key files

  • ModelFusion Flow: src/flow/duplexStreamingFlow.ts
  • Server: src/server/server.ts
  • Client: src/App.tsx

Usage

  1. Create .env file with the following content:

    OPENAI_API_KEY="YOUR_OPENAI_API_KEY"
    ELEVENLABS_API_KEY="YOUR_ELEVENLABS_API_KEY"
    
  2. Increase the max completion tokens in duplexStreamingFlow.ts (by default it generates a very short text)

  3. Start the server:

    pnpm run server
  4. Start the client:

    pnpm run client
  5. Go to the URL from the client run