---
title: Gemini TTS テキスト読み上げ | RunAPI
description: テキストから音声へのエンドポイントを使用して、非同期タスクを作成します。
url: https://runapi.ai/ja/docs/api/gemini-tts/text-to-speech.md
canonical: https://runapi.ai/ja/docs/api/gemini-tts/text-to-speech
locale: ja
---

> HTML 版: https://runapi.ai/ja/docs/api/gemini-tts/text-to-speech
> エージェント向けサイトインデックス: https://runapi.ai/llms.txt

# Gemini TTS テキスト読み上げ

## 概要

サポートされているモデルでテキストから音声へのエンドポイントを使用します。返されたタスクIDを使用してその状態を取得するか、以下に記載されている配信のために callback_url を指定してください。

### クイックスタート

1. APIキーを作成し、RUNAPI_API_KEYとして設定します。
2. サポートされているモデルを選択し、そのモデルのスキーマに一致するボディを持つPOSTリクエストを送信します。
3. 返されたタスクIDを保存し、終了状態になるまでポーリングするか、以下に記載されているコールバックを処理してください。

## エンドポイント

POST /api/v1/gemini_tts/text_to_speech

ベースURL: https://runapi.ai

API バージョン: v1

認証: Authorization: Bearer YOUR_API_TOKEN

## サポートされているモデル

現在の料金、レート制限、商用利用の詳細については、モデルページを開いてください。

