OpenAI: GPT Realtime 2
openai/gpt-realtime-2
提供中
speech-to-speech
1プロバイダー
OpenAI realtime voice model for speech-to-speech conversations with configurable reasoning effort and tool use.
作成者OpenAI
言語未指定
レスポンス形式ストリーミング: PCM · µ-law · A-law
ステータス提供中
プロバイダー
同じモデルを複数のプロバイダーがホストしている場合があります。バックエンドを固定したい場合は1つのプロバイダーを選び、そうでなければルーティングに選択を任せられます。
プロバイダーSlug100万トークンあたりレイテンシiTTSのレイテンシは音声の最初のバイトが届くまでの時間、STTのレイテンシは最初のトークンが届くまでの時間で計測しています。モード稼働率
OpenAI
3個のパラメーター
openai
$64
—
ストリーミング
対応言語
このモデルの確認済み言語リストはまだありません。
機能
Speech to speech
Bidirectional realtime speech-to-speech over WebSocket or WebRTC.
speech_to_speech
Text input and output
Accepts text input and returns text output alongside audio.
text_input_output
Image input
Accepts image input in the conversation.
image_input
Turn detection
Server-side voice activity detection (server_vad) or semantic turn detection (semantic_vad).
turn_taking
Tool use
Function calling during the conversation.
tool_use
Input transcription
Optional transcription of input audio by a separate transcription model.
input_transcription
Configurable reasoning effort
Reasoning effort is configurable per session.
reasoning_effort
コード
OpenAI SDKによるリアルタイム音声変換
question.pcm(24 kHz・16ビット・モノラルPCM)をOpenAI Realtimeプロトコルで1ターンとして送信し、音声の返答をreply.pcmに保存します。
import { once } from "node:events";
import { readFile, writeFile } from "node:fs/promises";
import OpenAI from "openai";
import { OpenAIRealtimeWS } from "openai/realtime/ws";
const client = new OpenAI({
apiKey: process.env.ALLMODELS_API_KEY,
baseURL: "https://api.allmodels.io/oai"
});
const realtime = new OpenAIRealtimeWS({ model: "gpt-realtime-2" }, client);
const reply = [];
realtime.on("response.output_audio.delta", ({ delta }) => reply.push(Buffer.from(delta, "base64")));
realtime.on("response.done", async () => {
await writeFile("reply.pcm", Buffer.concat(reply));
realtime.close();
});
realtime.on("error", console.error);
if (realtime.socket.readyState !== 1) await once(realtime.socket, "open");
const format = { type: "audio/pcm", rate: 24000 };
realtime.send({
type: "session.update",
session: {
type: "realtime",
output_modalities: ["audio"],
audio: { input: { format, turn_detection: null }, output: { format, voice: "marin" } }
}
});
realtime.send({ type: "input_audio_buffer.append", audio: (await readFile("question.pcm")).toString("base64") });
realtime.send({ type: "input_audio_buffer.commit" });
realtime.send({ type: "response.create" });
