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

client = OpenAI(
    api_key=os.environ["COMETAPI_KEY"],
    base_url="https://api.cometapi.com/v1"
)

audio_file = open("audio.mp3", "rb")
translation = client.audio.translations.create(
    model="whisper-1",
    file=audio_file
)
print(translation.text)
{
  "text": "Hello, welcome to CometAPI."
}
이 엔드포인트를 사용하여 음성 오디오를 영어 텍스트로 번역합니다. 다른 언어의 오디오에서 하나의 영어 전사본이 필요한 다국어 지원 큐, 미디어 검토, 워크플로에 적합합니다.

첫 요청

지원되는 오디오 파일과 model, file을 전송합니다. 먼저 짧은 샘플을 사용하면 업로드 처리, 언어 감지, 출력 파싱을 확인할 수 있습니다.

응답 읽기

기본 응답에는 번역된 영어 text가 포함됩니다. 다른 응답 형식을 요청한 경우 해당 형식에 따라 응답을 파싱하세요.

다음 단계

  • 원본 언어의 텍스트가 필요할 때는 Create Transcription을 사용하세요.
  • 텍스트에서 오디오를 생성해야 할 때는 Create Speech을 사용하세요.

인증

Authorization
string
header
필수

Bearer token authentication. Use your CometAPI key.

본문

multipart/form-data
file
file
필수

The audio file to translate. Supported formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, webm.

model
string
기본값:whisper-1
필수

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

prompt
string

Optional text to guide the model's style or continue a previous audio segment. The prompt should be in English.

response_format
enum<string>
기본값:json

The output format for the translation.

사용 가능한 옵션:
json,
text,
srt,
verbose_json,
vtt
temperature
number
기본값:0

Sampling temperature between 0 and 1. Higher values produce more random output; lower values are more focused. When set to 0, the model auto-adjusts temperature using log probability.

필수 범위: 0 <= x <= 1

응답

200 - application/json

The translation result in English.

text
string
필수

The translated text in English.