Python SDK
import assemblyai as aai
aai.settings.api_key = "<YOUR_API_KEY>"
with aai.DictationTranscriber() as transcriber:
# Call as soon as you know audio is coming (e.g. the user reaches for record).
transcriber.warm()
# Same transcriber -> reuses the warmed connection; no handshake here.
result = transcriber.transcribe_live("clip.wav")
print(result.final_text)
import { AssemblyAI } from "assemblyai";
const client = new AssemblyAI({ apiKey: "<YOUR_API_KEY>" });
// Call as soon as you know audio is coming (e.g. the user reaches for record).
await client.dictation.warm();
// Same client -> reuses the warmed connection; no handshake here.
const result = await client.dictation.transcribeLive("./clip.wav");
console.log(result.final_text);
# curl opens a fresh connection per process, so chain both
# requests in one invocation with --next to share the connection:
curl https://dictation.assemblyai.com/warm \
--next \
-X POST https://dictation.assemblyai.com/v1/transcribe/live \
-H 'Authorization: <YOUR_API_KEY>' \
-F 'audio=@clip.wav;type=audio/wav'
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://dictation.assemblyai.com/warm",
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 := "https://dictation.assemblyai.com/warm"
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("https://dictation.assemblyai.com/warm")
.asString();require 'uri'
require 'net/http'
url = URI("https://dictation.assemblyai.com/warm")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"warm": "toasty"
}API reference
Pre-warm a connection
GET
/
warm
Python SDK
import assemblyai as aai
aai.settings.api_key = "<YOUR_API_KEY>"
with aai.DictationTranscriber() as transcriber:
# Call as soon as you know audio is coming (e.g. the user reaches for record).
transcriber.warm()
# Same transcriber -> reuses the warmed connection; no handshake here.
result = transcriber.transcribe_live("clip.wav")
print(result.final_text)
import { AssemblyAI } from "assemblyai";
const client = new AssemblyAI({ apiKey: "<YOUR_API_KEY>" });
// Call as soon as you know audio is coming (e.g. the user reaches for record).
await client.dictation.warm();
// Same client -> reuses the warmed connection; no handshake here.
const result = await client.dictation.transcribeLive("./clip.wav");
console.log(result.final_text);
# curl opens a fresh connection per process, so chain both
# requests in one invocation with --next to share the connection:
curl https://dictation.assemblyai.com/warm \
--next \
-X POST https://dictation.assemblyai.com/v1/transcribe/live \
-H 'Authorization: <YOUR_API_KEY>' \
-F 'audio=@clip.wav;type=audio/wav'
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://dictation.assemblyai.com/warm",
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 := "https://dictation.assemblyai.com/warm"
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("https://dictation.assemblyai.com/warm")
.asString();require 'uri'
require 'net/http'
url = URI("https://dictation.assemblyai.com/warm")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"warm": "toasty"
}Was this page helpful?