add-voice
Skill này làm gì
Cho phép agent thêm cuộc trò chuyện bằng giọng nói trực tiếp vào một ứng dụng sẵn có, với micro gửi giọng nói đi và âm thanh trả lời quay lại. Dành cho lập trình viên xây dựng trợ lý giọng nói.
Khi nào nên dùng
- ✓Khi bạn muốn người dùng trò chuyện với AI bằng giọng nói theo thời gian thực.
- ✓Khi ứng dụng của bạn nối các bước chuyển giọng nói thành văn bản, mô hình ngôn ngữ và chuyển văn bản thành giọng nói riêng lẻ có thể gộp thành một vòng giọng nói.
- ✓Khi bạn muốn có nút chế độ giọng nói trong ứng dụng với xác thực an toàn.
Liên kết skill
https://github.com/cursor/plugins/blob/main/grok-voice/skills/add-voice/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Hãy thêm chế độ giọng nói vào ứng dụng để người dùng có thể nói chuyện với trợ lý và nghe nó trả lời theo thời gian thực.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent lập bản đồ ứng dụng của bạn, thiết lập truy cập an toàn qua máy chủ hoặc một token tạm thời, rồi kết nối micro với một kết nối giọng nói thời gian thực gửi âm thanh vào và ra.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Add Voice
Add Grok Speech to Speech to an existing app. Run on /add-voice, typed Voice Mode, or clear “add Grok voice” intent.
Goal
Working duplex path: user-app mic in, audio out, wss://api.x.ai/v1/realtime?model=grok-voice-latest, safe auth. Cursor has no native mic; wire the app (or a sample client), not the IDE.
Protocol first
Language-agnostic event loop. TypeScript samples default. Short Python twins only where the client API differs (e.g. ws vs websockets).
Docs
- https://docs.x.ai/developers/model-capabilities/audio/speech-to-speech
- https://docs.x.ai/developers/model-capabilities/audio/ephemeral-tokens
- Pricing (cite docs only): https://docs.x.ai/developers/pricing (~$0.08/min STS + $0.004/text item; max session 120 min)
Steps
Map the app
- Stack: none, OpenAI Realtime, STT→LLM→TTS cascade, TTS/STT only.
- Client: web / Node / iOS / Android / server.
- If a cascade or OpenAI Realtime exists: replace it with the single duplex loop below (URL, model, voice, event diffs); keep standalone
/v1/sttor/v1/ttsonly if the product still needs one-shot listen or speak outside the agent.
Auth
- Server: Bearer
XAI_API_KEY. - Browser/mobile: backend
POST https://api.x.ai/v1/realtime/client_secrets, client uses ephemeral token (Bearer or browsersec-websocket-protocol:xai-client-secret.<token>). - Never put a long-lived key in client bundles. Do not paste keys in chat.
- Server: Bearer
Connect + session
- URL:
wss://api.x.ai/v1/realtime?model=grok-voice-latest - On open:
session.updatewithvoice(defaulteve),instructions,turn_detection: { type: "server_vad" }(ornullfor push-to-talk), PCM 24 kHz unless the app already standardizes elsewhere. - Set
audio.input.transcription.model: "grok-transcribe"or no user transcript arrives (conversation.item.input_audio_transcription.updatedis cumulative, not a delta). - Tools if needed:
web_search,x_search,file_search,mcp, customfunction.
- URL:
Audio I/O (app-side)
- One
AudioContextper session for capture and playback, created inside the user gesture (autoplay policy). Ask for 24 kHz; if the browser gives another rate, resample before sending. - Mic → AudioWorklet in ~100 ms chunks →
input_audio_buffer.append(or binary transport). Start WS and mic in parallel; buffer early audio, flush on open. - Play
response.output_audio.deltaimmediately; schedule with a ~150 ms lead so chunks butt together. Oninput_audio_buffer.speech_started, stop everything queued (barge-in). - Transcript rows: create the user row on
input_audio_buffer.committed(item_id), fill it on…transcription.updated; assistant text fromresponse.output_audio_transcript.delta/.done, close the turn onresponse.done. - On function tools:
function_call_output, finish playback, thenresponse.create.
- One
Composer UI convention
- One primary button, right side of the composer. Empty composer → waveform icon (stroked, e.g. Phosphor
WaveformIcon weight="bold"; never thefillweight, which renders as a blob at 16 px), starts voice mode. Any text present → classic send arrow; in voice mode that text goes into the live session (conversation.item.create+response.create). Text reply streaming → stop square. - While voice is live the same button shows an animated waveform (4 bars, ~3 px wide, 2 px gap, ~16 px tall, min scale 0.4 so they stay legible in a 28 px button) and ends the session on click. Phase drives the animation: listening slow, speaking fast, connecting/thinking slower and slightly dimmed (opacity ≥ 0.75). Honor
prefers-reduced-motion. No X button, no pulsing ring. - Status lives in the composer, not around it: the placeholder reads
Connecting…/Listening…/Thinking…/Speaking…, plus ansr-onlyrole="status". No separate status row. - The microphone icon is reserved for dictation (
/add-dictation). Never use it for voice mode.
- One primary button, right side of the composer. Empty composer → waveform icon (stroked, e.g. Phosphor
TS skeleton (default)
const url = "wss://api.x.ai/v1/realtime?model=grok-voice-latest";
// Node: pass Authorization header. Browser: use xai-client-secret.<token> protocol.
const ws = new WebSocket(url /* , { headers: { Authorization: `Bearer ${token}` } } */);
ws.addEventListener("open", () => {
ws.send(JSON.stringify({
type: "session.update",
session: {
voice: "eve",
instructions: "You are a helpful voice agent.",
Câu hỏi thường gặp
Khóa API có được giữ an toàn không?
Có. Ứng dụng web và di động dùng token tạm thời từ backend của bạn, không dùng khóa chính.
Nó có thay thế một thiết lập cũ không?
Nếu ứng dụng của bạn dùng chuỗi riêng gồm chuyển giọng nói thành văn bản, mô hình ngôn ngữ và chuyển văn bản thành giọng nói, skill có thể thay bằng một vòng giọng nói duy nhất.
Micro được xử lý ở đâu?
Trong ứng dụng của bạn, vì bản thân công cụ lập trình không có micro.
Chi tiết
Mô tả gốc của tác giả
Use when the user runs /add-voice, types Voice Mode, or asks to add Grok realtime voice to an app, including replacing an STT-LLM-TTS cascade or OpenAI Realtime. Wire speech-to-speech, safe auth, and app mic. Composer: waveform button, mic icon reserved for dictation. For mic-to-text only use /add-dictation; to speak text replies use /add-read-aloud. To add debug logging and fix from logs use /debug-voice.
repo: cursor/plugins
Độ phổ biến
- Sao GitHub
- 15k
- Vị trí xếp hạng
- #10952
- Giấy phép
- —
- Cập nhật
- 31/10/2026
Bình luận
- …
Thêm skill từ kho mã này
advisor
15kCho agent hỏi ý kiến một mô hình thứ hai mạnh hơn tại các điểm then chốt, như trước quyết định lớn hoặc khi bị kẹt ở lỗi, nếu bạn bật nó.
check-agent-compatibility
15kKiểm tra xem coding agent AI có khởi động, xác minh và ghi tài liệu được cho một repository không, rồi trả về một điểm tương thích và vấn đề chính.
cli-for-agents
15kDạy agent thiết kế hoặc rà soát công cụ dòng lệnh để các coding agent AI chạy được mà không cần lời nhắc, với trợ giúp rõ ràng và ví dụ.
continual-learning
15kGiữ các ghi chú AGENTS.md của bạn cập nhật bằng cách giao việc rà soát các cuộc trò chuyện trước cho một trình cập nhật bộ nhớ chuyên dụng.
Skill tương tự
add-model-provider
394kGiúp agent của bạn kết nối nhà cung cấp mô hình AI mới với OpenClaw bằng lệnh an toàn, giữ API key khỏi văn bản thuần và chạy thử.
acp-router
394kGiúp agent của bạn gửi một tác vụ đến trợ lý lập trình như Claude Code hoặc Cursor qua OpenClaw, để công việc chạy ngay trong công cụ đó.
browser-automation
394kHướng dẫn agent của bạn điều khiển trang web từng bước, gồm đăng nhập, tab và cách khôi phục khi trang ngừng phản hồi.