Voice Chat SDKs
Add AI voice chat to your game or app. Record, send, hear back - one API call.
Download
Unity
Microphone recording, WAV encoding, UnityWebRequest upload, and AudioClip playback.
Godot
AudioEffectRecord capture, manual multipart upload, and AudioStreamWAV playback.
Unreal Engine
AudioCapture, WAV encoding, FHttpModule multipart upload, and SoundWave playback.
Next.js / React
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:
On the server, your audio goes through three Groq-powered steps:
All three steps use your existing Groq API key. No additional keys or services needed.
API Reference
Send audio, receive AI audio response. Requires a paid plan.
Request Headers
| Header | Value | |
|---|---|---|
X-Api-Key |
Your API key (sk_...) |
REQUIRED |
Content-Type |
multipart/form-data |
REQUIRED |
Request Body (Form Data)
| Field | Type | Description |
|---|---|---|
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)
| Header | Description |
|---|---|
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
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.
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);
// 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.
# 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))
# 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.
// 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);
// 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.
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>
);
}
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.