Theme
GPT-4o-audio
POST
https://www.kkiai.com/v1/chat/completions
Official documentation: https://platform.openai.com/docs/api-reference/chat/create
Request Parameters
Authorization
Add the Authorization parameter to the Header. Its value is the Token concatenated after Bearer.
Example: Authorization: Bearer YOUR_API_KEY
Header Parameters
| Parameter Name | Type | Required | Description | Example |
|---|---|---|---|---|
Content-Type | string | Required | application/json | |
Authorization | string | Required | Bearer $OPENAI_API_KEY |
Body Parameters (application/json)
| Parameter Name | Type | Required | Description |
|---|---|---|---|
model | string | Required | The model ID to use. |
modalities | array[string] | Optional | The output types generated by the model. Default: ["text"]. To request the model to generate both text and audio responses, you can use: ["text", "audio"]. |
audio | object | Optional | |
└ voice | string | Required | The voice the model uses for responses. Supported voices are alloy, ash, ballad, coral, echo, fable, nova, onyx, sage, or shimmer. |
└ format | string | Required | Specifies the output audio format. Must be wav, mp3, flac, opus, or pcm16. |
messages | array[object] | Required | A list of messages that make up the current conversation. |
└ role | string | Required | |
└ content | string | Required |
Request Example
json
{
"model": "gpt-4o-audio-preview",
"modalities": ["text", "audio"],
"audio": { "voice": "alloy", "format": "wav" },
"messages": [
{
"role": "user",
"content": "Is a golden retriever a good family dog?"
}
]
}cURL Example
bash
curl --location --request POST 'https://www.kkiai.com/v1/chat/completions' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "gpt-4o-audio-preview",
"modalities": ["text", "audio"],
"audio": { "voice": "alloy", "format": "wav" },
"messages": [
{
"role": "user",
"content": "Is a golden retriever a good family dog?"
}
]
}'Response
🟢 200 Success
Response Example
json
{}