async def run_tts(self, text: str) -> AsyncGenerator[Frame, None]:
        """Generate speech from text using Neuphonic streaming API.

        Args:
            text: The text to convert to speech
        Yields:
            Frames containing audio data and status information
        """
        logger.debug(f"Generating TTS: [{text}]")

        client = Neuphonic(api_key=self._api_key, base_url=self._url.replace("https://", ""))

        sse = client.tts.AsyncSSEClient()

        try:
            await self.start_ttfb_metrics()
            response = sse.send(text, TTSConfig(**self._settings, voice_id=self._voice_id))

            await self.start_tts_usage_metrics(text)
            yield TTSStartedFrame()

            async for message in response:
                if message.status_code != 200:
                    logger.error(f"{self} error: {message.errors}")
                    yield ErrorFrame(error=f"Neuphonic API error: {message.errors}")

                await self.stop_ttfb_metrics()
                yield TTSAudioRawFrame(message.data.audio, self.sample_rate, 1)
        except Exception as e:
            logger.error(f"Error in run_tts: {e}")
            yield ErrorFrame(error=str(e))
        finally:
            yield TTSStoppedFrame()
Generate speech from text using Neuphonic streaming API.

        Args:
            text: The text to convert to speech
        Yields:
            Frames containing audio data and status information
        
src/pipecat/services/neuphonic/tts.py