Voice Chat SDKs

Add AI voice chat to your game or app. Record, send, hear back - one API call.

Download

Unity

C# MonoBehaviour
Drop-in component with Microphone recording, WAV encoding, UnityWebRequest upload, and AudioClip playback.

Godot

GDScript Node
AutoLoad-ready script with AudioEffectRecord capture, manual multipart upload, and AudioStreamWAV playback.

Unreal Engine

C++ Actor Component
Blueprint-friendly component with AudioCapture, WAV encoding, FHttpModule multipart upload, and SoundWave playback.

Next.js / React

TypeScript Hook + Component
useSparkVoiceChat hook + drop-in <SparkVoiceChat> component with Web Audio API recording and streaming playback.

How It Works

Every SDK follows the same flow. One HTTP call, three AI steps happen server-side:

1
Record audio
2
POST to API
3
Play response

On the server, your audio goes through three Groq-powered steps:

S
Whisper STT
C
Chat AI
T
Orpheus TTS

All three steps use your existing Groq API key. No additional keys or services needed.

API Reference

POST /api/voice-chat

Send audio, receive AI audio response. Requires a paid plan.

Request Headers

HeaderValue
X-Api-Key Your API key (sk_...) REQUIRED
Content-Type multipart/form-data REQUIRED

Request Body (Form Data)

FieldTypeDescription
audio File WAV audio file, max 10MB REQUIRED
sessionId String Conversation session ID (for multi-turn context)
userEmail String User identifier (for per-user rate limits)

Response (200 OK)

HeaderDescription
Content-Type audio/wav - raw WAV audio bytes in body
X-Transcript URL-encoded transcript of what the user said
X-AI-Response URL-encoded text of the AI response

cURL Example

Shell
curl -X POST https://sparkbrain.app/api/voice-chat \
  -H "X-Api-Key: sk_your_key" \
  -F "audio=@recording.wav" \
  -F "sessionId=my-session" \
  --output response.wav

Unity

Add SparkVoiceChat.cs to any GameObject.

C# - Setup
var voice = gameObject.AddComponent<SparkVoiceChat>();
voice.apiKey = "sk_your_key";
voice.endpoint = "https://sparkbrain.app/api/voice-chat";

voice.OnTranscriptReceived += (t) => Debug.Log("You said: " + t);
voice.OnResponseReceived += (r) => Debug.Log("AI said: " + r);
voice.OnError += (e) => Debug.LogError(e);
C# - Usage
// Start recording (call on button press)
voice.StartRecording();

// Stop and send to AI (call on button release)
voice.StopRecordingAndSend();
// Audio response plays automatically

Events: OnTranscriptReceived, OnResponseReceived, OnAudioPlayed, OnError

Godot

Add spark_voice_chat.gd as an AutoLoad or attach to a Node.

GDScript - Setup
# Project Settings > Audio > Driver > Enable Input = true
# Add audio bus "Record" with AudioEffectRecord

var voice = $SparkVoiceChat
voice.api_key = "sk_your_key"
voice.endpoint = "https://sparkbrain.app/api/voice-chat"

voice.transcript_received.connect(func(t): print("You: ", t))
voice.response_received.connect(func(r): print("AI: ", r))
voice.error.connect(func(e): push_error(e))
GDScript - Usage
# Start recording
voice.start_recording()

# Stop and send to AI
voice.stop_and_send()
# Audio plays automatically via AudioStreamPlayer child

Signals: transcript_received, response_received, audio_played, error

Unreal Engine

Add the SparkVoiceChat component to any Actor. Enable the AudioCapture plugin.

C++ - Setup
// In your Actor's header
UPROPERTY(VisibleAnywhere)
USparkVoiceChat* VoiceChat;

// In BeginPlay()
VoiceChat = NewObject<USparkVoiceChat>(this);
VoiceChat->ApiKey = TEXT("sk_your_key");
VoiceChat->Endpoint = TEXT("https://sparkbrain.app/api/voice-chat");
VoiceChat->RegisterComponent();

VoiceChat->OnTranscriptReceived.AddDynamic(this, &AMyActor::HandleTranscript);
VoiceChat->OnResponseReceived.AddDynamic(this, &AMyActor::HandleResponse);
C++ - Usage
// Start recording
VoiceChat->StartRecording();

// Stop and send to AI
VoiceChat->StopRecordingAndSend();
// Audio plays automatically via PlaySound2D

All properties are Blueprint-exposed. You can set ApiKey and Endpoint in the Details panel.

Next.js / React

Use the useSparkVoiceChat hook or the drop-in <SparkVoiceChat> component.

TypeScript - Hook
import { useSparkVoiceChat } from './SparkVoiceChat';

function VoiceChat() {
  const { startRecording, stopAndSend, isRecording, isProcessing,
          transcript, aiResponse, error } = useSparkVoiceChat({
    apiKey: 'sk_your_key',
    endpoint: 'https://sparkbrain.app/api/voice-chat',
  });

  return (
    <button onClick={isRecording ? stopAndSend : startRecording}
            disabled={isProcessing}>
      {isProcessing ? 'Thinking...' : isRecording ? 'Stop' : 'Speak'}
    </button>
  );
}
TypeScript - Component
import { SparkVoiceChat } from './SparkVoiceChat';

// Drop-in with built-in UI
<SparkVoiceChat
  apiKey="sk_your_key"
  endpoint="https://sparkbrain.app/api/voice-chat"
/>

The hook gives full control. The component provides a ready-made button with transcript display.