Skip to content

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 NameTypeRequiredDescriptionExample
Content-TypestringRequiredapplication/json
AuthorizationstringRequiredBearer $OPENAI_API_KEY

Body Parameters (application/json)

Parameter NameTypeRequiredDescription
modelstringRequiredThe model ID to use.
modalitiesarray[string]OptionalThe output types generated by the model. Default: ["text"]. To request the model to generate both text and audio responses, you can use: ["text", "audio"].
audioobjectOptional
  └ voicestringRequiredThe voice the model uses for responses. Supported voices are alloy, ash, ballad, coral, echo, fable, nova, onyx, sage, or shimmer.
  └ formatstringRequiredSpecifies the output audio format. Must be wav, mp3, flac, opus, or pcm16.
messagesarray[object]RequiredA list of messages that make up the current conversation.
  └ rolestringRequired
  └ contentstringRequired

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
{}