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

client.Live.New(ctx, body) (*LiveNewResponse, error)
POST/live/sessions

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

ParametersExpand Collapse
body LiveNewParams
Session param.Field[MediaSessionConfig]

Startup configuration for the Live session.

Transport param.Field[LiveNewParamsTransport]

WebRTC transport with the browser’s SDP offer.

ReturnsExpand Collapse
type LiveNewResponse struct{…}

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 LiveNewResponseSession

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

Transport LiveNewResponseTransport

WebRTC transport with the SDP answer.

Create session

package main

import (
  "context"
  "fmt"

  "github.com/openai/openai-go"
  "github.com/openai/openai-go/live"
  "github.com/openai/openai-go/option"
)

func main() {
  client := openai.NewClient(
    option.WithAPIKey("My API Key"),
  )
  live, err := client.Live.New(context.TODO(), live.LiveNewParams{
    Session: live.MediaSessionConfigParam{
      Model: live.MediaSessionConfigModelGPTLive1,
    },
    Transport: live.LiveNewParamsTransport{
      Sdp: "x",
    },
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", live.Session)
}
{
  "session": {
    "id": "live_123"
  },
  "transport": {
    "type": "webrtc",
    "sdp": "<SDP answer>"
  }
}
Returns Examples
{
  "session": {
    "id": "live_123"
  },
  "transport": {
    "type": "webrtc",
    "sdp": "<SDP answer>"
  }
}