APIMaster.ai

APIMaster の ElevenLabs API

`Authorization: Bearer` ヘッダーで APIMaster の API キーを送信します。エンドポイントは `/v1/elevenlabs` 配下です。パラメーターのリンクは ElevenLabs の公式資料を参照します。

Authorization: Bearer ヘッダーで APIMaster の API キーを送信します。エンドポイントは /v1/elevenlabs 配下です。パラメーターのリンクは ElevenLabs の公式資料を参照します。

ローカルファイルをアップロードしてください。リモート URL と文字起こし Webhook は利用できません。音声デザインには 100 文字以上の試聴テキストが必要です。音楽と効果音では長さを指定します。APIMaster の WebSocket が上流認証を管理します。音声を確定したら response.create を送信し、response.done を待ちます。

モデルとエンドポイント

機能 モデル ID 公式エンドポイント 主要なパラメーター
音声合成と対話 eleven_v4, eleven_v4_turbo, eleven_v3, eleven_v3_conversational, eleven_multilingual_v2, eleven_flash_v2_5, eleven_flash_v2, eleven_turbo_v2_5, eleven_turbo_v2 POST /v1/elevenlabs/text-to-speech/{voice_id} · POST /v1/elevenlabs/text-to-dialogue text · model_id · voice_settings · language_code · output_format · inputs[].voice_id · inputs[].text
ファイル文字起こし scribe_v3, scribe_v2, scribe_v2_medical POST /v1/elevenlabs/speech-to-text model_id · file · language_code · diarize · timestamps_granularity · keyterms · transcript_edit
リアルタイム文字起こし scribe_v3_live, scribe_v2_realtime WSS /v1/elevenlabs/speech-to-text/realtime model_id · audio_format · commit_strategy · audio_base_64 · commit
声質変換 eleven_multilingual_sts_v2, eleven_english_sts_v2 POST /v1/elevenlabs/voice-changer/{voice_id} audio · model_id · remove_background_noise · voice_settings · output_format
音声デザイン eleven_ttv_v3, eleven_multilingual_ttv_v2 POST /v1/elevenlabs/text-to-voice/design model_id · voice_description · text · guidance_scale · seed
効果音 eleven_text_to_sound_v3, eleven_text_to_sound_v2 POST /v1/elevenlabs/sound-generation model_id · text · duration_seconds · loop · prompt_influence
音楽 music_v2_5, music_v2, music_v1 POST /v1/elevenlabs/music model_id · prompt · composition_plan · music_length_ms · force_instrumental
リアルタイム会話 eleven_realtime_v1_mini, eleven_realtime_v1_max WSS /v1/elevenlabs/realtime model · input_audio_buffer.append · response.create
吹き替え dubbing_v2, dubbing_v1 POST /v1/elevenlabs/dubbing/project model_id · file · source_language · target_language · project_id

パラメーターとレスポンス

  • voice_id で声、model_id でモデル、language_code で言語を選択します。voice_settings で表現を調整します。対話の場合、inputs の各要素にテキストと声を指定します。
  • 音声は file でアップロードします。diarize は話者を区別し、timestamps_granularity は時間情報の粒度を指定します。リアルタイムでは PCM を Base64 にして分割送信し、commit の後に committed_transcript を待ちます。
  • 声質変換では voice_id で変換先を指定します。音声デザインは試聴音声を 3 件返します。text は 100 文字以上にします。
  • 効果音の duration_seconds は 0.5–30 秒です。音楽には prompt または composition_plan を指定します。prompt と併用する music_length_ms は長さを設定し、force_instrumental は歌声を省きます。
  • 吹き替えでは project_id でプロジェクトと対象言語の状態を確認し、完了後 outputs.lossless_audio から取得します。

使用例

curl https://apimaster.ai/v1/elevenlabs/text-to-speech/JBFqnCBsd6RMkjVDRZzb \
  -H "Authorization: Bearer $APIMASTER_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"model_id":"eleven_v4","text":"Hello from ElevenLabs."}' \
  --output speech.mp3

