- Get started
- Introduction
- Authentication
- Making requests
- Streaming
- Audio
- Batch
- Models
- Invites
- Chat
- Users
- Projects
- Project users
- Project service accounts
- Project API keys
- Audit logs
- Usage
- Project rate limits
- Completions
- Uploads
- Embeddings
- Files
- Moderations
- Assistants (v1)
- Threads (v1)
- Messages (v1)
- Runs (v1)
- Images
- Fine-tuning
Create speech
POST
https://api.openai.com/v1/audio/speech
Request
Authorization
Provide your bearer token in the
Authorization
header when making requests to protected resources.Example:
Authorization: Bearer ********************
Header Params
Authorization
stringÂ
required
Example:
Bearer $OPENAI_API_KEY
Content-Type
stringÂ
required
Example:
application/json
Body Params application/json
model
stringÂ
required
tts-1
or tts-1-hd
input
stringÂ
required
voice
stringÂ
required
alloy
, echo
, fable
, onyx
, nova
, and shimmer
. Previews of the voices are available in the Text to speech guide.Example
{
"model": "tts-1",
"input": "The quick brown fox jumped over the lazy dog.",
"voice": "alloy"
}
Request samples
Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://api.openai.com/v1/audio/speech' \
--header 'Authorization: Bearer $OPENAI_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "tts-1",
"input": "The quick brown fox jumped over the lazy dog.",
"voice": "alloy"
}'
Responses
🟢200Success
application/json
Body
object {0}
Example
{}
Modified at 2024-12-13 10:20:37