openai-realtime
БесплатноБез исполняемых скриптовНе проверенBuild voice agents with the OpenAI Realtime API, a speech-to-speech interface that takes audio in and streams spoken answers back over WebRTC, WebSocket or…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
OpenAI Realtime API — Voice-Native AI Conversations
Overview
The Realtime API is OpenAI's speech-to-speech interface: the model hears audio directly, keeps conversation state, calls tools and answers in audio, with barge-in and low first-audio latency. Current models are gpt-realtime-2.1 (reasoning, tool use) and the cheaper gpt-realtime-2.1-mini. Transports: WebRTC (browsers, mobile), WebSocket (servers) and SIP (phone calls).
The beta interface is gone. OpenAI removed the Realtime beta on 2026-05-12 and shut down the gpt-4o-realtime-preview models on 2026-05-07. The OpenAI-Beta: realtime=v1 header, modalities, flat voice / input_audio_format fields and response.audio.* events belong to that beta and no longer work. The older gpt-realtime and gpt-realtime-mini families are scheduled for removal on 2027-01-20, so start new work on gpt-realtime-2.1.
OpenAI also offers GPT-Live (wss://api.openai.com/v1/live/sessions) for full-duplex conversations with a delegated backend. It is a separate API with its own events (session.start, session.input_audio.append); this skill covers the Realtime API only.
Instructions
Choose the transport
- Browser or mobile: WebRTC. Your server holds the API key and either proxies the SDP offer to
POST /v1/realtime/calls(unified interface) or mints an ephemeral key withPOST /v1/realtime/client_secrets. WebRTC handles media, playback buffering and truncation for you. - Server to server: WebSocket at
wss://api.openai.com/v1/realtime?model=gpt-realtime-2.1withAuthorization: Bearer $OPENAI_API_KEY. You send base64 PCM yourself and manage playback. - Phone: SIP trunk to
sip:[email protected];transport=tls(EU:sip-eu.api.openai.com).
If your app knows the end user, send a stable hashed ID in the OpenAI-Safety-Identifier header on the server-side request that creates the session or client secret.
Server WebSocket session (Node.js)
import WebSocket from "ws";
const ws = new WebSocket("wss://api.openai.com/v1/realtime?model=gpt-realtime-2.1", {
headers: {
Authorization: `Bearer ${process.env.OPENAI_API_KEY}`,
"OpenAI-Safety-Identifier": "clinic-caller-7f3a91",
},
});
const send = (event: object) => ws.send(JSON.stringify(event));
ws.on("open", () => {
send({
type: "session.update",
session: {
type: "realtime", // required in the GA shape
model: "gpt-realtime-2.1",
output_modalities: ["audio"], // or ["text"]
instructions: "You are Ava, the receptionist at Maple Street Dental. Keep answers to one or two short sentences. Offer to transfer to the dentist for medical questions.",
reasoning: { effort: "low" }, // minimal | low | medium | high | xhigh
audio: {
input: {
format: { type: "audio/pcm", rate: 24000 }, // mono 16-bit PCM
transcription: { model: "gpt-transcribe" }, // optional, for logs
turn_detection: { type: "semantic_vad", eagerness: "auto" },
},
output: { format: { type: "audio/pcm", rate: 24000 }, voice: "marin" },
},
tools: [{
type: "function",
name: "check_availability",
description: "List open appointment slots for a procedure on a date.",
parameters: {
type: "object",
properties: {
date: { type: "string", description: "YYYY-MM-DD" },
procedure: { type: "string", enum: ["cleaning", "filling", "crown", "consultation"] },
},
required: ["date", "procedure"],
},
}],
tool_choice: "auto",
},
});
});
ws.on("message", async (raw) => {
const event = JSON.parse(raw.toString());
switch (event.type) {
case "response.output_audio.delta": // base64 PCM chunk
playToSpeaker(Buffer.from(event.delta, "base64"));
break;
case "response.output_audio_transcript.delta":
process.stdout.write(event.delta);
break;
case "conversation.item.input_audio_transcription.completed":
console.log(`\nCaller: ${event.transcript}`);
break;
case "input_audio_buffer.speech_started": // barge-in
stopPlayback();
break;
case "response.done": {
// Function calls arrive as output items of the finished response.
for (const item of event.response.output) {
if (item.type !== "function_call") continue;
const slots = await checkClinicSlots(JSON.parse(item.arguments));
send({ type: "conversation.item.create",
item: { type: "function_call_output", call_id: item.call_id, output: JSON.stringify(slots) } });
send({ type: "response.create" }); // let the model speak the result
}
break;
}
case "error":
console.error(event.error);
break;
}
});
// Microphone: 24 kHz mono PCM16 chunks
export function sendAudio(pcm: Buffer) {
send({ typ
Установить openai-realtime в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл openai-realtime?
Build voice agents with the OpenAI Realtime API, a speech-to-speech interface that takes audio in and streams spoken answers back over WebRTC, WebSocket or SIP. Use when a user asks to build a voice assistant, stream microphone audio to gpt-realtime-2.1, handle interruptions and function calls in a phone-style conversation, answer SIP calls, mint ephemeral browser keys, or migrate off the removed beta (gpt-4o-realtime-preview, OpenAI-Beta header).
Как установить скилл openai-realtime?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл openai-realtime запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic