Router.Audio.Speech
Create a Speech
Generates audio from the input text.from orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
orq.router.audio.speech.create(input="<value>", model="Grand Caravan", voice="<value>", response_format="mp3", speed=1, retry={
"on_codes": [
429,
500,
502,
503,
504,
],
}, load_balancer={
"type": "weight_based",
"models": [
{
"model": "openai/gpt-4o",
"weight": 0.7,
},
],
}, timeout={
"call_timeout": 30000,
}, orq={
"retry": {
"on_codes": [
429,
500,
502,
503,
504,
],
},
"fallbacks": [
{
"model": "openai/gpt-4o-mini",
},
],
"identity": {
"id": "contact_01ARZ3NDEKTSV4RRFFQ69G5FAV",
"display_name": "Jane Doe",
"email": "jane.doe@example.com",
"metadata": [
{
"department": "Engineering",
"role": "Senior Developer",
},
],
"logo_url": "https://example.com/avatars/jane-doe.jpg",
"tags": [
"hr",
"engineering",
],
},
"thread": {
"id": "thread_01ARZ3NDEKTSV4RRFFQ69G5FAV",
"tags": [
"customer-support",
"priority-high",
],
},
"load_balancer": {
"type": "weight_based",
"models": [
{
"model": "openai/gpt-4o",
"weight": 0.7,
},
{
"model": "anthropic/claude-3-5-sonnet",
"weight": 0.3,
},
],
},
"timeout": {
"call_timeout": 30000,
},
})
# Use the SDK ...
Show Parameters
Show Parameters
{
"input": str, # required
"model": str, # required
"voice": str, # required
"response_format": Optional[Literal["mp3", "opus", "aac", "flac", "wav", "pcm"]],
"speed": Optional[float],
"name": Optional[str],
"fallbacks": { # optional
"model": str, # required
},
"retry": { # optional
"count": Optional[float],
"on_codes": List[float],
},
"load_balancer": Union[CreateSpeechLoadBalancer1],
"timeout": { # optional
"call_timeout": float, # required
},
"orq": { # optional
"retry": { # optional
"count": Optional[float],
"on_codes": List[float],
},
"fallbacks": { # optional
"model": str, # required
},
"name": Optional[str],
"identity": { # optional
"id": str, # required
"display_name": Optional[str],
"email": Optional[str],
"metadata": List[Dict[str, Any]],
"logo_url": Optional[str],
"tags": List[str],
},
"~~`contact`~~": { # optional
"id": str, # required
"display_name": Optional[str],
"email": Optional[str],
"metadata": List[Dict[str, Any]],
"logo_url": Optional[str],
"tags": List[str],
},
"thread": { # optional
"id": str, # required
"tags": List[str],
},
"load_balancer": Union[CreateSpeechLoadBalancerRouterAudioSpeech1],
"timeout": { # optional
"call_timeout": float, # required
},
},
}