---
title: Gemini TTS Text-to-Speech
url: https://runapi.ai/docs/api/gemini-tts/text-to-speech.md
canonical: https://runapi.ai/docs/api/gemini-tts/text-to-speech
locale: en
---

# Gemini TTS Text-to-Speech

## Overview

Use the text to speech endpoint with a supported model. Use the returned Task ID to retrieve its state, or provide callback_url for the deliveries documented below.

### Quick start

1. Create an API key and set it as RUNAPI_API_KEY.
2. Choose a supported model and send a POST request whose body matches that model's schema.
3. Store the returned task ID, then poll until a terminal state or handle the callbacks documented below.

## Endpoint

POST /api/v1/gemini_tts/text_to_speech

Base URL: https://runapi.ai

API version: v1

Authentication: Authorization: Bearer YOUR_API_TOKEN

## Supported models

Open a model page for current pricing, rate limits, and commercial-usage details.

- [gemini-2.5-pro-tts](/models/gemini-tts/gemini-2.5-pro-tts)
- [gemini-3.1-flash-tts](/models/gemini-tts/gemini-3.1-flash-tts)

## Request schema

Fields and allowed values depend on the selected model. When supplied, callback_url receives the Task deliveries documented below.

### gemini-2.5-pro-tts

```json
{
  "callback_url": {
    "description": "Webhook URL for async notifications.",
    "type": "string"
  },
  "dialogue_turns": {
    "description": "Non-empty ordered dialogue turns whose speaker ids reference configured speakers.",
    "items": {
      "properties": {
        "speaker_id": {
          "description": "Identifier matching a configured speakers[].speaker_id.",
          "required": true,
          "type": "string"
        },
        "text": {
          "description": "Spoken text, up to 10,000 characters.",
          "length": true,
          "max": 10000,
          "required": true,
          "type": "string"
        }
      },
      "type": "object"
    },
    "min_items": 1,
    "required": true,
    "type": "array"
  },
  "model": {
    "description": "Model slug.",
    "required": true,
    "type": "string"
  },
  "sample_context": {
    "description": "Overall delivery context and tone.",
    "type": "string"
  },
  "scene": {
    "description": "Scene and recording environment.",
    "type": "string"
  },
  "speakers": {
    "description": "Non-empty speaker configurations with unique Speaker N identifiers.",
    "items": {
      "properties": {
        "accent": {
          "description": "Speaker accent.",
          "enum": [
            "Neutral",
            "American (Gen)",
            "American (Valley)",
            "American (South)",
            "British (RP)",
            "British (Brixton)",
            "Transatlantic",
            "Australian"
          ],
          "required": true,
          "type": "string"
        },
        "audio_profile": {
          "description": "Optional voice character guidance.",
          "type": "string"
        },
        "pace": {
          "description": "Speaker pace.",
          "enum": [
            "Natural",
            "Rapid Fire",
            "The Drift",
            "Staccato"
          ],
          "required": true,
          "type": "string"
        },
        "speaker_id": {
          "description": "Unique identifier in Speaker N format.",
          "pattern": "^Speaker [1-9][0-9]*$",
          "required": true,
          "type": "string"
        },
        "style": {
          "description": "Speaker delivery style.",
          "enum": [
            "Vocal Smile",
            "Newscaster",
            "Whisper",
            "Empathetic",
            "Promo/Hype",
            "Deadpan"
          ],
          "required": true,
          "type": "string"
        },
        "voice_name": {
          "description": "Preset voice name.",
          "enum": [
            "Achernar",
            "Achird",
            "Algenib",
            "Algieba",
            "Alnilam",
            "Aoede",
            "Autonoe",
            "Callirrhoe",
            "Charon",
            "Despina",
            "Enceladus",
            "Erinome",
            "Fenrir",
            "Gacrux",
            "Iapetus",
            "Kore",
            "Laomedeia",
            "Leda",
            "Orus",
            "Puck",
            "Pulcherrima",
            "Rasalgethi",
            "Sadachbia",
            "Sadaltager",
            "Schedar",
            "Sulafat",
            "Umbriel",
            "Vindemiatrix",
            "Zephyr",
            "Zubenelgenubi"
          ],
          "required": true,
          "type": "string"
        }
      },
      "type": "object"
    },
    "min_items": 1,
    "required": true,
    "type": "array"
  },
  "temperature": {
    "default": 1,
    "description": "Sampling temperature.",
    "max": 2,
    "min": 0,
    "type": "number"
  }
}
```

### gemini-3.1-flash-tts

```json
{
  "callback_url": {
    "description": "Webhook URL for async notifications.",
    "type": "string"
  },
  "dialogue_turns": {
    "description": "Non-empty ordered dialogue turns whose speaker ids reference configured speakers.",
    "items": {
      "properties": {
        "speaker_id": {
          "description": "Identifier matching a configured speakers[].speaker_id.",
          "required": true,
          "type": "string"
        },
        "text": {
          "description": "Spoken text, up to 10,000 characters.",
          "length": true,
          "max": 10000,
          "required": true,
          "type": "string"
        }
      },
      "type": "object"
    },
    "min_items": 1,
    "required": true,
    "type": "array"
  },
  "model": {
    "description": "Model slug.",
    "required": true,
    "type": "string"
  },
  "sample_context": {
    "description": "Overall delivery context and tone.",
    "type": "string"
  },
  "scene": {
    "description": "Scene and recording environment.",
    "type": "string"
  },
  "speakers": {
    "description": "Non-empty speaker configurations with unique Speaker N identifiers.",
    "items": {
      "properties": {
        "accent": {
          "description": "Speaker accent.",
          "enum": [
            "Neutral",
            "American (Gen)",
            "American (Valley)",
            "American (South)",
            "British (RP)",
            "British (Brixton)",
            "Transatlantic",
            "Australian"
          ],
          "required": true,
          "type": "string"
        },
        "audio_profile": {
          "description": "Optional voice character guidance.",
          "type": "string"
        },
        "pace": {
          "description": "Speaker pace.",
          "enum": [
            "Natural",
            "Rapid Fire",
            "The Drift",
            "Staccato"
          ],
          "required": true,
          "type": "string"
        },
        "speaker_id": {
          "description": "Unique identifier in Speaker N format.",
          "pattern": "^Speaker [1-9][0-9]*$",
          "required": true,
          "type": "string"
        },
        "style": {
          "description": "Speaker delivery style.",
          "enum": [
            "Vocal Smile",
            "Newscaster",
            "Whisper",
            "Empathetic",
            "Promo/Hype",
            "Deadpan"
          ],
          "required": true,
          "type": "string"
        },
        "voice_name": {
          "description": "Preset voice name.",
          "enum": [
            "Achernar",
            "Achird",
            "Algenib",
            "Algieba",
            "Alnilam",
            "Aoede",
            "Autonoe",
            "Callirrhoe",
            "Charon",
            "Despina",
            "Enceladus",
            "Erinome",
            "Fenrir",
            "Gacrux",
            "Iapetus",
            "Kore",
            "Laomedeia",
            "Leda",
            "Orus",
            "Puck",
            "Pulcherrima",
            "Rasalgethi",
            "Sadachbia",
            "Sadaltager",
            "Schedar",
            "Sulafat",
            "Umbriel",
            "Vindemiatrix",
            "Zephyr",
            "Zubenelgenubi"
          ],
          "required": true,
          "type": "string"
        }
      },
      "type": "object"
    },
    "min_items": 1,
    "required": true,
    "type": "array"
  },
  "temperature": {
    "default": 1,
    "description": "Sampling temperature.",
    "max": 2,
    "min": 0,
    "type": "number"
  }
}
```

## Create acceptance

HTTP 202 - POST /api/v1/gemini_tts/text_to_speech

### Response schema

