全GPT 20%オフ 🎉 DeepSeek 30%オフ詳細はこちら

Gemini 3.1 Flash TTS Preview

音声生成
google/gemini-3.1-flash-tts-preview
利用可能なプロバイダー
Vertex
対応プロトコル
openai

Providers

Vertex
入力トークン
$1/M
出力トークン
$20/M
音声出力
$20/M
Protocols
openai/v1/audio/speech

コード例

from openai import OpenAI
client = OpenAI(base_url="https://api.ofox.run/v1", api_key="YOUR_OFOX_API_KEY")
response = client.audio.speech.create(
model="google/gemini-3.1-flash-tts-preview",
voice="Kore",
input="Hello from OFOX.",
response_format="wav",
speed=1.1,
extra_body={"language_code": "en-US", "instructions": "Speak warmly and clearly."},
)
response.stream_to_file("speech.wav")

旧 Gemini TTS:language_code と instructions は任意、speed はおおよその話速です。選択可能な形式は WAV のみです。SSE で WAV を明示すると完全なファイルを返し、省略時は PCM チャンクを返します。

よくある質問

ベースURLをhttps://api.ofox.run/v1に設定し、Ofox APIキーを使用するだけ。OpenAI互換APIなので、既存コードのベースURLとAPIキーを変更するだけです。