- [gemini-2.5-pro-tts](https://runapi.ai/ja/models/gemini-tts/gemini-2.5-pro-tts)
- [gemini-3.1-flash-tts](https://runapi.ai/ja/models/gemini-tts/gemini-3.1-flash-tts)

## リクエストスキーマ

フィールドと許可される値は選択したモデルによって異なります。指定した場合、callback_urlは以下に記載されたTask配信を受信します。

### gemini-2.5-pro-tts

```json
{
  "callback_url": {
    "description": "非同期通知用のWebhook URL。",
    "type": "string"
  },
  "dialogue_turns": {
    "description": "設定済みのスピーカーIDを参照する、空でない順序付き対話ターン。",
    "items": {
      "properties": {
        "speaker_id": {
          "description": "設定済みの speakers[].speaker_id に一致する識別子。",
          "required": true,
          "type": "string"
        },
        "text": {
          "description": "話す内容のテキスト（最大10,000文字）。",
          "length": true,
          "max": 10000,
          "required": true,
          "type": "string"
        }
      },
      "type": "object"
    },
    "min_items": 1,
    "required": true,
    "type": "array"
  },
  "model": {
    "description": "モデルスラッグ。",
    "required": true,
    "type": "string"
  },
  "sample_context": {
    "description": "全体的な配信コンテキストとトーン。",
    "type": "string"
  },
  "scene": {
    "description": "シーンと録音環境。",
    "type": "string"
  },
  "speakers": {
    "description": "一意のSpeaker N識別子を持つ、空でないスピーカー設定。",
    "items": {
      "properties": {
        "accent": {
          "description": "話者のアクセント。",
          "enum": [
            "Neutral",
            "American (Gen)",
            "American (Valley)",
            "American (South)",
            "British (RP)",
            "British (Brixton)",
            "Transatlantic",
            "Australian"
          ],
          "type": "string"
        },
        "audio_profile": {
          "description": "オプションの音声キャラクターガイダンス。",
          "type": "string"
        },
        "pace": {
          "description": "話者のペース。",
          "enum": [
            "Natural",
            "Rapid Fire",
            "The Drift",
            "Staccato"
          ],
          "type": "string"
        },
        "speaker_id": {
          "description": "Speaker N形式の一意な識別子。",
          "pattern": "^Speaker [1-9][0-9]*$",
          "required": true,
          "type": "string"
        },
        "style": {
          "description": "話者のデリバリースタイル。",
          "enum": [
            "Vocal Smile",
            "Newscaster",
            "Whisper",
            "Empathetic",
            "Promo/Hype",
            "Deadpan"
          ],
          "type": "string"
        },
        "voice_name": {
          "description": "プリセット音声名。",
          "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": "サンプリング温度。",
    "max": 2,
    "min": 0,
    "type": "number"
  }
}
```

### gemini-3.1-flash-tts

```json
{
  "callback_url": {
    "description": "非同期通知用のWebhook URL。",
    "type": "string"
  },
  "dialogue_turns": {
    "description": "設定済みのスピーカーIDを参照する、空でない順序付き対話ターン。",
    "items": {
      "properties": {
        "speaker_id": {
          "description": "設定済みの speakers[].speaker_id に一致する識別子。",
          "required": true,
          "type": "string"
        },
        "text": {
          "description": "話す内容のテキスト（最大10,000文字）。",
          "length": true,
          "max": 10000,
          "required": true,
          "type": "string"
        }
      },
      "type": "object"
    },
    "min_items": 1,
    "required": true,
    "type": "array"
  },
  "model": {
    "description": "モデルスラッグ。",
    "required": true,
    "type": "string"
  },
  "sample_context": {
    "description": "全体的な配信コンテキストとトーン。",
    "type": "string"
  },
  "scene": {
    "description": "シーンと録音環境。",
    "type": "string"
  },
  "speakers": {
    "description": "一意のSpeaker N識別子を持つ、空でないスピーカー設定。",
    "items": {
      "properties": {
        "accent": {
          "description": "話者のアクセント。",
          "enum": [
            "Neutral",
            "American (Gen)",
            "American (Valley)",
            "American (South)",
            "British (RP)",
            "British (Brixton)",
            "Transatlantic",
            "Australian"
          ],
          "type": "string"
        },
        "audio_profile": {
          "description": "オプションの音声キャラクターガイダンス。",
          "type": "string"
        },
        "pace": {
          "description": "話者のペース。",
          "enum": [
            "Natural",
            "Rapid Fire",
            "The Drift",
            "Staccato"
          ],
          "type": "string"
        },
        "speaker_id": {
          "description": "Speaker N形式の一意な識別子。",
          "pattern": "^Speaker [1-9][0-9]*$",
          "required": true,
          "type": "string"
        },
        "style": {
          "description": "話者のデリバリースタイル。",
          "enum": [
            "Vocal Smile",
            "Newscaster",
            "Whisper",
            "Empathetic",
            "Promo/Hype",
            "Deadpan"
          ],
          "type": "string"
        },
        "voice_name": {
          "description": "プリセット音声名。",
          "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": "サンプリング温度。",
    "max": 2,
    "min": 0,
    "type": "number"
  }
}
```

## 承認を作成する

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

### レスポンススキーマ

```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
}
```

### レスポンス例

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

## ポーリング処理中

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

### レスポンススキーマ

```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
}
```

### レスポンス例

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

## ポーリング完了

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

### レスポンススキーマ

```json
{
  "properties": {
    "audios": {
      "items": {
        "properties": {
          "url": {
            "type": "string",
            "x-runapi-generated-media": true
          }
        },
        "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
}
```

### レスポンス例

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

## ポーリング失敗

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

### レスポンススキーマ

```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
}
```

### レスポンス例

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

## 顧客コールバック: 完了

HTTP 200 - POST callback_url

### レスポンススキーマ

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

### レスポンス例

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

## 顧客コールバック: 失敗

HTTP 200 - POST callback_url

### レスポンススキーマ

```json
{
  "properties": {
    "error": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "properties": {
            "code": {
              "type": "string"
            },
            "limit_cents": {
              "type": "integer"
            },
            "message": {
              "type": "string"
            },
            "reset_at": {
              "format": "date-time",
              "type": [
                "string",
                "null"
              ]
            },
            "used_cents": {
              "type": "integer"
            },
            "window": {
              "enum": [
                "1h",
                "1d",
                "7d",
                "daily",
                "weekly",
                "monthly",
                "lifetime"
              ],
              "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
}
```

### レスポンス例

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

## エラー

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

### レスポンススキーマ

```json
{
  "properties": {
    "error": {
      "description": "人が読めるエラーメッセージ。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### レスポンス例

```json
{
  "error": "Authentication required"
}
```

## エラー

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

### レスポンススキーマ

```json
{
  "properties": {
    "error": {
      "description": "人が読めるエラーメッセージ。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### レスポンス例

```json
{
  "error": "Authentication required"
}
```

## エラー

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

### レスポンススキーマ

```json
{
  "oneOf": [
    {
      "properties": {
        "error": {
          "description": "人が読めるエラーメッセージ。",
          "type": "string"
        }
      },
      "required": [
        "error"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    {
      "properties": {
        "error": {
          "description": "人間が読める形式のバリデーションサマリー。",
          "type": "string"
        },
        "errors": {
          "additionalProperties": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "description": "公開リクエストフィールドをキーとするバリデーションメッセージ。各フィールドに対して人間が読める文字列の配列が含まれます。",
          "type": "object"
        }
      },
      "required": [
        "error",
        "errors"
      ],
      "type": "object",
      "unevaluatedProperties": false
    }
  ]
}
```

### レスポンス例

```json
{
  "error": "model must be one of: gemini-2.5-pro-tts, gemini-3.1-flash-tts"
}
```

## エラー

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

### レスポンススキーマ

```json
{
  "properties": {
    "error": {
      "description": "人が読めるエラーメッセージ。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### レスポンス例

```json
{
  "error": "Insufficient balance"
}
```

## エラー

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

### レスポンススキーマ

```json
{
  "properties": {
    "error": {
      "description": "人が読めるエラーメッセージ。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### レスポンス例

```json
{
  "error": "API key credit limit exceeded"
}
```

## エラー

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

### レスポンススキーマ

```json
{
  "properties": {
    "error": {
      "description": "人が読めるエラーメッセージ。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### レスポンス例

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

## エラー

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

### レスポンススキーマ

```json
{
  "properties": {
    "error": {
      "description": "人が読めるエラーメッセージ。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### レスポンス例

```json
{
  "error": "Rate limit reached. Please retry later."
}
```

## エラー

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

### レスポンススキーマ

```json
{
  "properties": {
    "error": {
      "description": "人が読めるエラーメッセージ。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### レスポンス例

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

## エラー

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

### レスポンススキーマ

```json
{
  "properties": {
    "error": {
      "description": "人が読めるエラーメッセージ。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### レスポンス例

```json
{
  "error": "The request timed out"
}
```

## エラー

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

### レスポンススキーマ

```json
{
  "properties": {
    "error": {
      "description": "人が読めるエラーメッセージ。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### レスポンス例

```json
{
  "error": "Task with id 'tsk_reference_demo' not found"
}
```

## 生成されたコードサンプル

cURLを直接使用するか、お使いの言語向けのSDKをインストールしてください。各サンプルは、このリファレンスに示されたバリデーション済みリクエストを送信します。

### 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

#### インストール

```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

#### インストール

```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

#### インストール

```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

#### インストール

```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

#### インストール

```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

#### インストール

```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."]]
]);
```

## 関連ガイド

- [認証](https://runapi.ai/ja/docs/guides/authentication.md)
- [クイックスタート](https://runapi.ai/ja/docs/guides/task-api/quickstart.md)

---

## RunAPI のその他の情報

- [ホーム](https://runapi.ai/ja/.md)
- [モデルカタログ](https://runapi.ai/ja/models.md)
- [料金](https://runapi.ai/ja/pricing.md)
- [プロバイダー](https://runapi.ai/ja/models)
- [ドキュメント](https://runapi.ai/ja/docs/guides)
- [SDK](https://runapi.ai/ja/sdk.md)
- [CLI](https://runapi.ai/ja/cli.md)
- [MCP Server](https://runapi.ai/ja/mcp.md)
- [Claude Code と Cursor](https://runapi.ai/ja/claude-code-vs-cursor.md)
- [Cursor API セットアップ](https://runapi.ai/ja/cursor-api-setup.md)
- [RunAPI と OpenRouter の比較](https://runapi.ai/ja/openrouter-alternative.md)
- [エンタープライズ](https://runapi.ai/ja/contact.md)
- [お問い合わせ](https://runapi.ai/ja/contact.md)
- [利用規約](https://runapi.ai/ja/terms.md)
- [プライバシー](https://runapi.ai/ja/privacy.md)
- [エージェント向けサイトインデックス](https://runapi.ai/llms.txt)

お問い合わせ: contact@runapi.ai

## 構造化データ

```json
[
  {
    "@context": "https://schema.org",
    "inLanguage": "ja",
    "@type": "WebSite",
    "name": "RunAPI",
    "url": "https://runapi.ai/ja",
    "potentialAction": {
      "@type": "SearchAction",
      "target": {
        "@type": "EntryPoint",
        "urlTemplate": "https://runapi.ai/ja/models?q={search_term_string}"
      },
      "query-input": "required name=search_term_string"
    }
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "ja",
    "@type": "Organization",
    "name": "RunAPI",
    "url": "https://runapi.ai/ja",
    "logo": {
      "@type": "ImageObject",
      "url": "https://runapi.ai/jaicon.svg"
    },
    "sameAs": [
      "https://github.com/runapi-ai"
    ]
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "ja",
    "@type": "TechArticle",
    "headline": "Gemini TTS テキスト読み上げ",
    "description": "テキストから音声へのエンドポイントを使用して、非同期タスクを作成します。",
    "url": "https://runapi.ai/ja/docs/api/gemini-tts/text-to-speech",
    "mainEntityOfPage": "https://runapi.ai/ja/docs/api/gemini-tts/text-to-speech"
  }
]
```
