Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Implementation:Groq Groq python SpeechCreateParams Usage

From Leeroopedia
Knowledge Sources
Domains Audio, Text_To_Speech
Last Updated 2026-02-15 16:00 GMT

Overview

Concrete TypedDict schema for configuring text-to-speech parameters in the Groq Python SDK.

Description

SpeechCreateParams is a TypedDict that defines the parameter schema for Speech.create(). It requires input (text), model (TTS model ID), and voice (voice ID). Optional parameters include response_format, sample_rate, and speed.

Usage

Parameters are passed directly to client.audio.speech.create() as keyword arguments. The SDK transforms them via maybe_transform() before sending.

Code Reference

Source Location

  • Repository: groq-python
  • File: src/groq/types/audio/speech_create_params.py
  • Lines: L1-34

Signature

class SpeechCreateParams(TypedDict, total=False):
    input: Required[str]
    model: Required[Union[str, Literal["playai-tts", "playai-tts-arabic"]]]
    voice: Required[str]
    response_format: Literal["flac", "mp3", "mulaw", "ogg", "wav"]
    sample_rate: Literal[8000, 16000, 22050, 24000, 32000, 44100, 48000]
    speed: float

Import

from groq.types.audio import SpeechCreateParams

I/O Contract

Inputs

Name Type Required Description
input str Yes Text to convert to speech
model str or Literal["playai-tts", "playai-tts-arabic"] Yes TTS model ID
voice str Yes Voice ID for speaker characteristics
response_format Literal["flac", "mp3", "mulaw", "ogg", "wav"] No Audio output format
sample_rate Literal[8000, 16000, 22050, 24000, 32000, 44100, 48000] No Audio sample rate in Hz
speed float No Speech speed multiplier

Outputs

Name Type Description
(value) dict Parameter dict ready for Speech.create() call

Usage Examples

# Parameters are passed as keyword arguments to create()
response = client.audio.speech.create(
    input="Hello, welcome to Groq!",
    model="playai-tts",
    voice="Arista-PlayAI",
    response_format="wav",
    sample_rate=24000,
)

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment