Setting up a Relay Server
Connecting directly to tensorstudio through SDK on browser exposes your api-key. If you are running your own relay server, e.g. with theRealtime Console
, you can instead connect to the relay server URL.
1. Install Realtime Console
First, install the OpenAI Realtime Console globally:2. Set environment variables for realtime-console
Create a.env
file in realtime-console directory
3. Start the Relay Server
Run relay server in a new terminal:ws://localhost:8081
.
Start using Tensorstudio Speech API through NodeJS SDK
Install NodeJS SDK
Using Node.js SDK
Production Deployment
For production:- Use secure WebSocket (WSS) with SSL/TLS
- Update the relay server URL to your production domain
- Add authentication if needed
- Use environment variables for configuration
Security Considerations
- Never expose your OpenAI API key in client-side code
- Use HTTPS/WSS in production
- Implement rate limiting
- Add authentication to your relay server
- Monitor server usage and implement proper error handling
Common Issues
- Connection Refused: Make sure the relay server is running
- SSL/TLS Errors: Check certificate configuration for WSS
- Authentication Errors: Verify API key in
.env
file