BazaarLinkBazaarLink
로그인
문서API 레퍼런스SDK 레퍼런스에이전트 사용법AI 스킬
목차

음성 합성(TTS) 안내

음성 합성(TTS) 안내

POST /v1/audio/speech는 OpenAI-compatible 형식입니다. JSON을 보내면 오디오 파일을 바이너리로 받습니다. ElevenLabs 계열에는 elevenlabs/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가 있습니다. 최신 목록은 GET /v1/models?output_modalities=speech에서 확인하세요. GET /v1/models는 기본적으로 텍스트 모델만 반환하므로 ?output_modalities=speech(또는 all)를 붙여 목록을 확인하세요.

POST/v1/audio/speech

매개변수

매개변수형식필수설명
modelstring예음성 모델 ID. 예: elevenlabs/eleven-flash-v2.5.
inputstring예합성할 텍스트: 요청당 최대 4,096자(elevenlabs/eleven-v4와 eleven-v4-turbo는 10,000자). 더 긴 텍스트는 여러 요청으로 나누세요.
voicestring예사용할 음성. 형식은 모델에 따라 다릅니다. 아래 음성 규칙을 확인하세요.
response_formatstring아니요mp3(기본) 또는 pcm. opus·aac·flac·wav는 API가 받지만 현재 ElevenLabs 모델이 400으로 거부합니다.
speednumber아니요말하기 속도 0.25~4.0. 모델에 따라 적용되지 않을 수 있습니다.
instructionsstring아니요음성 스타일 지시문. 모델에 따라 적용되지 않을 수 있습니다.
stabilitynumber아니요목소리 안정성(0–1, 기본 0.5). 낮을수록 표현이 풍부하고 높을수록 균일합니다. 요청이 당사의 직접 음성 경로로 처리되는 elevenlabs/* 모델에서 적용되며, 응답 헤더 X-Voice-Settings가 applied 또는 ignored를 알려 줍니다.
similarity_boostnumber아니요원래 목소리와의 유사도(0–1, 기본 0.75). Eleven v3에서는 사용되지 않습니다.
stylenumber아니요스타일 강조도(0–1, 기본 0). 0보다 크면 지연이 늘어납니다. Eleven v4에서는 사용되지 않습니다.
use_speaker_boostboolean아니요원래 화자와의 유사도를 높입니다(기본 true). 지연이 약간 늘어납니다.
clone_strengthnumber아니요클론 강도(0–1, 대부분 0 권장). Eleven v4용으로 학습한 본인의 전문 클론 음성(voice_…)에만 적용됩니다.
language_codestring아니요낭독 언어를 지정하는 두 글자 소문자 언어 코드(ISO 639-1, 예: ar, ja, en). multilingual-v2 모델에서는 사용되지 않습니다.
audio_effectsobject아니요선택적 오디오 효과 객체: filter_preset_id(필터, 예: phone, old_radio), environment_id(잔향 공간, 예: small_room, hall), background_noise_id(배경음, 예: cafe), distance(0–1), send_level(잔향량, 0–1), pan(−1…1). ID는 소문자, 숫자, 밑줄만 사용하며 추가 요금은 없습니다. 잔향 또는 0이 아닌 pan은 스테레오로 출력되어 pcm 출력과 함께 쓸 수 없습니다.

위의 음성 설정 7개는 모두 선택 사항이며, 보내지 않으면 아무것도 바뀌지 않습니다. 범위를 벗어난 값은 400을 반환하며 전송도 과금도 되지 않습니다. 응답 헤더 X-Voice-Settings는 설정이 사용되었는지 알려 줍니다: applied = 사용됨; ignored = 예비 경로가 응답하여 설정이 사용되지 않았습니다(오디오는 정상적으로 생성됩니다); 헤더 없음 = 음성 설정을 보내지 않았습니다. 예: stability 0은 더 표현력 있게, 1은 더 고르게 읽습니다.

음성 규칙

ElevenLabs 모델(elevenlabs/…)에는 다음 음성 이름(대소문자 무관) 중 하나를 넣으세요: george, sarah, adam, alice, bella, bill, brian, callum, charlie, chris, daniel, eric, harry, jessica, laura, liam, lily, matilda, river, roger, will. ElevenLabs 모델은 voice를 생략할 수 있습니다(기본 george). 그 외 값은 400 invalid_voice를 반환합니다. 내 사용자 지정 음성(voice_…)은 아래 ‘사용자 지정 음성’ 섹션을 참조하세요.

alloy, echo, nova 같은 OpenAI-style 음성 이름은 해당 이름을 나열한 모델에서만 작동합니다. 모델 페이지에서 지원 음성을 확인하세요.

사용자 지정 음성(복제)은 단계적으로 공개 중입니다. 아래 ‘사용자 지정 음성’ 섹션(POST /v1/voices)을 참조하세요. 계정에서 활성화되기 전에는 위의 21개 프리셋 이름이나 공개 음성 ID를 사용하세요.

ElevenLabs 모델에 alloy를 보내면 실패합니다
ElevenLabs 모델에 voice ID도 지원 이름도 아닌 값(예: alloy, Rachel)을 보내면 400 invalid_voice를 반환하며 메시지에 허용되는 이름이 나열됩니다. 실패한 요청은 과금되지 않습니다.

기본 제공 음성 목록

voice에는 아래 표의 음성 이름(소문자)을 지정할 수 있습니다. 각 음성에는 짧은 미리듣기 클립이 있으며, GET /api/v1/audio/voices로 전체 목록(성별, 연령대, 억양, 스타일, 미리듣기 URL)을 가져올 수 있습니다.

?lang=(en, zh-TW, zh-CN, 기본값은 Accept-Language)은 description의 언어만 정합니다. 미리듣기 URL은 바뀌지 않습니다: preview_urls.en(preview_url과 동일)은 영어, preview_urls.zh(preview_url_zh와 동일)는 중국어 클립입니다.

음성설명미리듣기
georgeMale, middle-aged, British accent. Mature and steady, suited to narration and storytelling.
sarahFemale, young adult, American accent. Professional and clear, suited to broadcast-style reading.
adamMale, middle-aged, American accent. Everyday and approachable, suited to short social videos.
aliceFemale, middle-aged, British accent. Professional and informative, suited to explainers and teaching.
bellaFemale, middle-aged, American accent. Professional and informative, suited to explainers and teaching.
billMale, senior, American accent. Crisp and direct, suited to advertising voice-overs.
brianMale, middle-aged, American accent. Polished and refined, suited to social and brand content.
callumMale, middle-aged, American accent. Expressive, suited to characters and animation.
charlieMale, young adult, Australian accent. Energetic and lively, suited to conversation.
chrisMale, middle-aged, American accent. Relaxed and casual, suited to conversation.
danielMale, middle-aged, British accent. Formal and measured, suited to news-style and educational reading.
ericMale, middle-aged, American accent. Polished and warm, suited to conversation.
harryMale, young adult, American accent. Rough and gritty, suited to character voices.
jessicaFemale, young adult, American accent. Bright and cute, suited to conversation.
lauraFemale, young adult, American accent. Playful with attitude, suited to social content.
liamMale, young adult, American accent. Confident and upbeat, suited to social content.
lilyFemale, middle-aged, British accent. Confident and clear, suited to explainers and teaching.
matildaFemale, middle-aged, American accent. Upbeat and friendly, suited to explainers and teaching.
riverNeutral voice, middle-aged, American accent. Calm and even, suited to conversation.
rogerMale, middle-aged, American accent. Polished and confident, suited to conversation.
willMale, young adult, American accent. Laid-back and easygoing, suited to conversation.

감정·동작 태그(audio tags)

input 안에 대괄호로 태그를 직접 적습니다. 예: [laughs], [whispers], [excited], [sighs], [crying], [curious], [softly]. 태그는 입력한 그대로 모델에 전달되어 뒤따르는 말의 연기 방식을 정합니다. 본문이 한국어여도 태그는 영어로 유지하세요.

curl https://api.bazaarlink.ai/v1/audio/speech \
  -H "Authorization: Bearer $BAZAARLINK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"elevenlabs/eleven-v3","input":"[laughs] That was actually funny. [whispers] Do not tell anyone.","voice":"george","response_format":"mp3"}' \
  --output audio-tags.mp3

elevenlabs/eleven-v3 와 elevenlabs/eleven-v4 계열이 지원합니다. 다른 음성 모델은 태그를 해석하지 않고 대괄호 안 글자를 그대로 읽을 수 있으니 먼저 짧은 문장으로 시험해 보세요.

태그도 input 글자 수에 포함되며 나머지 텍스트와 같은 방식으로 과금됩니다.

출력 형식

response_format을 생략하면 mp3(Content-Type audio/mpeg)가 기본입니다. pcm(audio/pcm, 원시 16-bit PCM)도 동작합니다. API는 opus, aac, flac, wav도 받지만 ElevenLabs 모델은 현재 400으로 거부합니다. 파일은 응답의 Content-Type 헤더에 따라 저장하세요.

요금

음성 합성은 입력 문자 수에 따라 청구됩니다. 문자당 가격은 /models의 모델 페이지와 GET /v1/models의 pricing.character에 있습니다. 모델 페이지에는 백만 문자 기준으로 표시됩니다.

예제

curl https://api.bazaarlink.ai/v1/audio/speech \
  -H "Authorization: Bearer $BAZAARLINK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"elevenlabs/eleven-flash-v2.5","input":"Hello from BazaarLink.","voice":"george","response_format":"mp3"}' \
  --output speech.mp3

흔한 오류

상태원인 및 해결 방법
400잘못된 요청: model, input 또는 voice 누락; input 4,096자 초과; speed가 0.25–4.0 범위 밖; 지원되지 않는 response_format; Unknown voice; unknown_model(/models에서 ID 확인).
401API 키가 없거나 유효하지 않습니다. BazaarLink 키를 Authorization: Bearer로 보내세요.
402잔액이 부족합니다. 충전 후 다시 시도하세요.
403관리 키로는 모델을 호출할 수 없거나 계정이 정지되었습니다. 일반 API 키를 사용하세요.
429요청 제한에 도달했습니다. Retry-After 헤더에 따라 기다린 뒤 다시 시도하세요.
502모델 서비스가 일시적으로 중단되었거나 오디오 전송이 끊겼습니다. 다시 시도하세요. 실패한 요청에는 요금이 부과되지 않습니다.

전체 매개변수 참조: 음성 합성

음성 합성

/v1/models?output_modalities=speech의 모델 ID로 텍스트를 음성으로 변환합니다. 모델 페이지의 백만 문자당 가격으로 청구합니다. 전체 오디오를 버퍼링한 뒤 바이너리로 반환하며, 구간별 스트리밍은 지원하지 않습니다. provider, transforms, route, service_tier, preset 같은 라우팅 제어 필드는 무시됩니다.

POST/v1/audio/speech
curl https://api.bazaarlink.ai/v1/audio/speech \
  -H "$BAZAARLINK_AUTH_HEADER" \
  -H "Content-Type: application/json" \
  -d '{"model":"<speech-model-id>","input":"Hello","voice":"alloy","response_format":"mp3"}' \
  --output speech.mp3

# Voice settings (elevenlabs/* models; the X-Voice-Settings response header says applied or ignored)
curl -D - https://api.bazaarlink.ai/v1/audio/speech \
  -H "$BAZAARLINK_AUTH_HEADER" \
  -H "Content-Type: application/json" \
  -d '{"model":"elevenlabs/eleven-v4","input":"Hello","voice":"george","stability":0.4,"similarity_boost":0.8,"style":0.2,"use_speaker_boost":true,"language_code":"en","audio_effects":{"distance":0.3}}' \
  --output speech.mp3
POST/v1/chat/completions

/v1/chat/completions에 audio 또는 input_audio와 오디오 지원 모델을 사용합니다. 보고된 텍스트와 오디오 토큰 총량에 설정된 입력 및 출력 단가를 동일하게 적용합니다.

curl https://api.bazaarlink.ai/v1/chat/completions \
  -H "$BAZAARLINK_AUTH_HEADER" \
  -H "Content-Type: application/json" \
  -d '{"model":"<audio-chat-model-id>","messages":[{"role":"user","content":"Say hi."}],"stream":true,"modalities":["text","audio"],"audio":{"voice":"alloy","format":"pcm16"},"max_tokens":32}'
Support
Hi! How can we help you?
Send a message and we'll get back to you soon.
음성 합성(TTS) 안내 | BazaarLink