API reference

Text to speech

POST/v1/audio/speech

Synthesizes speech and returns model-specific audio bytes on success. The selected model determines the default format. When file archival is enabled, response headers such as X-Gloop-File-Id/X-Gloop-Storage-Status describe the saving stage. Do not treat audio as JSON.

Authentication and permissions

Use your current GloopAPI key. Available models, capabilities and permissions depend on its catalog and the endpoint documentation.

Authorization: Bearer $GLOOP_API_KEY

Authentication schemes: BearerAuth

Request

Request body · application/json

Type
object
Required fields
modelinputvoice

Request body required

  • modelstringRequired
  • inputstringRequired

    Text to synthesize; length limits depend on the selected model. There is no universal 4096-character limit.

  • voicestringRequired

    Specific support and limits depend on the selected model; no uniform defaults are guaranteed.

  • response_formatstringOptional

    Requested audio output format; supported values and the format used when omitted depend on the selected model. The platform's general endpoint does not assign mp3 as a default.

  • speednumberOptional

    Specific support and limits depend on the selected model; no uniform defaults are guaranteed.

  • instructionsstringOptional

    Model-specific speech instructions.

  • stream_formatstringOptional

    Model-specific streaming format; SSE support is not guaranteed for every model.

Responses and errors

HTTP 200

Audio generated successfully

audio/mpeg

Type
string
Format
binary
Description
Audio byte stream; save as a file.
{
  "type": "string",
  "format": "binary",
  "description": "音频字节流,保存为文件。"
}

audio/wav

Type
string
Format
binary
Description
Audio byte stream; save as a file.
{
  "type": "string",
  "format": "binary",
  "description": "音频字节流,保存为文件。"
}

audio/ogg

Type
string
Format
binary
Description
Audio byte stream; save as a file.
{
  "type": "string",
  "format": "binary",
  "description": "音频字节流,保存为文件。"
}

audio/flac

Type
string
Format
binary
Description
Audio byte stream; save as a file.
{
  "type": "string",
  "format": "binary",
  "description": "音频字节流,保存为文件。"
}

audio/aac

Type
string
Format
binary
Description
Audio byte stream; save as a file.
{
  "type": "string",
  "format": "binary",
  "description": "音频字节流,保存为文件。"
}

application/octet-stream

Type
string
Format
binary
Description
Audio byte stream; save as a file.
{
  "type": "string",
  "format": "binary",
  "description": "音频字节流,保存为文件。"
}

HTTP 401

The key is missing, invalid, expired, or revoked.

application/json

Type
object
Required fields
error

HTTP 403

Insufficient IP, account, model, or tool permissions.

application/json

Type
object
Required fields
error

HTTP 429

Request/queue rate limit.

application/json

Type
object
Required fields
error

HTTP 500

Internal authentication or data storage failure.

application/json

Type
object
Required fields
error