Deepgram's suite of AI-powered APIs empowers developers and businesses to gain insights from audio and video data. Their cutting-edge speech recognition and language processing models enable a variety of tasks, including:
- Speech-to-Text Transcription: Convert audio and video into high-accuracy text transcripts.
- Object Detection: Identify and locate objects within video frames.
- Text Analysis (Beta): Analyze textual content for sentiment and other characteristics. (Paid Plans)
Authentication:
Deepgram utilizes API keys for authentication. You can obtain your free API key by creating an account on the Deepgram platform.
Here's a breakdown of some key Deepgram API endpoints along with JavaScript example code snippets for each:
1. Speech-to-Text Transcription (Transcribe)
- This endpoint transcribes audio or video data into text.
- Type: POST
- JavaScript Example:
const apiKey = 'YOUR_API_KEY';
const url = 'https://api.deepgram.com/v2/models/normal/outputs';
const data = {
inputs: [
{
data: {
url: 'https://www.example.com/audio.mp3', // Replace with your audio/video URL
},
},
],
};
const headers = {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'application/json',
};
fetch(url, { method: 'POST', headers, body: JSON.stringify(data) })
.then((response) => response.json())
.then((data) => {
console.log('Speech Transcript:', data.outputs[0].transcript);
})
.catch((error) => console.error(error));
2. Object Detection (Detect) (Paid Plans)
- This endpoint identifies and locates objects within video frames, returning bounding boxes and confidence scores.
- Type: POST
- JavaScript Example: (Note: Not possible with free API key)
const apiKey = 'YOUR_API_KEY';
const url =
'https://api.deepgram.com/v2/models/aaa7a2c7-33ba-4a1f-b62d-89e09e8e45c6/outputs';
const data = {
inputs: [
{
data: {
url: 'https://www.example.com/video.mp4', // Replace with your video URL
},
},
],
};
const headers = {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'application/json',
};
fetch(url, { method: 'POST', headers, body: JSON.stringify(data) })
.then((response) => response.json())
.then((data) => {
console.log('Detected Objects:', data.outputs[0].data.regions);
})
.catch((error) => console.error(error));
3. Text Analysis (Analyze) (Beta - Paid Plans)
- This endpoint analyzes text data for sentiment and other characteristics. (Beta Feature)
- Type: POST
- JavaScript Example: (Note: Not possible with free API key and Beta functionality)
const apiKey = 'YOUR_API_KEY';
const url = 'https://api.deepgram.com/v2/text/analyze';
const data = {
text: 'This is a positive sentiment sentence.',
};
const headers = {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'application/json',
};
fetch(url, { method: 'POST', headers, body: JSON.stringify(data) })
.then((response) => response.json())
.then((data) => {
console.log('Text Analysis Results:', data);
})
.catch((error) => console.error(error));
Explore More with Deepgram
Deepgram offers a free tier with limited usage, along with paid plans that unlock additional features and functionalities. Explore their comprehensive documentation to delve deeper into each API endpoint, advanced functionalities, and pricing options. Leverage Deepgram's AI-powered tools to unlock insights from your audio and video data and empower your applications.