실시간 세션 엔드포인트

실시간 세션 엔드포인트 (Realtime Sessions Endpoints)

Realtime - Sessions API입니다. 실시간(Realtime) 대화를 위한 클라이언트 세션을 만드는 엔드포인트예요.

출처: 문서

본문

실시간 음성/문자 대화를 시작하기 전에 클라이언트 세션을 생성해서 임시 인증 정보를 받아두는 API예요. create_client_session 권한이 필요해요.

POST /v1/client/sessions — Create Client Session (클라이언트 세션 생성)

클라이언트 세션을 만듭니다. create_client_session 권한이 필요해요.

요청 본문: CreateRealtimeSessionRequest — {object}

응답 필드 (201 Successful Response):

  • client_secret#ClientSecret (필수) — 클라이언트 시크릿.
  • expires_at#date-time (필수) — 만료 시각.
  • object#string — 기본값 "client.session".
  • purpose#"realtime" (필수) — 클라이언트 세션의 용도. 현재는 realtime만 지원해요.

curl:

curl https://api.mistral.ai/v1/client/sessions \
 -X POST \
 -H 'Authorization: Bearer ***' \
 -H 'Content-Type: application/json' \
 -d '{
  "model": "mistral-small-latest"
}'

TypeScript:

import { Mistral } from "@mistralai/mistralai";

const mistral = new Mistral({
  apiKey: proces...EY"] ?? "",
});

async function run() {
  const result = await mistral.realtime.sessions.create({
    purpose: "realtime",
    model: "Ranchero",
  });

  console.log(result);
}

run();

응답 예시 (201):

{
  "client_secret": {
    "expires_at": "2025-12-17T10:25:07.818693Z",
    "value": "approved"
  },
  "expires_at": "2025-12-17T10:25:07.818693Z",
  "purpose": "realtime"
}

더 알아보기 (Learn more)