Gradium

Updated

Use Gradium for text-to-speech (TTS) in a Conversational AI Platform agent.

Preview documentation

You're reading the Conversational AI Platform (Preview) docs. Switch to Main.

Gradium provides enterprise-grade AI voice generation with text-to-speech (TTS) models.

Sample configuration

The following example shows how to configure Gradium as the agent's TTS when you create or update an agent. For a complete example, see Create an agent and start a session.

Gradium supports BYOK only. It isn't available in managed mode. Store your Gradium API key in a secret set, and refer to it from the agent. For details, see Use your own provider keys.

from agora_agent import Agent, GradiumTTS, secret_ref

# client is your configured Agora client
agent = (
    Agent(client=client)
    .with_stt(...)  # configure your ASR vendor
    .with_llm(...)  # configure your LLM vendor
    .with_tts(
        GradiumTTS(
            api_key=secret_ref("support_prod", "gradium"),
            url="wss://api.gradium.ai/api/speech/tts",
            model_name="default",
            voice_id="<your_gradium_voice_id>",
            sample_rate=16000,
        )
    )
)
import { Agent, GradiumTTS, secretRef } from 'agora-agents';

// client is your configured Agora client
const agent = new Agent({ client })
  .withStt(/* configure your ASR vendor */)
  .withLlm(/* configure your LLM vendor */)
  .withTts(
    new GradiumTTS({
      apiKey: secretRef('support_prod', 'gradium'),
      url: 'wss://api.gradium.ai/api/speech/tts',
      modelName: 'default',
      voiceId: '<your_gradium_voice_id>',
      sampleRate: 16000,
    }),
  );
// client is your configured Agora client
sampleRate := vendors.SampleRate16kHz
agent := agentkit.NewAgent(client).
	WithStt( /* configure your ASR vendor */ ).
	WithLlm( /* configure your LLM vendor */ ).
	WithTts(vendors.NewGradiumTTS(vendors.GradiumTTSOptions{
		APIKey:     agentkit.SecretRef("support_prod", "gradium"),
		URL:        "wss://api.gradium.ai/api/speech/tts",
		ModelName:  "default",
		VoiceID:    "<your_gradium_voice_id>",
		SampleRate: &sampleRate,
	}))

Set credential.mode to byok and credential.fields.api_key to a reference to your Gradium API key. In the following example, the key is stored as gradium in the support_prod set:

"tts": {
  "credential": {
    "mode": "byok",
    "fields": {
      "api_key": "$secrets.support_prod.gradium"
    }
  },
  "vendor": "gradium",
  "url": "wss://api.gradium.ai/api/speech/tts",
  "params": {
    "model_name": "default",
    "voice_id": "<your_gradium_voice_id>",
    "sample_rate": 16000
  }
}

Key parameters

The tts block takes the following fields. In the SDKs, GradiumTTS sets them from its options.

tts
vendorstring
required

Set to gradium.

credentialobject
required

Set mode to byok and fields.api_key to a $secrets.<set>.<key> reference to your Gradium API key.

urlstring
optional

The WebSocket endpoint for streaming TTS output. For example, wss://api.gradium.ai/api/speech/tts.

paramsobject
required
model_namestring
optional

The TTS model to use. For example, default.

voice_idstring
optional

The voice identifier to use.

sample_ratenumber
optional

The audio sample rate in Hz. For example, 16000.

Caution

The parameters listed on this page are validated for use with the Conversational AI Platform. Required parameters must be provided as documented. Any additional parameters in params are passed through directly to Gradium without validation. For a full list of supported options, refer to the Gradium documentation.

This integration is fully supported for use with the Conversational AI Platform. While it has completed functional validation, it is newer to the platform, and additional provider-specific edge cases may be identified as usage scales across a broader range of applications and workloads.