```json
{
  "properties": {
    "billing": {
      "properties": {
        "refund": {
          "oneOf": [
            {
              "properties": {
                "refunded_at": {
                  "type": "string"
                }
              },
              "required": [
                "refunded_at"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "reservation": {
          "oneOf": [
            {
              "properties": {
                "amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "amount_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "settlement": {
          "oneOf": [
            {
              "properties": {
                "amount_micro_cents": {
                  "type": "integer"
                },
                "charged_amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "charged_amount_cents",
                "amount_micro_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        }
      },
      "required": [
        "reservation",
        "settlement",
        "refund"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "processing"
      ],
      "type": "string"
    },
    "task_replayed": {
      "type": "boolean"
    }
  },
  "required": [
    "id",
    "status",
    "billing"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Response example

```json
{
  "billing": {
    "refund": null,
    "reservation": null,
    "settlement": null
  },
  "id": "tsk_reference_demo",
  "status": "processing"
}
```

## Polling processing

HTTP 200 - GET /api/v1/gemini_tts/text_to_speech/:id

### Response schema

```json
{
  "properties": {
    "billing": {
      "properties": {
        "refund": {
          "oneOf": [
            {
              "properties": {
                "refunded_at": {
                  "type": "string"
                }
              },
              "required": [
                "refunded_at"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "reservation": {
          "oneOf": [
            {
              "properties": {
                "amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "amount_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "settlement": {
          "oneOf": [
            {
              "properties": {
                "amount_micro_cents": {
                  "type": "integer"
                },
                "charged_amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "charged_amount_cents",
                "amount_micro_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        }
      },
      "required": [
        "reservation",
        "settlement",
        "refund"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "processing"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status",
    "billing"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Response example

```json
{
  "billing": {
    "refund": null,
    "reservation": null,
    "settlement": null
  },
  "id": "tsk_reference_demo",
  "status": "processing"
}
```

## Polling completed

HTTP 200 - GET /api/v1/gemini_tts/text_to_speech/:id

### Response schema

```json
{
  "properties": {
    "audios": {
      "items": {
        "properties": {
          "url": {
            "type": "string"
          }
        },
        "required": [
          "url"
        ],
        "type": "object",
        "unevaluatedProperties": false
      },
      "type": "array"
    },
    "billing": {
      "properties": {
        "refund": {
          "oneOf": [
            {
              "properties": {
                "refunded_at": {
                  "type": "string"
                }
              },
              "required": [
                "refunded_at"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "reservation": {
          "oneOf": [
            {
              "properties": {
                "amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "amount_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "settlement": {
          "oneOf": [
            {
              "properties": {
                "amount_micro_cents": {
                  "type": "integer"
                },
                "charged_amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "charged_amount_cents",
                "amount_micro_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        }
      },
      "required": [
        "reservation",
        "settlement",
        "refund"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "completed"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status",
    "audios",
    "billing"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Response example

```json
{
  "audios": [
    {
      "url": "https://file.runapi.ai/reference-audio.mp3"
    }
  ],
  "billing": {
    "refund": null,
    "reservation": null,
    "settlement": null
  },
  "id": "tsk_reference_demo",
  "status": "completed"
}
```

## Polling failed

HTTP 200 - GET /api/v1/gemini_tts/text_to_speech/:id

### Response schema

```json
{
  "properties": {
    "billing": {
      "properties": {
        "refund": {
          "oneOf": [
            {
              "properties": {
                "refunded_at": {
                  "type": "string"
                }
              },
              "required": [
                "refunded_at"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "reservation": {
          "oneOf": [
            {
              "properties": {
                "amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "amount_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "settlement": {
          "oneOf": [
            {
              "properties": {
                "amount_micro_cents": {
                  "type": "integer"
                },
                "charged_amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "charged_amount_cents",
                "amount_micro_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        }
      },
      "required": [
        "reservation",
        "settlement",
        "refund"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "error": {
      "type": "string"
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "failed"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status",
    "error",
    "billing"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Response example

```json
{
  "billing": {
    "refund": null,
    "reservation": null,
    "settlement": null
  },
  "error": "Task processing failed.",
  "id": "tsk_reference_demo",
  "status": "failed"
}
```

## Customer callback: completed

HTTP 200 - POST callback_url

### Response schema

```json
{
  "properties": {
    "audios": {
      "items": {
        "properties": {
          "url": {
            "type": "string"
          }
        },
        "required": [
          "url"
        ],
        "type": "object",
        "unevaluatedProperties": false
      },
      "type": "array"
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "completed"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status",
    "audios"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Response example

```json
{
  "audios": [
    {
      "url": "https://file.runapi.ai/reference-audio.mp3"
    }
  ],
  "id": "tsk_reference_demo",
  "status": "completed"
}
```

## Customer callback: failed

HTTP 200 - POST callback_url

### Response schema

```json
{
  "properties": {
    "error": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "properties": {
            "code": {
              "type": "string"
            },
            "message": {
              "type": "string"
            }
          },
          "required": [
            "code",
            "message"
          ],
          "type": "object",
          "unevaluatedProperties": false
        }
      ]
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "failed"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status",
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Response example

```json
{
  "error": {
    "code": "generation_failed",
    "message": "Task processing failed."
  },
  "id": "tsk_reference_demo",
  "status": "failed"
}
```

## Errors

HTTP 401 - POST /api/v1/gemini_tts/text_to_speech

This response has no body.

## Errors

HTTP 401 - GET /api/v1/gemini_tts/text_to_speech/:id

This response has no body.

## Errors

HTTP 400 - POST /api/v1/gemini_tts/text_to_speech

### Response schema

```json
{
  "properties": {
    "billing": {
      "properties": {
        "refund": {
          "oneOf": [
            {
              "properties": {
                "refunded_at": {
                  "type": "string"
                }
              },
              "required": [
                "refunded_at"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "reservation": {
          "oneOf": [
            {
              "properties": {
                "amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "amount_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "settlement": {
          "oneOf": [
            {
              "properties": {
                "amount_micro_cents": {
                  "type": "integer"
                },
                "charged_amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "charged_amount_cents",
                "amount_micro_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        }
      },
      "required": [
        "reservation",
        "settlement",
        "refund"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "error": {
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      },
      "required": [
        "code",
        "message"
      ],
      "type": "object",
      "unevaluatedProperties": false
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Response example

```json
{
  "error": {
    "code": "model_must_be_one_of_gemini-2_5-pro-tts_gemini-3_1-flash-tts",
    "message": "model must be one of: gemini-2.5-pro-tts, gemini-3.1-flash-tts"
  }
}
```

## Errors

HTTP 402 - POST /api/v1/gemini_tts/text_to_speech

### Response schema

```json
{
  "properties": {
    "billing": {
      "properties": {
        "refund": {
          "oneOf": [
            {
              "properties": {
                "refunded_at": {
                  "type": "string"
                }
              },
              "required": [
                "refunded_at"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "reservation": {
          "oneOf": [
            {
              "properties": {
                "amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "amount_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "settlement": {
          "oneOf": [
            {
              "properties": {
                "amount_micro_cents": {
                  "type": "integer"
                },
                "charged_amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "charged_amount_cents",
                "amount_micro_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        }
      },
      "required": [
        "reservation",
        "settlement",
        "refund"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "error": {
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      },
      "required": [
        "code",
        "message"
      ],
      "type": "object",
      "unevaluatedProperties": false
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Response example

```json
{
  "error": {
    "code": "insufficient_balance",
    "message": "Insufficient balance"
  }
}
```

## Errors

HTTP 403 - POST /api/v1/gemini_tts/text_to_speech

### Response schema

```json
{
  "properties": {
    "billing": {
      "properties": {
        "refund": {
          "oneOf": [
            {
              "properties": {
                "refunded_at": {
                  "type": "string"
                }
              },
              "required": [
                "refunded_at"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "reservation": {
          "oneOf": [
            {
              "properties": {
                "amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "amount_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "settlement": {
          "oneOf": [
            {
              "properties": {
                "amount_micro_cents": {
                  "type": "integer"
                },
                "charged_amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "charged_amount_cents",
                "amount_micro_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        }
      },
      "required": [
        "reservation",
        "settlement",
        "refund"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "error": {
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      },
      "required": [
        "code",
        "message"
      ],
      "type": "object",
      "unevaluatedProperties": false
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Response example

```json
{
  "error": {
    "code": "api_token_credit_limit_exceeded",
    "message": "API key credit limit exceeded"
  }
}
```

## Errors

HTTP 409 - POST /api/v1/gemini_tts/text_to_speech

### Response schema

```json
{
  "properties": {
    "billing": {
      "properties": {
        "refund": {
          "oneOf": [
            {
              "properties": {
                "refunded_at": {
                  "type": "string"
                }
              },
              "required": [
                "refunded_at"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "reservation": {
          "oneOf": [
            {
              "properties": {
                "amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "amount_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "settlement": {
          "oneOf": [
            {
              "properties": {
                "amount_micro_cents": {
                  "type": "integer"
                },
                "charged_amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "charged_amount_cents",
                "amount_micro_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        }
      },
      "required": [
        "reservation",
        "settlement",
        "refund"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "error": {
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      },
      "required": [
        "code",
        "message"
      ],
      "type": "object",
      "unevaluatedProperties": false
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Response example

```json
{
  "error": {
    "code": "request_conflict",
    "message": "The request uses features that are not supported for the selected model"
  }
}
```

## Errors

HTTP 429 - POST /api/v1/gemini_tts/text_to_speech

### Response schema

```json
{
  "properties": {
    "billing": {
      "properties": {
        "refund": {
          "oneOf": [
            {
              "properties": {
                "refunded_at": {
                  "type": "string"
                }
              },
              "required": [
                "refunded_at"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "reservation": {
          "oneOf": [
            {
              "properties": {
                "amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "amount_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "settlement": {
          "oneOf": [
            {
              "properties": {
                "amount_micro_cents": {
                  "type": "integer"
                },
                "charged_amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "charged_amount_cents",
                "amount_micro_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        }
      },
      "required": [
        "reservation",
        "settlement",
        "refund"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "error": {
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      },
      "required": [
        "code",
        "message"
      ],
      "type": "object",
      "unevaluatedProperties": false
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Response example

```json
{
  "error": {
    "code": "rate_limited",
    "message": "Rate limit reached. Please retry later."
  }
}
```

## Errors

HTTP 503 - POST /api/v1/gemini_tts/text_to_speech

### Response schema

```json
{
  "properties": {
    "billing": {
      "properties": {
        "refund": {
          "oneOf": [
            {
              "properties": {
                "refunded_at": {
                  "type": "string"
                }
              },
              "required": [
                "refunded_at"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "reservation": {
          "oneOf": [
            {
              "properties": {
                "amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "amount_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "settlement": {
          "oneOf": [
            {
              "properties": {
                "amount_micro_cents": {
                  "type": "integer"
                },
                "charged_amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "charged_amount_cents",
                "amount_micro_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        }
      },
      "required": [
        "reservation",
        "settlement",
        "refund"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "error": {
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      },
      "required": [
        "code",
        "message"
      ],
      "type": "object",
      "unevaluatedProperties": false
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Response example

```json
{
  "error": {
    "code": "service_unavailable",
    "message": "Service under maintenance, please try again later"
  }
}
```

## Errors

HTTP 504 - POST /api/v1/gemini_tts/text_to_speech

### Response schema

```json
{
  "properties": {
    "billing": {
      "properties": {
        "refund": {
          "oneOf": [
            {
              "properties": {
                "refunded_at": {
                  "type": "string"
                }
              },
              "required": [
                "refunded_at"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "reservation": {
          "oneOf": [
            {
              "properties": {
                "amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "amount_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "settlement": {
          "oneOf": [
            {
              "properties": {
                "amount_micro_cents": {
                  "type": "integer"
                },
                "charged_amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "charged_amount_cents",
                "amount_micro_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        }
      },
      "required": [
        "reservation",
        "settlement",
        "refund"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "error": {
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      },
      "required": [
        "code",
        "message"
      ],
      "type": "object",
      "unevaluatedProperties": false
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Response example

```json
{
  "billing": {
    "refund": null,
    "reservation": null,
    "settlement": null
  },
  "error": {
    "code": "timeout_error",
    "message": "The request timed out"
  }
}
```

## Errors

HTTP 404 - GET /api/v1/gemini_tts/text_to_speech/:id

### Response schema

```json
{
  "properties": {
    "billing": {
      "properties": {
        "refund": {
          "oneOf": [
            {
              "properties": {
                "refunded_at": {
                  "type": "string"
                }
              },
              "required": [
                "refunded_at"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "reservation": {
          "oneOf": [
            {
              "properties": {
                "amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "amount_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "settlement": {
          "oneOf": [
            {
              "properties": {
                "amount_micro_cents": {
                  "type": "integer"
                },
                "charged_amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "charged_amount_cents",
                "amount_micro_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        }
      },
      "required": [
        "reservation",
        "settlement",
        "refund"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "error": {
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      },
      "required": [
        "code",
        "message"
      ],
      "type": "object",
      "unevaluatedProperties": false
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Response example

```json
{
  "error": {
    "code": "not_found",
    "message": "Task with id 'tsk_reference_demo' not found"
  }
}
```

## Generated Code Samples

Use cURL directly, or install an SDK for your language. Each sample submits the validated request shown in this reference.

### curl

```curl
curl -X POST https://runapi.ai/api/v1/gemini_tts/text_to_speech \
  -H 'Authorization: Bearer YOUR_API_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"model":"gemini-2.5-pro-tts","temperature":0.8,"scene":"A quiet recording studio","sample_context":"Natural conversational delivery","speakers":[{"speaker_id":"Speaker 1","voice_name":"Fenrir","audio_profile":"A calm host","accent":"British (RP)","style":"Newscaster","pace":"Natural"},{"speaker_id":"Speaker 2","voice_name":"Puck","accent":"American (Gen)","style":"Empathetic","pace":"Staccato"}],"dialogue_turns":[{"speaker_id":"Speaker 1","text":"Welcome to the show."},{"speaker_id":"Speaker 2","text":"Thanks for having me."}]}'
```

### javascript

#### Install

```bash
npm install @runapi.ai/gemini-tts
```

```javascript
import { GeminiTtsClient } from "@runapi.ai/gemini-tts";

const client = new GeminiTtsClient({ apiKey: process.env.RUNAPI_API_KEY });
const task = await client.textToSpeech.create({
  "model": "gemini-2.5-pro-tts",
  "temperature": 0.8,
  "scene": "A quiet recording studio",
  "sample_context": "Natural conversational delivery",
  "speakers": [
    {
      "speaker_id": "Speaker 1",
      "voice_name": "Fenrir",
      "audio_profile": "A calm host",
      "accent": "British (RP)",
      "style": "Newscaster",
      "pace": "Natural"
    },
    {
      "speaker_id": "Speaker 2",
      "voice_name": "Puck",
      "accent": "American (Gen)",
      "style": "Empathetic",
      "pace": "Staccato"
    }
  ],
  "dialogue_turns": [
    {
      "speaker_id": "Speaker 1",
      "text": "Welcome to the show."
    },
    {
      "speaker_id": "Speaker 2",
      "text": "Thanks for having me."
    }
  ]
});
```

### python

#### Install

```bash
pip install runapi-gemini-tts
```

```python
import os
from runapi.gemini_tts import GeminiTtsClient

client = GeminiTtsClient(api_key=os.environ["RUNAPI_API_KEY"])
task = client.text_to_speech.create(
  model="gemini-2.5-pro-tts",
  temperature=0.8,
  scene="A quiet recording studio",
  sample_context="Natural conversational delivery",
  speakers=[{"speaker_id": "Speaker 1", "voice_name": "Fenrir", "audio_profile": "A calm host", "accent": "British (RP)", "style": "Newscaster", "pace": "Natural"}, {"speaker_id": "Speaker 2", "voice_name": "Puck", "accent": "American (Gen)", "style": "Empathetic", "pace": "Staccato"}],
  dialogue_turns=[{"speaker_id": "Speaker 1", "text": "Welcome to the show."}, {"speaker_id": "Speaker 2", "text": "Thanks for having me."}]
)
```

### go

#### Install

```bash
go get github.com/runapi-ai/gemini-tts-sdk/go@latest
```

```go
package main

import (
  "context"
  "log"
  "os"

  "github.com/runapi-ai/core-sdk/go/option"
  geminitts "github.com/runapi-ai/gemini-tts-sdk/go/geminitts"
)

func main() {
  client, err := geminitts.NewClient(option.WithAPIKey(os.Getenv("RUNAPI_API_KEY")))
  if err != nil {
    log.Fatal(err)
  }

  task, err := client.TextToSpeech.Create(context.Background(), geminitts.TextToSpeechParams{
    Model: geminitts.Model("gemini-2.5-pro-tts"),
    Temperature: func(value float64) *float64 { return &value }(0.8),
    Scene: "A quiet recording studio",
    SampleContext: "Natural conversational delivery",
    Speakers: []geminitts.Speaker{geminitts.Speaker{SpeakerID: "Speaker 1", VoiceName: "Fenrir", AudioProfile: "A calm host", Accent: "British (RP)", Style: "Newscaster", Pace: "Natural"}, geminitts.Speaker{SpeakerID: "Speaker 2", VoiceName: "Puck", Accent: "American (Gen)", Style: "Empathetic", Pace: "Staccato"}},
    DialogueTurns: []geminitts.DialogueTurn{geminitts.DialogueTurn{SpeakerID: "Speaker 1", Text: "Welcome to the show."}, geminitts.DialogueTurn{SpeakerID: "Speaker 2", Text: "Thanks for having me."}},
  })
  if err != nil {
    log.Fatal(err)
  }
  _ = task
}
```

### ruby

#### Install

```bash
gem install runapi-gemini-tts
```

```ruby
require "runapi/gemini_tts"

client = RunApi::GeminiTts::Client.new(api_key: ENV.fetch("RUNAPI_API_KEY"))
task = client.text_to_speech.create(
  model: "gemini-2.5-pro-tts",
  temperature: 0.8,
  scene: "A quiet recording studio",
  sample_context: "Natural conversational delivery",
  speakers: [{"speaker_id": "Speaker 1", "voice_name": "Fenrir", "audio_profile": "A calm host", "accent": "British (RP)", "style": "Newscaster", "pace": "Natural"}, {"speaker_id": "Speaker 2", "voice_name": "Puck", "accent": "American (Gen)", "style": "Empathetic", "pace": "Staccato"}],
  dialogue_turns: [{"speaker_id": "Speaker 1", "text": "Welcome to the show."}, {"speaker_id": "Speaker 2", "text": "Thanks for having me."}]
)
```

### java

#### Install

```kotlin
implementation("ai.runapi:runapi-gemini-tts")
```

```java
import ai.runapi.geminitts.GeminiTtsClient;
import ai.runapi.geminitts.types.TextToSpeechParams;
import ai.runapi.core.polling.TaskCreateResponse;

public final class Example {
  public static void main(String[] args) {
    GeminiTtsClient client = GeminiTtsClient.builder()
        .apiKey(System.getenv("RUNAPI_API_KEY"))
        .build();
    TaskCreateResponse task = client.textToSpeech().create(
        TextToSpeechParams.builder()
        .model("gemini-2.5-pro-tts")
        .temperature(0.8)
        .scene("A quiet recording studio")
        .sampleContext("Natural conversational delivery")
        .speakers(java.util.Arrays.asList(ai.runapi.geminitts.types.Speaker.builder().speakerId("Speaker 1").voiceName("Fenrir").audioProfile("A calm host").accent("British (RP)").style("Newscaster").pace("Natural").build(), ai.runapi.geminitts.types.Speaker.builder().speakerId("Speaker 2").voiceName("Puck").accent("American (Gen)").style("Empathetic").pace("Staccato").build()))
        .dialogueTurns(java.util.Arrays.asList(ai.runapi.geminitts.types.DialogueTurn.builder().speakerId("Speaker 1").text("Welcome to the show.").build(), ai.runapi.geminitts.types.DialogueTurn.builder().speakerId("Speaker 2").text("Thanks for having me.").build()))
            .build()
    );
  }
}
```

### php

#### Install

```bash
composer require runapi-ai/gemini-tts
```

```php
<?php

require __DIR__ . '/vendor/autoload.php';

use RunApi\Core\ClientOptions;
use RunApi\GeminiTts\GeminiTtsClient;

$client = new GeminiTtsClient(new ClientOptions(apiKey: getenv('RUNAPI_API_KEY')));
$task = $client->textToSpeech->create([
  "model" => "gemini-2.5-pro-tts",
  "temperature" => 0.8,
  "scene" => "A quiet recording studio",
  "sample_context" => "Natural conversational delivery",
  "speakers" => [["speaker_id" => "Speaker 1", "voice_name" => "Fenrir", "audio_profile" => "A calm host", "accent" => "British (RP)", "style" => "Newscaster", "pace" => "Natural"], ["speaker_id" => "Speaker 2", "voice_name" => "Puck", "accent" => "American (Gen)", "style" => "Empathetic", "pace" => "Staccato"]],
  "dialogue_turns" => [["speaker_id" => "Speaker 1", "text" => "Welcome to the show."], ["speaker_id" => "Speaker 2", "text" => "Thanks for having me."]]
]);
```

## Related Guides

- [Authentication](/docs/guides/authentication)
- [Quickstart](/docs/guides/task-api/quickstart)
