메인 콘텐츠로 건너뛰기
POST
/
v1
/
audio
/
speech
Python (OpenAI SDK)
from openai import OpenAI

client = OpenAI(
    api_key="<COMETAPI_KEY>",
    base_url="https://api.cometapi.com/v1"
)

response = client.audio.speech.create(
    model="tts-1",
    voice="alloy",
    input="The quick brown fox jumped over the lazy dog."
)

response.stream_to_file("output.mp3")
"<string>"

인증

Authorization
string
header
필수

Bearer token authentication. Use your CometAPI key.

본문

application/json
model
string
기본값:tts-1
필수

The TTS model to use. Choose a current speech model from the Models page.

input
string
필수

The text to generate audio for. Maximum length is 4096 characters.

Maximum string length: 4096
voice
enum<string>
기본값:alloy
필수

The voice to use for speech synthesis.

사용 가능한 옵션:
alloy,
ash,
ballad,
coral,
echo,
fable,
onyx,
nova,
sage,
shimmer
response_format
enum<string>
기본값:mp3

The audio output format.

사용 가능한 옵션:
mp3,
opus,
aac,
flac,
wav,
pcm
speed
number
기본값:1

The speed of the generated audio. Select a value between 0.25 and 4.0.

필수 범위: 0.25 <= x <= 4

응답

200 - audio/mpeg

The audio file content.

The response is of type file.