Documentation Index
Fetch the complete documentation index at: https://api-docs.wisprflow.ai/llms.txt
Use this file to discover all available pages before exploring further.
This is useful for REST API calls for both API-key and client-side auth.
How to Use
To optimize latency and ensure smooth dictation sessions using Flow API, you should warm up the API connection as follows:
Call the Warmup Endpoint at Session Start
As soon as the user starts a dictation, send a request to the warmup endpoint. This prepares the connection for low latency operation by eliminating potential “cold start” delays.
Maintain Connection with Keep-Alive
Use connection keep-alive settings to maintain a persistent connection for the duration of your session. A recommended keep-alive timeout is 60 seconds. When the keep-alive period ends, send another warmup request to refresh the connection.
How It Works
-
SSL/TLS Handshake: Completes the initial SSL handshake
-
TCP Connection Establishment: Creates and maintains a persistent TCP connection
-
Server Resource Initialization: Ensures server-side resources are loaded and ready
-
Connection Pool Preparation: Prepares connection pools for subsequent requests
Code Examples
Python Example
import requests
# Create a session to reuse the connection
session = requests.Session()
# First, warm up the connection
session.get("https://platform-api.wisprflow.ai/api/v1/dash/warmup_dash")
# Now use the warmed connection for the API call
def transcribe_audio(api_key, audio_base64):
response = session.post(
"https://api.flowvoice.ai/api/v1/dash/api",
headers={
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
},
json={
"audio": audio_base64,
"properties": {}
}
)
return response.json()
# Example usage
api_key = "your_api_key"
audio_base64 = "UklGRiQA..." # Your base64 encoded audio
result = transcribe_audio(api_key, audio_base64)
print(f"Transcription: {result['text']}")
JavaScript/TypeScript Example
async function warmupConnection(): Promise<boolean> {
try {
const response = await fetch('https://platform-api.wisprflow.ai/api/v1/dash/warmup_dash');
return response.ok;
} catch (error) {
console.error('Warmup failed:', error);
return false;
}
}
// Import Axios and HTTPS
import axios from 'axios';
import https from 'https';
// Create an Axios client with keep-alive
const client = axios.create({
baseURL: 'https://api.flowvoice.ai',
httpsAgent: new https.Agent({
keepAlive: true,
keepAliveMsecs: 60000, // 60 seconds
maxSockets: 10
})
});
// Function to transcribe audio using the API
async function transcribeAudio(apiKey: string, audioBase64: string): Promise<any> {
try {
const response = await client.post('/api/v1/dash/api', {
audio: audioBase64,
properties: {}
}, {
headers: {
'Authorization': `Bearer ${apiKey}`,
'Content-Type': 'application/json'
}
});
return response.data;
} catch (error) {
console.error('API call failed:', error);
throw error;
}
}
// Example usage
(async () => {
const apiKey = 'your_api_key';
const audioBase64 = 'UklGRiQA...'; // Your base64 encoded audio
// Warm up the connection
const isWarmedUp = await warmupConnection();
if (isWarmedUp) {
console.log('Connection warmed up successfully.');
} else {
console.log('Failed to warm up the connection.');
}
// Call the API
try {
const result = await transcribeAudio(apiKey, audioBase64);
console.log(`Transcription: ${result.text}`);
} catch (error) {
console.error('Failed to transcribe audio:', error);
}
})();
Request
No request body needed.
Response