from pydantic import BaseModel, Field class TTSRequest(BaseModel): text: str = Field(..., min_length=1, max_length=5000) # gTTS uses language codes; keep voice field for compatibility. voice: str = Field(default="en") # Free backend supports only mp3. format: str = Field(default="mp3", pattern="^(mp3)$") class Config: json_schema_extra = { "example": { "text": "Hello, this is a test of text-to-speech.", "voice": "en", "format": "mp3", } }