Merge pull request #4500 from pipecat-ai/mb/update-gradium-endpoints

Update Gradium STT/TTS endpoints to region-neutral URLs
This commit is contained in:
Mark Backman
2026-05-15 15:59:14 -04:00
committed by GitHub
7 changed files with 5 additions and 11 deletions

View File

@@ -0,0 +1 @@
- Changed the default WebSocket endpoints for `GradiumSTTService` and `GradiumTTSService` to the region-neutral `wss://api.gradium.ai/api/speech/asr` and `wss://api.gradium.ai/api/speech/tts`. Gradium now automatically routes traffic to the nearest endpoint. Override the url to pin to a specific region.

View File

@@ -51,7 +51,6 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
stt = GradiumSTTService( stt = GradiumSTTService(
api_key=os.environ["GRADIUM_API_KEY"], api_key=os.environ["GRADIUM_API_KEY"],
api_endpoint_base_url="wss://us.api.gradium.ai/api/speech/asr",
settings=GradiumSTTService.Settings( settings=GradiumSTTService.Settings(
language=Language.EN, language=Language.EN,
delay_in_frames=8, delay_in_frames=8,

View File

@@ -50,10 +50,7 @@ transport_params = {
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot") logger.info(f"Starting bot")
stt = GradiumSTTService( stt = GradiumSTTService(api_key=os.environ["GRADIUM_API_KEY"])
api_key=os.environ["GRADIUM_API_KEY"],
api_endpoint_base_url="wss://us.api.gradium.ai/api/speech/asr",
)
tts = CartesiaTTSService( tts = CartesiaTTSService(
api_key=os.environ["CARTESIA_API_KEY"], api_key=os.environ["CARTESIA_API_KEY"],

View File

@@ -55,7 +55,6 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
tts = GradiumTTSService( tts = GradiumTTSService(
api_key=os.environ["GRADIUM_API_KEY"], api_key=os.environ["GRADIUM_API_KEY"],
settings=GradiumTTSService.Settings(voice="YTpq7expH9539ERJ"), settings=GradiumTTSService.Settings(voice="YTpq7expH9539ERJ"),
url="wss://us.api.gradium.ai/api/speech/tts",
) )
llm = OpenAILLMService( llm = OpenAILLMService(

View File

@@ -54,7 +54,6 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
stt = GradiumSTTService( stt = GradiumSTTService(
api_key=os.environ["GRADIUM_API_KEY"], api_key=os.environ["GRADIUM_API_KEY"],
api_endpoint_base_url="wss://us.api.gradium.ai/api/speech/asr",
settings=GradiumSTTService.Settings( settings=GradiumSTTService.Settings(
language=Language.EN, language=Language.EN,
), ),
@@ -62,7 +61,6 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
tts = GradiumTTSService( tts = GradiumTTSService(
api_key=os.environ["GRADIUM_API_KEY"], api_key=os.environ["GRADIUM_API_KEY"],
url="wss://us.api.gradium.ai/api/speech/tts",
settings=GradiumTTSService.Settings( settings=GradiumTTSService.Settings(
voice="YTpq7expH9539ERJ", voice="YTpq7expH9539ERJ",
), ),

View File

@@ -150,7 +150,7 @@ class GradiumSTTService(WebsocketSTTService):
self, self,
*, *,
api_key: str, api_key: str,
api_endpoint_base_url: str = "wss://eu.api.gradium.ai/api/speech/asr", api_endpoint_base_url: str = "wss://api.gradium.ai/api/speech/asr",
encoding: str = "pcm", encoding: str = "pcm",
sample_rate: int | None = None, sample_rate: int | None = None,
params: InputParams | None = None, params: InputParams | None = None,
@@ -163,7 +163,7 @@ class GradiumSTTService(WebsocketSTTService):
Args: Args:
api_key: Gradium API key for authentication. api_key: Gradium API key for authentication.
api_endpoint_base_url: WebSocket endpoint URL. Defaults to Gradium's streaming endpoint. api_endpoint_base_url: WebSocket endpoint URL.
encoding: Base audio encoding type. One of "pcm", "wav", or "opus". encoding: Base audio encoding type. One of "pcm", "wav", or "opus".
For PCM, the sample rate is appended automatically from the For PCM, the sample rate is appended automatically from the
pipeline's audio_in_sample_rate (e.g., "pcm" becomes "pcm_16000"). pipeline's audio_in_sample_rate (e.g., "pcm" becomes "pcm_16000").

View File

@@ -68,7 +68,7 @@ class GradiumTTSService(WebsocketTTSService):
*, *,
api_key: str, api_key: str,
voice_id: str | None = None, voice_id: str | None = None,
url: str = "wss://eu.api.gradium.ai/api/speech/tts", url: str = "wss://api.gradium.ai/api/speech/tts",
model: str | None = None, model: str | None = None,
json_config: str | None = None, json_config: str | None = None,
params: InputParams | None = None, params: InputParams | None = None,