Audio

Create speech

POST/v1/audio/speech

Generates audio from the input text. Returns audio data or streams via SSE.

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

curl -X POST "http://localhost:8080/v1/audio/speech" \  -H "Content-Type: application/json" \  -d '{    "model": "string",    "input": "string",    "voice": "string"  }'
{
  "audio": "string",
  "usage": {
    "input_tokens": 0,
    "output_tokens": 0,
    "total_tokens": 0
  },
  "alignment": {
    "char_start_times_ms": [
      0
    ],
    "char_end_times_ms": [
      0
    ],
    "characters": [
      "string"
    ]
  },
  "normalized_alignment": {
    "char_start_times_ms": [
      0
    ],
    "char_end_times_ms": [
      0
    ],
    "characters": [
      "string"
    ]
  },
  "audio_base64": "string",
  "extra_fields": {
    "request_type": "string",
    "provider": "openai",
    "model_requested": "string",
    "model_deployment": "string",
    "latency": 0,
    "chunk_index": 0,
    "raw_request": {},
    "raw_response": {},
    "cache_debug": {
      "cache_hit": true,
      "cache_id": "string",
      "hit_type": "string",
      "requested_provider": "string",
      "requested_model": "string",
      "provider_used": "string",
      "model_used": "string",
      "input_tokens": 0,
      "threshold": 0,
      "similarity": 0
    }
  }
}
{
  "event_id": "string",
  "type": "string",
  "is_bifrost_error": true,
  "status_code": 0,
  "error": {
    "type": "string",
    "code": "string",
    "message": "string",
    "param": "string",
    "event_id": "string"
  },
  "extra_fields": {
    "provider": "openai",
    "model_requested": "string",
    "request_type": "string"
  }
}
{
  "event_id": "string",
  "type": "string",
  "is_bifrost_error": true,
  "status_code": 0,
  "error": {
    "type": "string",
    "code": "string",
    "message": "string",
    "param": "string",
    "event_id": "string"
  },
  "extra_fields": {
    "provider": "openai",
    "model_requested": "string",
    "request_type": "string"
  }
}