-
Notifications
You must be signed in to change notification settings - Fork 786
VeenaMAX TTS Provider Integration #1357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New TTS provider integration for VeenaMAX. Code structure follows existing patterns but has critical error handling issues.
| code: | ||
| errorResponse.error.code?.toString() || responseStatus.toString(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🐛 Bug Fix
Issue: Error response handling fails when errorResponse.error.code is 0 (falsy), causing undefined in error code
Fix: Use nullish coalescing to handle 0 correctly
Impact: Prevents incorrect error codes in API responses
| code: | |
| errorResponse.error.code?.toString() || responseStatus.toString(), | |
| code: | |
| errorResponse.error.code ?? responseStatus.toString(), |
| ) => { | ||
| if (responseStatus !== 200) { | ||
| if (response && typeof response === 'object' && 'error' in response) { | ||
| const errorResponse = response as VeenaMaxErrorResponse; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Code Refactor
Issue: Redundant type assertion after in operator check
Fix: Remove unnecessary type assertion since in operator already confirms type
Impact: Cleaner code without runtime impact
| const errorResponse = response as VeenaMaxErrorResponse; | |
| const errorResponse = response; |
|
|
||
| switch (responseStatus) { | ||
| case 400: | ||
| errorMessage = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @saicherry93479 I would not recommend keeping a map of the error messages here in the gateway, please forward whatever error message is returned from the upstream provider in the https response
|
Hi @saicherry93479 , would you be able to address the comments? |
Description
This PR adds VeenaMAX TTS (Text-to-Speech) provider integration
Type of Change
Changes Made
Core Integration Files
src/providers/veenamax/api.ts - API configuration with base URL, headers, and endpoint mapping
src/providers/veenamax/createSpeech.ts - TTS implementation with parameter mapping and response transformation
src/providers/veenamax/index.ts - Main provider configuration export
src/globals.ts - Added VEENA_MAX constant
src/providers/index.ts - Registered VeenaMAX provider
How Has This Been Tested?
src/providers/veenamax/api.test.ts - Tests API configuration, headers, and endpoint mapping
src/providers/veenamax/createSpeech.test.ts - Tests TTS functionality, error handling, and voice mappings
Basic TTS request
curl --location 'http://localhost:8787/v1/audio/speech'
--header 'Content-Type: application/json'
--header 'x-portkey-provider: veenamax'
--header 'Authorization: Bearer your_veenamax_api_key'
--data '{
"input": "Hello! This is a REST API test of VeenaMAX TTS through Portkey Gateway.",
"voice": "charu_soft",
"response_format": "wav"
}'