Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.deepslate.eu/llms.txt

Use this file to discover all available pages before exploring further.

This API is not yet available and is still under construction.
WebRTC is best for web applications, mobile apps, and end-user facing interfaces with ultra-low latency and built-in NAT traversal.

Session Flow

Step 1: Create Session

Request a WebRTC session from the API:
const response = await fetch('https://app.deepslate.eu/api/v1/sessions', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    assistant_id: 'asst_xxx',
    protocol: 'webrtc'
  })
});

const { session_id, sdp_offer } = await response.json();

Step 2: Establish Connection

const pc = new RTCPeerConnection();

// Add local audio track
const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
stream.getTracks().forEach(track => pc.addTrack(track, stream));

// Handle remote audio
pc.ontrack = (event) => {
  const audio = new Audio();
  audio.srcObject = event.streams[0];
  audio.play();
};

// Set remote offer and create answer
await pc.setRemoteDescription({ type: 'offer', sdp: sdp_offer });
const answer = await pc.createAnswer();
await pc.setLocalDescription(answer);

// Send answer to server
await fetch(`https://app.deepslate.eu/api/v1/sessions/${session_id}/answer`, {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({ sdp: answer.sdp })
});

Audio Configuration

WebRTC uses Opus codec at 48kHz by default. Deepslate automatically handles sample rate conversion.
FormatSample RateChannelsNotes
Opus48000 HzMonoBrowser default
Opus16000 HzMonoMobile optimized

Error Handling

CodeDescriptionResolution
auth_failedInvalid or expired API keyCheck your API key
rate_limitedToo many concurrent sessionsReduce connection rate
invalid_configInvalid assistant/agent IDVerify resource exists
CodeDescriptionResolution
ice_failedICE connection failedCheck network/firewall settings
session_timeoutSession idle too longReconnect
internal_errorServer-side errorRetry with backoff

Browser Compatibility

BrowserSupport
ChromeFull support
FirefoxFull support
SafariFull support (iOS 14.3+)
EdgeFull support