Skip to content

Add speed parameter support for xAI TTS #6338

Description

@bigen1925

Feature Type

Would make my life easier

Feature Description

xAI's TTS API (both POST /v1/tts and the streaming wss://api.x.ai/v1/tts) supports a speed parameter (0.71.5, default 1.0) to control speech rate, but this isn't exposed for xAI in livekit-agents yet. XaiOptions in livekit.agents.inference.tts currently only has bit_rate:

class XaiOptions(TypedDict, total=False):
    bit_rate: Literal[32000, 64000, 96000, 128000, 192000]

So there's no way to do this today:

tts = inference.TTS("xai/grok-tts", voice="eve", extra_kwargs={"speed": 1.2})

Other providers already have this (CartesiaOptions.speed, ElevenlabsOptions.speed, RimeOptions.speed_alpha, InworldOptions.speaking_rate), so it'd be nice to get xAI to parity. Docs: https://docs.x.ai/developers/model-capabilities/audio/text-to-speech

Not sure if livekit-plugins-xai (direct API key usage) already forwards speed — if it doesn't, probably worth fixing there too.

Workarounds / Alternatives

None currently — using a different TTS provider just for speed control isn't worth it for us.

Additional Context

No response

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions