همه صفحه‌ها

صدا (TTS و STT)

دو اندپوینت صدا: POST /v1/audio/speech متن را به گفتار تبدیل می‌کند (خروجی MP3 یا PCM بسته به مدل) و POST /v1/audio/transcriptions گفتار را به متن برمی‌گرداند. هم با آپلود multipart و هم با JSON و صدای base64. هر دو با SDK‌های OpenAI سازگارند.

POST/v1/audio/speechاحراز هویت Bearer

Text-to-speech (TTS)

Convert text to spoken audio. Drop-in compatible with the OpenAI SDK's client.audio.speech.create(...). Billed per character of input, per second of generated audio, or both, as each model's page states; the charge settles when the audio has been sent.

Every text-to-speech model in GET /v1/models (api_shape speech) works here and on POST /v1/predictions. Voices are model-specific: each model's input_fields lists its own. response_format is mp3 or pcm (24 kHz mono); when omitted the audio is PCM, so send mp3 to get an MP3 file.

بدنه درخواستالزامی

فیلدنوعتوضیح
modelالزامیstring

نمونه: x-ai/grok-voice-tts-1.0

inputالزامیstring

نمونه: Hello world

voiceالزامیstring

نمونه: eve

response_formatstring

پیش‌فرض: pcm

مقادیر مجاز: mp3 · pcm

نمونه

پاسخ‌ها

200

Audio bytestream.

POST/v1/audio/transcriptionsاحراز هویت Bearer

Speech-to-text (STT)

Transcribe audio to text. Drop-in compatible with the OpenAI SDK's client.audio.transcriptions.create(...) (multipart file upload). You may also send the JSON shape ({model, input_audio:{data:<base64>, format}}) directly. Models: every speech-to-text model in GET /v1/models (api_shape: transcriptions), e.g. openai/whisper-1, openai/gpt-4o-transcribe, elevenlabs/scribe-v2, microsoft/mai-transcribe-2. OpenAI's bare ids (whisper-1) work too. An unknown model is 404 MODEL_NOT_FOUND.

Price. Per minute of audio, or per token on the token-priced models (gpt-4o-transcribe, gpt-4o-mini-transcribe, gemini-3.5-transcribe); the rate is on each model's page. We measure the audio's length before reserving credit, so the reserve matches the recording; you are charged the reported usage.cost.

Inline audio only. Send the file (multipart file) or base64 input_audio.data; pcm is raw 16-bit mono at 16 kHz. A URL (input_audio.url) is refused here: send it to POST /v1/predictions (input.audio), which also suits long recordings. Audio whose length cannot be read is 400.

Some models cap audio duration: google/chirp-3 accepts at most 60 seconds per request and answers anything longer with 400 AUDIO_DURATION_LIMIT, before anything is reserved. Split long recordings, or use openai/whisper-large-v3 / openai/gpt-4o-transcribe, which take multi-minute audio in one call.

diarize: true (with response_format: verbose_json) labels speakers on the models that support it (ElevenLabs Scribe); others answer 400. For Persian on Deepgram Nova-3, set language: "fa".

بدنه درخواستmultipart/form-dataالزامی

فیلدنوعتوضیح
fileالزامیstring (binary)
modelالزامیstring

نمونه: openai/gpt-4o-mini-transcribe

response_formatstring
languagestring

بدنه درخواستapplication/jsonالزامی

فیلدنوعتوضیح
modelالزامیstring

نمونه: openai/gpt-4o-mini-transcribe

input_audioالزامیobject
dataالزامیstring

base64-encoded audio

formatالزامیstring

مقادیر مجاز: mp3 · wav · ogg · flac · webm · m4a · pcm

languagestring

ISO-639-1, e.g. fa; detected when omitted

response_formatstring

مقادیر مجاز: json · verbose_json

diarizeboolean

label speakers (verbose_json, supported models)

نمونه

پاسخ‌ها

200

Transcription result.

به‌روزرسانی: 2026-10-13