chatlabs
chatlabs copied to clipboard
Add OpenAI voice output for Pro users
Currently, we have a feature to play messages with browser's native text to voice capability.
We want to improve this feature further by enabling text to voice powered by openai https://platform.openai.com/docs/guides/text-to-speech
This is how it should work
- Only enabled for PRO users (profile.plan != 'free')
- We will likely need a add a dedicated endpoint to stream voice in
/app/api/text-to-voice/route.ts
. Read more about nextjs app routing here https://nextjs.org/docs/app. Also see other/app/api/*
endpoints for example - When user uses PRO account, switch text-to-voice to openai