Fish Audio 텍스트→음성
텍스트를 음성으로 변환하는 엔드포인트를 사용하여 동일한 응답에서 결과를 받으세요.
개요
텍스트를 음성으로 변환하는 엔드포인트를 사용하고, 동일한 응답에서 결과를 읽으세요.
빠른 시작
- API 키를 만들고 RUNAPI_API_KEY로 설정합니다.
- 요청 스키마와 일치하는 본문으로 POST 요청을 전송하세요.
- 성공 응답 본문에서 결과를 읽습니다.
엔드포인트
- Base URL
https://runapi.ai- API 버전
v1- 인증
Authorization: Bearer YOUR_API_TOKEN
지원 모델
현재 가격, 속도 제한 및 상업적 이용 세부 정보는 모델 페이지를 여십시오.
요청 스키마
이 엔드포인트에 선언된 필드만 전송하세요.
s1필드 9개
bitrate_kbpsintegerMP3 비트레이트. WAV 출력에는 허용되지 않습니다.
허용 값:64, 128, 192
기본값: 128
modelstring모델 슬러그.
output_formatstring출력 오디오 형식.
허용 값:mp3, wav
기본값: mp3
referencesarray이 요청에 대한 인라인 참조 오디오 샘플.
references[].audiostringBase64로 인코딩된 원시 오디오 바이트.
references[].textstring참조 오디오의 정확한 트랜스크립트.
sample_rate_hzinteger출력 샘플 레이트. MP3는 32000 및 44100 Hz를 지원하며, WAV는 나열된 모든 값을 지원합니다.
허용 값:8000, 16000, 24000, 32000, 44100
기본값: 44100
textstringvoice_idstrings2-pro필드 9개
bitrate_kbpsintegerMP3 비트레이트. WAV 출력에는 허용되지 않습니다.
허용 값:64, 128, 192
기본값: 128
modelstring모델 슬러그.
output_formatstring출력 오디오 형식.
허용 값:mp3, wav
기본값: mp3
referencesarray이 요청에 대한 인라인 참조 오디오 샘플.
references[].audiostringBase64로 인코딩된 원시 오디오 바이트.
references[].textstring참조 오디오의 정확한 트랜스크립트.
sample_rate_hzinteger출력 샘플 레이트. MP3는 32000 및 44100 Hz를 지원하며, WAV는 나열된 모든 값을 지원합니다.
허용 값:8000, 16000, 24000, 32000, 44100
기본값: 44100
textstringvoice_idstrings2.1-pro필드 9개
bitrate_kbpsintegerMP3 비트레이트. WAV 출력에는 허용되지 않습니다.
허용 값:64, 128, 192
기본값: 128
modelstring모델 슬러그.
output_formatstring출력 오디오 형식.
허용 값:mp3, wav
기본값: mp3
referencesarray이 요청에 대한 인라인 참조 오디오 샘플.
references[].audiostringBase64로 인코딩된 원시 오디오 바이트.
references[].textstring참조 오디오의 정확한 트랜스크립트.
sample_rate_hzinteger출력 샘플 레이트. MP3는 32000 및 44100 Hz를 지원하며, WAV는 나열된 모든 값을 지원합니다.
허용 값:8000, 16000, 24000, 32000, 44100
기본값: 44100
textstringvoice_idstring조건부 규칙
이 요구 사항은 나열된 모든 조건이 일치할 때 적용됩니다.
-
다음의 경우
output_format = wav- 필수
- 허용되지 않음
bitrate_kbps
-
다음의 경우
output_format = mp3- 필수
- 허용되지 않음
-
다음의 경우
output_format = {"present" => false}- 필수
- 허용되지 않음
성공 응답
POST /api/v1/fish_audio/text_to_speech
응답 스키마
{
"properties": {
"audios": {
"items": {
"properties": {
"format": {
"type": "string"
},
"mime_type": {
"type": "string"
},
"size_bytes": {
"type": "integer"
},
"url": {
"type": "string",
"x-runapi-generated-media": true
}
},
"required": [
"url",
"format",
"mime_type",
"size_bytes"
],
"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
}
응답 예시
{
"audios": [
{
"format": "mp3",
"mime_type": "audio/mpeg",
"size_bytes": 128,
"url": "https://file.runapi.ai/reference-audio.mp3"
}
],
"billing": {
"refund": null,
"reservation": null,
"settlement": null
},
"id": "tsk_reference_demo",
"status": "completed"
}
오류
POST /api/v1/fish_audio/text_to_speech
응답 스키마
{
"properties": {
"error": {
"description": "사람이 읽을 수 있는 오류 메시지.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
응답 예시
{
"error": "Authentication required"
}
오류
POST /api/v1/fish_audio/text_to_speech
응답 스키마
{
"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
}
]
}
응답 예시
{
"error": "model must be one of: s1, s2-pro, s2.1-pro"
}
오류
POST /api/v1/fish_audio/text_to_speech
응답 스키마
{
"properties": {
"error": {
"description": "사람이 읽을 수 있는 오류 메시지.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
응답 예시
{
"error": "Insufficient balance"
}
오류
POST /api/v1/fish_audio/text_to_speech
응답 스키마
{
"properties": {
"error": {
"description": "사람이 읽을 수 있는 오류 메시지.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
응답 예시
{
"error": "API key credit limit exceeded"
}
오류
POST /api/v1/fish_audio/text_to_speech
응답 스키마
{
"properties": {
"error": {
"description": "사람이 읽을 수 있는 오류 메시지.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
응답 예시
{
"error": "The request uses features that are not supported for the selected model"
}
오류
POST /api/v1/fish_audio/text_to_speech
응답 스키마
{
"properties": {
"error": {
"description": "사람이 읽을 수 있는 오류 메시지.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
응답 예시
{
"error": "Rate limit reached. Please retry later."
}
오류
POST /api/v1/fish_audio/text_to_speech
응답 스키마
{
"properties": {
"error": {
"description": "사람이 읽을 수 있는 오류 메시지.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
응답 예시
{
"error": "Service under maintenance, please try again later"
}
오류
POST /api/v1/fish_audio/text_to_speech
응답 스키마
{
"properties": {
"error": {
"description": "사람이 읽을 수 있는 오류 메시지.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
응답 예시
{
"error": "The request timed out"
}
생성된 코드 샘플
cURL을 직접 사용하거나 해당 언어의 SDK를 설치하세요. 각 샘플은 이 레퍼런스에 표시된 유효성 검사된 요청을 제출합니다.
설치
pip install runapi-fish-audio
import os
from runapi.fish_audio import FishAudioClient
client = FishAudioClient(api_key=os.environ["RUNAPI_API_KEY"])
result = client.text_to_speech.run(
model="s1",
text="Welcome to RunAPI."
)