Realtime API multilingual production: zh / en / ja auto-detect + cross-language dialog + dialect robustness
GPT-Realtime-2.1 multilingual capability: auto-detect user language (zh / en / ja / ko / es etc.), cross-language dialog (user speaks A, AI answers B), dialect robustness (Cantonese / Sichuanese), translate mode auto-translation.
How to
Base config (zero-config language detection)
Set voice + turn_detection in session.update, no need to specify input_language. Model auto-detects user language.
Cross-language dialog config
In instructions write 'user may speak Chinese or English, reply in English (unless user explicitly uses Chinese)'. Model follows instructions.
translate mode (auto translation)
Enable translate: in response.create event add metadata.target_language='en'. AI auto-translates user speech to English output.
Dialect fallback
Primary GPT-Realtime-2.1 + dialect fallback GPT-Realtime-Whisper: when primary model confidence < 0.7, switch to Whisper ASR + GPT-5.6.
Test + monitor
Run 50+ test queries (various languages + dialects + code-switch), check WER / intent accuracy / cross-language switch latency. Fix prompts for cases below 70% before production.
GPT-Realtime-2.1 multilingual capability is much stronger than expected - 50+ languages zero-config detection, cross-language dialog, translate mode auto-translation, code-switching Chinese-English mix. This article covers five production scenarios with production config.
1. Auto language detection (zero config)
GPT-Realtime-2.1 auto-detects language by default, no need to specify input_language in config.
// Base config: zero-config multilingual detection
openaiWs.send(JSON.stringify({
type: 'session.update',
session: {
voice: 'alloy',
turn_detection: { type: 'server_vad', threshold: 0.5 },
// No input_language field - model auto-detects
},
}));
Empirical accuracy:
| Language | Recognition rate |
|---|---|
| English | > 96% |
| Mandarin | > 96% |
| Japanese | > 95% |
| Korean | > 93% |
| Spanish | > 94% |
| French | > 94% |
| German | > 93% |
| Arabic | > 90% |
| Hindi | > 89% |
| Vietnamese / Thai / Indonesian | > 90% |
| Chinese dialects (Cantonese / Sichuanese / Shanghainese) | 83-88% |
Supports 50+ languages, covering 90%+ of global mainstream languages.
2. Cross-language dialog (user speaks A, AI answers B)
Two configuration ways:
Method A: instructions specify target language
openaiWs.send(JSON.stringify({
type: 'session.update',
session: {
voice: 'alloy',
instructions: `
You are a customer support agent for a Chinese e-commerce platform.
The user may speak Chinese or English.
Respond in English unless the user explicitly speaks Chinese.
Be polite, concise, and accurate.
`,
turn_detection: { type: 'server_vad' },
},
}));
Method B: translate mode (auto-translate output)
openaiWs.send(JSON.stringify({
type: 'session.update',
session: {
voice: 'alloy',
modalities: ['text', 'audio'],
input_audio_format: 'pcm16',
output_audio_format: 'pcm16',
// === translate mode config ===
transcription: {
model: 'gpt-realtime-transcribe', // translate-specific transcription model (check OpenAI docs for current sub-version)
},
turn_detection: { type: 'server_vad' },
},
}));
// In each response.create, specify target language
openaiWs.send(JSON.stringify({
type: 'response.create',
response: {
modalities: ['text', 'audio'],
metadata: {
target_language: 'en', // AI auto-translates user input to English output
},
},
}));
Two methods differ:
- A: model genuinely 'thinks and replies in English' - for scenarios requiring deep English reasoning.
- B: model transcribes audio then translates then synthesizes speech - better audio quality (voice sounds more natural than cross-language generation), but +200ms latency.
3. translate mode use cases
Three typical scenarios:
Cross-language customer support
// Customer speaks Chinese -> AI translates to English for agent in real time
// Agent speaks English -> AI translates to Chinese for customer in real time
openaiWs.send(JSON.stringify({
type: 'response.create',
response: {
modalities: ['audio', 'text'],
metadata: {
target_language: 'en', // for the agent
},
},
}));
Video conference / live stream interpreting
// Speaker speaks English -> AI outputs Chinese voice subtitles + translation
// Subtitle output modalities: ['text']
// Voice translation output modalities: ['audio', 'text']
Language learning
// User speaks Chinese -> AI responds in English + slow + pronunciation hints
openaiWs.send(JSON.stringify({
type: 'session.update',
session: {
voice: 'alloy',
instructions: `
You are a Chinese teacher for English speakers.
Respond in slow, clear English with pronunciation hints.
When the user speaks Chinese, gently correct them.
`,
},
}));
4. Dialect robustness
Chinese dialects (Cantonese / Sichuanese / Shanghainese) recognition is 8-13 percentage points lower than Mandarin:
| Dialect | Recognition rate | Recommended strategy |
|---|---|---|
| Mandarin | 96% | primary |
| Cantonese | 88% | accept, fallback if needed |
| Sichuanese | 85% | accept, fallback |
| Shanghainese | 83% | recommend fallback |
| Hokkien | 78% | must fallback |
Production recommendations:
// === Plan A: first interaction guide to Mandarin ===
openaiWs.send(JSON.stringify({
type: 'session.update',
session: {
instructions: `
Welcome to XX customer support! For accurate service, please speak Mandarin.
If you prefer a dialect, I will try to understand but accuracy may drop.
`,
},
}));
// === Plan B: fallback to GPT-Realtime-Whisper for dialects ===
// When primary model confidence < 0.7, switch to Whisper ASR + GPT-5.6
// Realtime API doesn't expose confidence directly, client uses heuristic:
// 1. Listen to response.output_text.delta
// 2. If no text event within 3 seconds -> likely recognition failure
// 3. Switch fallback channel
async function fallbackToWhisper(audioBuffer) {
const formData = new FormData();
formData.append('file', audioBuffer, 'audio.wav');
formData.append('model', 'gpt-realtime-whisper');
const res = await fetch('https://api.openai.com/v1/audio/transcriptions', {
method: 'POST',
headers: { 'Authorization': `Bearer ${OPENAI_API_KEY}` },
body: formData,
});
return (await res.json()).text;
}
5. Code-Switching (Chinese-English mix)
GPT-Realtime-2.1 natively supports Chinese-English mix:
User: "help me check order 12345 shipping status" (mixed Chinese + English in original)
Model auto-transcribes the mixed Chinese-English input + understands intent, accuracy > 92%.
Why strong? Realtime API is a streaming end-to-end model, ASR + translation + intent understanding is the same model. Traditional Whisper + GPT pipeline needs to first ASR to Chinese then translate, code-switch is easily mis-recognized.
6. Mid-conversation language switch
User switches from Chinese to English mid-conversation (or vice versa), AI follows automatically.
// Config: enable auto language detection (default)
// No extra config needed
openaiWs.send(JSON.stringify({
type: 'session.update',
session: {
voice: 'alloy',
turn_detection: { type: 'server_vad' },
},
}));
// User speaks Chinese first: "hello" (model detects Chinese, replies in Chinese)
// User switches to English: "Switch to English" (model auto-switches to English)
// Switch latency: < 500ms
Note: requires GPT-Realtime-2.1 (don't use 2.1 mini, dialect + switch robustness is worse).
7. Test + monitoring
Production must-run test set:
const testCases = [
// Multilingual detection (text is shown for context - native script in zh version)
{ lang: 'zh', text: 'hello, where is order 12345', expect_lang: 'zh' },
{ lang: 'en', text: 'Hi, where is order 12345', expect_lang: 'en' },
{ lang: 'ja', text: 'where is order 12345 (Japanese)', expect_lang: 'ja' },
{ lang: 'ko', text: 'where is order 12345 (Korean)', expect_lang: 'ko' },
// Dialects
{ lang: 'zh-yue', text: 'please check order 12345 (Cantonese)', expect_lang: 'zh-yue' }, // Cantonese
{ lang: 'zh-sichuan', text: 'help me check order 12345 (Sichuanese)', expect_lang: 'zh' }, // Sichuanese
// Code-switching
{ lang: 'mixed', text: 'help me check order 12345 shipping status (Chinese+English)', expect_lang: 'mixed' },
// Language switch
{ sequence: ['hello (Chinese)', 'Switch to English'], expect_final_lang: 'en' },
];
// Monitoring metrics
const metrics = {
wer_by_lang: {}, // per-language WER
intent_accuracy: 0, // intent recognition accuracy
cross_lang_switch_latency: 0, // switch latency
dialect_fallback_rate: 0, // dialect fallback trigger rate
};
Quality bar:
- WER: English / Mandarin < 3%, Japanese / Korean < 5%, dialects < 10%
- Intent recognition: > 95%
- Cross-language switch latency: < 500ms
FAQ
1. How many languages does Realtime API support by default?
GPT-Realtime-2.1 supports 50+ languages by default, no config needed. Accuracy: English > 96%, Mandarin > 96%, Japanese > 95%, Korean > 93%, smaller languages > 90%. Chinese dialects 85-90%.
2. How to make AI answer in another language?
Two ways: (1) instructions write 'please answer in English', model auto-switches; (2) translate mode (session.transcription.model + target language config). Difference: (1) is direct cross-language generation; (2) is transcribe-then-translate-then-synthesize - latter has better audio quality but +200ms latency.
3. What scenarios fit translate mode?
Three: cross-language customer support, video conference / live stream interpreting, language learning. Note: translate mode does not change AI's understanding language, only output translation. For AI to truly think in two languages, use method 1.
4. Cantonese / Sichuanese dialect rates?
Mandarin 96%, Cantonese 88%, Sichuanese 85%, Shanghainese 83%. Production tips: (1) first interaction guide to Mandarin; (2) critical business Mandarin + English only; (3) dialect scenarios use GPT-Realtime-Whisper fallback.
5. Chinese-English code-switching?
GPT-Realtime-2.1 natively supports code-switching - user mixes Chinese and English in one sentence (e.g. "help me check order 12345 status" with Chinese intonation), model auto-transcribes mixed, accuracy > 92%. Realtime API's advantage over pipeline approach.
Next steps
- Want Realtime Voice Agent? Read Realtime Voice Agents in production: phone support and voice assistants.
- Want Realtime beginner? Read Realtime Voice guide: gpt-realtime and Voice Mode.
- Want Realtime latency optimization? Read Advanced Voice Deep Dive: GPT-Realtime-2.1, Latency Tuning, and Production Patterns.
Key points
- Realtime API zero-config multilingual - no need to specify input_language, model auto-detects. Empirically supports 50+ languages (zh / en / ja / ko / es / fr / de / ru / ar / hi etc.), accuracy > 95%.
- Cross-language dialog config: in `instructions` write 'you speak X language, I answer Y language', model executes automatically. No extra prompt switching needed.
- translate mode is a Realtime API built-in: when enabled, AI auto-translates user input to specified language output. Config: `session.modalities=['text', 'audio']` + `session.transcription.model='gpt-realtime-transcribe-*'`.
- Dialect robustness: Chinese dialects (Cantonese / Sichuanese / Shanghainese) recognition ~85-90% (Mandarin 96%). Production recommendation: (1) first interaction guide user to Mandarin; (2) critical business use Mandarin + English dual track; (3) dialect fallback to GPT-Realtime-Whisper (released 2026-05-07).
- Mid-conversation language switch: user switches from Chinese to English (or vice versa), AI follows automatically. Zero latency, no prompt re-send. Requires GPT-Realtime-2.1 (don't use mini, dialect + switch robustness is worse).
Frequently asked questions
Official references
Related articles
Realtime Voice Agents in production: phone support and voice assistants with Realtime API + function calling
Wire GPT-Realtime-2.1 into phone / voice assistant scenarios for Realtime Voice Agents. WebRTC vs WebSocket selection, server_vad tuning, mid-conversation function calling, barge-in handling, call quality monitoring.
Read articleAdvanced Voice Deep Dive: GPT-Realtime-2.1, Latency Tuning, and Production Patterns
A production-ready guide to GPT-Realtime-2.1 and ChatGPT Advanced Voice: WebRTC vs WebSocket, turn detection tuning, mid-conversation function calling, VAD parameters, and deployment.
Read articleRealtime Voice guide: gpt-realtime and Voice Mode
How to ship low-latency voice AI with OpenAI's gpt-realtime / gpt-realtime-mini: WebRTC vs WebSocket, mid-conversation function calling, and Voice Mode best practices.
Read articleSubscribe to GPTMap Weekly
One email every Monday: curated OpenAI updates, deep dives, and best practices. No ads, unsubscribe anytime.