Skip to content
For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to the page URL.
Primary navigation

Create session

LiveCreateResponse live().create(LiveCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
POST/live/sessions

Create a Live WebRTC session. Start with the Live prompting guide.

ParametersExpand Collapse
LiveCreateParams params

Startup configuration for the Live session.

Transport transport

WebRTC transport with the browser’s SDP offer.

ReturnsExpand Collapse
class LiveCreateResponse:

The created Live session identifier and WebRTC answer. Apply transport.sdp as the peer’s remote answer and wait for session.started on the data channel before sending commands.

Session session

The newly created Live session. Use its ID for session controls and sideband connections.

Transport transport

WebRTC transport with the SDP answer.

Create session

package com.openai.example;

import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.live.LiveCreateParams;
import com.openai.models.live.LiveCreateResponse;
import com.openai.models.live.MediaSessionConfig;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        OpenAIClient client = OpenAIOkHttpClient.fromEnv();

        LiveCreateParams params = LiveCreateParams.builder()
            .session(MediaSessionConfig.builder()
                .model(MediaSessionConfig.Model.GPT_LIVE_1)
                .build())
            .transport(LiveCreateParams.Transport.builder()
                .sdp("x")
                .build())
            .build();
        LiveCreateResponse live = client.live().create(params);
    }
}
{
  "session": {
    "id": "live_123"
  },
  "transport": {
    "type": "webrtc",
    "sdp": "<SDP answer>"
  }
}
Returns Examples
{
  "session": {
    "id": "live_123"
  },
  "transport": {
    "type": "webrtc",
    "sdp": "<SDP answer>"
  }
}