AI Speech Text API (1.0.0)

Download OpenAPI specification:Download

Text to Speech

Synchronized

Authorizations:
bearerAuth
Request Body schema: application/json
input
string

input text

speed
number [ 0.8 .. 1.2 ]

larger is faster,

speaker_id
integer
Enum: 0 1 2 3

0: SouthWomen 1: NorthemWomen 2: SouthMen 3: NorthemMen

encode_type
integer
Enum: 0 1

0: wav 1: mp3

Responses

Request samples

Content type
application/json
{
  • "input": "đầu vào",
  • "speed": 1,
  • "speaker_id": 1,
  • "encode_type": 0
}

Response samples

Content type
audio/mpeg
UklGRv4AAABXQVZFZm10IBAAAAABAAEAgD4AAAB9AAACABAAZGF0YQAAAAA=

Speech to Text

Synchronized

Authorizations:
bearerAuth
Request Body schema: multipart/form-data
encoding_type
string
Enum: "wav" "mp3"
audio_file
string <binary>

Responses

Request samples

const request = require('request');
var fs = require('fs');
const options = {
  method: 'POST',
  url: 'https://ai-speech-text.api.vngcloud.vn/speech-api/api/v1/speechtotext/sync',
  headers: {
    'content-type': 'multipart/form-data',
    Authorization: 'Bearer REPLACE_BEARER_TOKEN'
  },
  formData: {
    'encoding_type': 'wav',
    'audio_file': {
      'value': fs.createReadStream('REPLACE_FILE_LOCATION'),
      'options': {
        'filename': 'audio.wav',
        'contentType': null
      }
    }
  }
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

Response samples

Content type
application/json
{
  • "id": "stt-9a90bcfe-0e1e-41ba-b574-ae735e44dd07",
  • "audio_file": "tts-cce199f7-94ac-45cc-94bb-b37f32342902.wav",
  • "encode_type": "wav",
  • "billed_duration": 1,
  • "transcript": "Đầu vào"
}