Skip to content

Realtime

OpenAI Realtime API 互換の音声 WebSocket。

WS/v1/realtime

WS /v1/realtime は OpenAI Realtime イベントを透過プロキシします。

Auth

ハンドシェイクで Authorization: Bearer plm_… または x-api-key を使います。

파라미터타입필수설명
modelquery필수gpt-realtime-2.1 または gpt-realtime-2.1-mini
Authorizationheader필수Bearer plm_… または x-api-key

Example

ts
import WebSocket from "ws";

const model = "gpt-realtime-2.1";
const url = `wss://apirouter.pleum.ai/v1/realtime?model=${model}`;

const ws = new WebSocket(url, {
  headers: {
    Authorization: "Bearer " + process.env.PLEUM_API_KEY,
  },
});

ws.on("open", () => {
  ws.send(JSON.stringify({
    type: "session.update",
    session: { modalities: ["audio", "text"], voice: "alloy" },
  }));
});

ws.on("message", (data) => {
  const event = JSON.parse(data.toString());
  console.log(event.type);
});

Billing

接続時に hold、終了時に response.done usage で settle します。

最大 25 分 · idle 5 分 · 最初のクライアントメッセージ 30 秒以内。