Streaming Speech-to-Text
curl --request GET \
--url wss://api.assemblyai.com/v2/realtime/wsimport requests
url = "wss://api.assemblyai.com/v2/realtime/ws"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('wss://api.assemblyai.com/v2/realtime/ws', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "wss://api.assemblyai.com/v2/realtime/ws",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "wss://api.assemblyai.com/v2/realtime/ws"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("wss://api.assemblyai.com/v2/realtime/ws")
.asString();require 'uri'
require 'net/http'
url = URI("wss://api.assemblyai.com/v2/realtime/ws")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_bodyUklGRtjIAABXQVZFZ
{
"audio_start": 0,
"audio_end": 1500,
"confidence": 0.987190506414702,
"text": "there is a house in new orleans",
"words": [
{
"start": 0,
"end": 300,
"confidence": 1,
"text": "there"
}
],
"created": "2023-05-24T08:09:10Z",
"message_type": "PartialTranscript"
}
{
"audio_start": 0,
"audio_end": 1500,
"confidence": 0.987190506414702,
"text": "there is a house in new orleans",
"words": [
{
"start": 0,
"end": 300,
"confidence": 1,
"text": "there"
}
],
"created": "2023-05-24T08:09:10Z",
"message_type": "FinalTranscript",
"punctuated": true,
"text_formatted": true
}
{
"terminate_session": true
}
streaming
Streaming Speech-to-Text
GET
/
v2
/
realtime
/
ws
Streaming Speech-to-Text
curl --request GET \
--url wss://api.assemblyai.com/v2/realtime/wsimport requests
url = "wss://api.assemblyai.com/v2/realtime/ws"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('wss://api.assemblyai.com/v2/realtime/ws', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "wss://api.assemblyai.com/v2/realtime/ws",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "wss://api.assemblyai.com/v2/realtime/ws"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("wss://api.assemblyai.com/v2/realtime/ws")
.asString();require 'uri'
require 'net/http'
url = URI("wss://api.assemblyai.com/v2/realtime/ws")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_bodyUklGRtjIAABXQVZFZ
{
"audio_start": 0,
"audio_end": 1500,
"confidence": 0.987190506414702,
"text": "there is a house in new orleans",
"words": [
{
"start": 0,
"end": 300,
"confidence": 1,
"text": "there"
}
],
"created": "2023-05-24T08:09:10Z",
"message_type": "PartialTranscript"
}
{
"audio_start": 0,
"audio_end": 1500,
"confidence": 0.987190506414702,
"text": "there is a house in new orleans",
"words": [
{
"start": 0,
"end": 300,
"confidence": 1,
"text": "there"
}
],
"created": "2023-05-24T08:09:10Z",
"message_type": "FinalTranscript",
"punctuated": true,
"text_formatted": true
}
{
"terminate_session": true
}
string
Authentication string for the request.
integer
required
The sample rate of the streamed audio.
string
Add up to 2500 characters of custom vocabulary. The parameter value must be a JSON encoded array of strings. The JSON must be URL encoded like other query string parameters.
enum
default:"pcm_s16le"
The encoding of the audio data.
Allowed values:pcm_s16le
pcm_mulaw
string
Authenticate using a generated temporary token.
boolean
default:"false"
Set to true to not receive partial transcripts.
boolean
default:"false"
Set to true to receive the SessionInformation message before the session ends.
UklGRtjIAABXQVZFZ
{
"audio_start": 0,
"audio_end": 1500,
"confidence": 0.987190506414702,
"text": "there is a house in new orleans",
"words": [
{
"start": 0,
"end": 300,
"confidence": 1,
"text": "there"
}
],
"created": "2023-05-24T08:09:10Z",
"message_type": "PartialTranscript"
}
{
"audio_start": 0,
"audio_end": 1500,
"confidence": 0.987190506414702,
"text": "there is a house in new orleans",
"words": [
{
"start": 0,
"end": 300,
"confidence": 1,
"text": "there"
}
],
"created": "2023-05-24T08:09:10Z",
"message_type": "FinalTranscript",
"punctuated": true,
"text_formatted": true
}
{
"terminate_session": true
}
⌘I