Skip to content

非公式本サイトは非公式の日本語ドキュメントであり、Cloudflare 公式サイトではありません。最新情報はdevelopers.cloudflare.comをご確認ください。

OpenAI のロゴ

TTS-1

テキスト読み上げ • OpenAI

Markdown で表示Agent セットアップ
  • サードパーティ
  • ゼロデータ保持

低レイテンシのリアルタイム用途向けに最適化された、OpenAI のテキスト読み上げモデルです。

モデル情報
利用規約とライセンスリンク
詳細情報リンク
ゼロデータ保持はい
料金Cloudflare ダッシュボードで料金を見る

使い方

const response = await env.AI.run(
  'openai/tts-1',
  {
    response_format: 'mp3',
    speed: 1,
    text: 'Hello! Welcome to Cloudflare AI Gateway. Let me show you what we can do.',
    voice: 'alloy',
  },
)
console.log(response)
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \
  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "openai/tts-1",
  "input": {
    "response_format": "mp3",
    "speed": 1,
    "text": "Hello! Welcome to Cloudflare AI Gateway. Let me show you what we can do.",
    "voice": "alloy"
  }
}'
{
  "gatewayMetadata": {
    "keySource": "Unified"
  },
  "result": {
    "audio": "https://pub-04a6d208d361438ea01b797e6973bd19.r2.dev/catalog/openai__tts-1/simple-speech.mp3"
  },
  "state": "Completed"
}

別の音声 — 別のトーンに Nova 音声を使います
const response = await env.AI.run(
  'openai/tts-1',
  {
    response_format: 'mp3',
    speed: 1,
    text: 'The weather today is sunny with a high of 72 degrees. Perfect for a walk in the park.',
    voice: 'nova',
  },
)
console.log(response)
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \
  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "openai/tts-1",
  "input": {
    "response_format": "mp3",
    "speed": 1,
    "text": "The weather today is sunny with a high of 72 degrees. Perfect for a walk in the park.",
    "voice": "nova"
  }
}'
{
  "gatewayMetadata": {
    "keySource": "Unified"
  },
  "result": {
    "audio": "https://pub-04a6d208d361438ea01b797e6973bd19.r2.dev/catalog/openai__tts-1/different-voice.mp3"
  },
  "state": "Completed"
}
ナレーション — Onyx 音声による、ゆっくりしたナレーションです
const response = await env.AI.run(
  'openai/tts-1',
  {
    response_format: 'mp3',
    speed: 0.85,
    text: 'In the beginning, the universe was a singularity of infinite density. Then, in a fraction of a second, it expanded into everything we know today.',
    voice: 'onyx',
  },
)
console.log(response)
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \
  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "openai/tts-1",
  "input": {
    "response_format": "mp3",
    "speed": 0.85,
    "text": "In the beginning, the universe was a singularity of infinite density. Then, in a fraction of a second, it expanded into everything we know today.",
    "voice": "onyx"
  }
}'
{
  "gatewayMetadata": {
    "keySource": "Unified"
  },
  "result": {
    "audio": "https://pub-04a6d208d361438ea01b797e6973bd19.r2.dev/catalog/openai__tts-1/narration.mp3"
  },
  "state": "Completed"
}
Echo 音声 — より低いトーンに Echo 音声を使います
const response = await env.AI.run(
  'openai/tts-1',
  {
    response_format: 'mp3',
    speed: 1,
    text: 'Welcome back to the podcast. Today we are going to talk about the future of artificial intelligence and its impact on creative work.',
    voice: 'echo',
  },
)
console.log(response)
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \
  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "openai/tts-1",
  "input": {
    "response_format": "mp3",
    "speed": 1,
    "text": "Welcome back to the podcast. Today we are going to talk about the future of artificial intelligence and its impact on creative work.",
    "voice": "echo"
  }
}'
{
  "gatewayMetadata": {
    "keySource": "Unified"
  },
  "result": {
    "audio": "https://pub-04a6d208d361438ea01b797e6973bd19.r2.dev/catalog/openai__tts-1/echo-voice.mp3"
  },
  "state": "Completed"
}
速い再生 — すばやく聞けるよう発話を速くします
const response = await env.AI.run(
  'openai/tts-1',
  {
    response_format: 'mp3',
    speed: 1.5,
    text: 'This is a fast-paced summary of the key findings from the quarterly report. Revenue is up fifteen percent, user growth exceeded expectations, and infrastructure costs remain stable.',
    voice: 'shimmer',
  },
)
console.log(response)
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \
  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "openai/tts-1",
  "input": {
    "response_format": "mp3",
    "speed": 1.5,
    "text": "This is a fast-paced summary of the key findings from the quarterly report. Revenue is up fifteen percent, user growth exceeded expectations, and infrastructure costs remain stable.",
    "voice": "shimmer"
  }
}'
{
  "gatewayMetadata": {
    "keySource": "Unified"
  },
  "result": {
    "audio": "https://pub-04a6d208d361438ea01b797e6973bd19.r2.dev/catalog/openai__tts-1/fast-playback.mp3"
  },
  "state": "Completed"
}

パラメーター

text
string必須maxLength: 4096音声を生成するテキストです。最大 4096 文字です。
voice
string必須デフォルト: alloyenum: alloy, echo, fable, onyx, nova, shimmer音声生成に使う voice です。デフォルトは alloy です。
response_format
string必須デフォルト: mp3enum: mp3, opus, wav, aac, flac音声の出力形式です。対応形式は mp3、opus、wav、aac、flac です。
speed
number必須デフォルト: 1minimum: 0.25maximum: 4生成音声の速度です。0.25〜4.0 から選びます。デフォルトは 1.0 です。
audio
string生成された音声ファイルの URL です

API スキーマ(Raw)

Input
Output

役に立ちましたか?