curl https://apimaster.ai/v1/elevenlabs/speech-to-text \
  -H "Authorization: Bearer $APIMASTER_API_KEY" \
  -F 'model_id=scribe_v3' -F 'file=@speech.mp3' \
  -F 'diarize=true' -F 'timestamps_granularity=word'

curl https://apimaster.ai/v1/elevenlabs/music \
  -H "Authorization: Bearer $APIMASTER_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"model_id":"music_v2_5","prompt":"Soft piano jingle","music_length_ms":3000,"force_instrumental":true}' \
  --output jingle.mp3

curl https://apimaster.ai/v1/elevenlabs/dubbing/project \
  -H "Authorization: Bearer $APIMASTER_API_KEY" \
  -F 'model_id=dubbing_v2' -F 'file=@speech.mp3' \
  -F 'source_language=en' -F 'target_language=es'

curl "https://apimaster.ai/v1/elevenlabs/dubbing/project/$PROJECT_ID" \
  -H "Authorization: Bearer $APIMASTER_API_KEY"

curl "https://apimaster.ai/v1/elevenlabs/dubbing/project/$PROJECT_ID/language/$LANGUAGE_ID" \
  -H "Authorization: Bearer $APIMASTER_API_KEY"

リクエスト形式と制限

音声合成、対話、音声デザイン、効果音、音楽は 4 MiB 以下の application/json で送信します。output_format はクエリ文字列に指定します。複数話者の対話には eleven_v4 または eleven_v3 を使用します。合成、対話、声質変換、音楽、音声分離のパス末尾に /stream を付けると、応答を逐次受信できます。

アップロードは multipart/form-data でファイルを一つ送ります。声質変換と音声分離は audio、文字起こし、アライメント、音源分離、吹き替えは file を使用します。16 kHz 16 ビットのリトルエンディアンのモノラル PCM には file_format=pcm_s16le_16 を指定します。

音楽の長さは 3,000〜600,000 ミリ秒です。prompt を使用する場合は music_length_ms を指定します。composition_plan を使用する場合は、各セグメントの duration_ms を固定します。

リアルタイム対話の例

websocket-client をインストールし、APIMASTER_API_KEY を設定します。session.created の受信後に入力を送信します。音声は response.audio.delta または response.output_audio.delta で届きます。response.done でターンの状態と使用量を確認できます。

import json
import os
from urllib.parse import urlsplit, urlunsplit

from websocket import create_connection

base = urlsplit("https://apimaster.ai/v1")
url = urlunsplit(("wss", base.netloc, base.path.rstrip("/") + "/elevenlabs/realtime",
                  "model=eleven_realtime_v1_mini", ""))
socket = create_connection(
    url, header={"Authorization": "Bearer " + os.environ["APIMASTER_API_KEY"]},
    timeout=30,
)
try:
    assert json.loads(socket.recv())["type"] == "session.created"
    socket.send(json.dumps({
        "type": "conversation.item.create",
        "item": {"type": "message", "role": "user",
                 "content": [{"type": "input_text", "text": "Say hello."}]},
    }))
    socket.send(json.dumps({"type": "response.create"}))
    while True:
        event = json.loads(socket.recv())
        if event["type"] == "error":
            raise RuntimeError(event["error"])
        if event["type"] == "response.done":
            print(event["response"]["status"], event["response"].get("usage"))
            break
finally:
    socket.close()

独立した音声処理 API

料金と互換性

音声合成は文字数で計測し、ほかの音声機能は各機能の時間単位に従います。リアルタイム会話は接続時間とトークン数を計測します。音声デザインでは 3 件の試聴に対しテキスト分を 1 回課金します。公式の廃止予定は music_v1 が 2027-01-31、eleven_text_to_sound_v2 が 2027-03-01 です。

公式料金