## Fork session

`live.sessions.fork(session_id, **kwargs) -> SessionForkResponse`

**post** `/live/sessions/{session_id}/fork`

Fork a stored Live session onto a new WebRTC connection.

### Parameters

- `session_id: String`

- `transport: Transport{ sdp, type}`

  WebRTC transport with an SDP offer for the new connection to the forked session.

  - `sdp: String`

    Session Description Protocol message for the WebRTC connection.

    `minLength: 1`

  - `type: :webrtc`

    The transport used for the Live session. Always `webrtc`.

    - `:webrtc`

- `session: MediaSessionForkConfig`

  Optional configuration overrides for the new Live session. Omit this object or send an empty object to inherit the stored session's settings.

  - `client: ClientConfig`

    Startup-only capabilities for an untrusted frontend attached to a unified WebRTC session. Trusted sideband connections are unaffected.

    - `data_channel: DataChannelConfig`

      Client and server event permissions for the WebRTC frontend data channel.

      - `allowed_client_events: :all | Array[String]`

        Client event types that the frontend data channel may send. Use 'all' to allow every client event; an empty array allows none. Omission preserves the existing allow-all behavior.

        - `AllowedClientEvents = :all`

          - `:all`

        - `UnionMember1 = Array[String]`

      - `allowed_server_events: :all | Array[ServerEventSelector]`

        Server events that may be sent to the frontend data channel. Use 'all' to allow every server event; an empty array allows none. Omission preserves the existing allow-all behavior. Responses events use an object with type 'response.event' and a response_event selector.

        - `AllowedServerEvents = :all`

          - `:all`

        - `EventSelectors = Array[ServerEventSelector]`

          - `type: String`

            The outer Live server event type. Use 'response.event' for Responses events.

            `minLength: 1`, `maxLength: 256`

          - `response_event: String`

            The nested Responses event type. Required when type is 'response.event'; forbidden for other event types.

            `minLength: 1`, `maxLength: 256`

  - `delegation: Delegation{ type, acknowledgement_delay_ms, responses}`

    Update the Responses backend for an existing Live session without changing delegation ownership.

    - `type: :responses`

      The delegation owner. Always `responses` for tasks handled by the Responses API.

      - `:responses`

    - `acknowledgement_delay_ms: Integer`

      Milliseconds to wait before requesting an automatic spoken acknowledgement for a delegation. The model may still speak before this delay. Any commentary or thinking appended to the session cancels all pending acknowledgements, including those for other delegations. Defaults to 400 for Decisions sessions and 0 (request immediately) for other sessions. Omission in a session update preserves the current value. Updates apply to subsequent delegations.

      `minimum: 0`, `maximum: 800`

    - `responses: ResponsesDelegationUpdateConfig`

      Responses backend settings to update. Omitted settings keep their existing values.

      - `instructions: String`

        Instructions for the delegated Responses model, separate from Live instructions. See [backend prompting](/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt).

      - `max_output_tokens: Integer`

        Maximum number of output tokens for each delegated response.

        `minimum: 16`

      - `model: String`

        The Responses backend model to use for subsequent delegated requests. Omit to keep the current backend model.

      - `parallel_tool_calls: bool`

        Whether the delegated Responses model may request multiple tool calls in a single response.

      - `reasoning: Reasoning{ effort, summary}`

        Reasoning settings passed to each delegated Responses request.

        - `effort: :none | :minimal | :low | 3 more`

          How much reasoning effort the delegated Responses model should use. Supported values depend on the backend model.

          - `:none`

          - `:minimal`

          - `:low`

          - `:medium`

          - `:high`

          - `:xhigh`

        - `summary: :concise | :detailed | :auto`

          The reasoning summary to request from the delegated Responses model, when supported.

          - `:concise`

          - `:detailed`

          - `:auto`

      - `service_tier: :auto | :default | :fast_tier_temp_pilot | 3 more`

        Service tier for delegated Responses requests.

        - `:auto`

        - `:default`

        - `:fast_tier_temp_pilot`

        - `:flex`

        - `:priority`

        - `:ultrafast`

      - `text: Text{ verbosity}`

        Text generation settings passed to each delegated Responses request.

        - `verbosity: :low | :medium | :high`

          The amount of detail in text generated by the Responses backend. This does not configure the Live model’s spoken delivery.

          - `:low`

          - `:medium`

          - `:high`

      - `tool_choice: :auto | :none | :required | LiveFunctionToolChoiceParam{ name, type} | LiveMCPToolChoiceParam{ name, server_label, type} | 11 more`

        Controls which tool the Responses backend uses when handling a task delegated by the Live model.

        - `LiveToolChoiceEnum = :auto | :none | :required`

          - `:auto`

          - `:none`

          - `:required`

        - `class LiveFunctionToolChoiceParam`

          - `name: String`

            `minLength: 1`, `maxLength: 64`

          - `type: :function`

            - `:function`

        - `class LiveMCPToolChoiceParam`

          - `name: String`

            `minLength: 1`, `maxLength: 64`

          - `server_label: String`

            `minLength: 1`, `maxLength: 64`

          - `type: :mcp`

            - `:mcp`

        - `class FileSearch`

          - `type: :file_search`

            The tool to call. Always `file_search`.

            - `:file_search`

        - `class WebSearch`

          - `type: :web_search`

            The tool to call. Always `web_search`.

            - `:web_search`

        - `class WebSearchPreview`

          - `type: :web_search_preview`

            The tool to call. Always `web_search_preview`.

            - `:web_search_preview`

        - `class ImageGeneration`

          - `type: :image_generation`

            The tool to call. Always `image_generation`.

            - `:image_generation`

        - `class Computer`

          - `type: :computer`

            The tool to call. Always `computer`.

            - `:computer`

        - `class CodeInterpreter`

          - `type: :code_interpreter`

            The tool to call. Always `code_interpreter`.

            - `:code_interpreter`

        - `class ProgrammaticToolCalling`

          - `type: :programmatic_tool_calling`

            The tool to call. Always `programmatic_tool_calling`.

            - `:programmatic_tool_calling`

        - `class Shell`

          Forces the model to call the shell tool when a tool call is required.

          - `type: :shell`

            The tool to call. Always `shell`.

            - `:shell`

        - `class Custom`

          - `name: String`

            The name of the custom tool to call.

          - `type: :custom`

            The tool to call. Always `custom`.

            - `:custom`

        - `class ApplyPatch`

          Forces the model to call the apply_patch tool when executing a tool call.

          - `type: :apply_patch`

            The tool to call. Always `apply_patch`.

            - `:apply_patch`

        - `class LiveAllowedToolsChoiceParam`

          - `tools: Array[Function{ name, type} | Mcp{ name, server_label, type} | FileSearch{ type} | 9 more]`

            The tools that the delegated Responses model may call.

            `minItems: 1`, `maxItems: 128`

            - `class Function`

              - `name: String`

                `minLength: 1`, `maxLength: 64`

              - `type: :function`

                - `:function`

            - `class Mcp`

              - `name: String`

                `minLength: 1`, `maxLength: 64`

              - `server_label: String`

                `minLength: 1`, `maxLength: 64`

              - `type: :mcp`

                - `:mcp`

            - `class FileSearch`

              - `type: :file_search`

                The tool to call. Always `file_search`.

                - `:file_search`

            - `class WebSearch`

              - `type: :web_search`

                The tool to call. Always `web_search`.

                - `:web_search`

            - `class WebSearchPreview`

              - `type: :web_search_preview`

                The tool to call. Always `web_search_preview`.

                - `:web_search_preview`

            - `class ImageGeneration`

              - `type: :image_generation`

                The tool to call. Always `image_generation`.

                - `:image_generation`

            - `class Computer`

              - `type: :computer`

                The tool to call. Always `computer`.

                - `:computer`

            - `class CodeInterpreter`

              - `type: :code_interpreter`

                The tool to call. Always `code_interpreter`.

                - `:code_interpreter`

            - `class ProgrammaticToolCalling`

              - `type: :programmatic_tool_calling`

                The tool to call. Always `programmatic_tool_calling`.

                - `:programmatic_tool_calling`

            - `class Shell`

              Forces the model to call the shell tool when a tool call is required.

              - `type: :shell`

                The tool to call. Always `shell`.

                - `:shell`

            - `class Custom`

              - `name: String`

                The name of the custom tool to call.

              - `type: :custom`

                The tool to call. Always `custom`.

                - `:custom`

            - `class ApplyPatch`

              Forces the model to call the apply_patch tool when executing a tool call.

              - `type: :apply_patch`

                The tool to call. Always `apply_patch`.

                - `:apply_patch`

          - `type: :allowed_tools`

            The tool choice type. Always `allowed_tools`.

            - `:allowed_tools`

          - `mode: :none | :auto | :required`

            How to select a tool from the allowed set.

            - `:none`

            - `:auto`

            - `:required`

      - `tools: Array[FunctionTool | WebSearch{ type} | FileSearch{ type} | 10 more]`

        Tools available to the Responses backend while it handles tasks delegated by the Live model.

        - `class FunctionTool`

          A function tool available to the Responses backend when the Live model delegates a task.

          - `name: String`

            The name the delegated Responses model uses when calling this function.

          - `type: :function`

            The tool type. Always `function`.

            - `:function`

          - `description: String`

            What the function does and when the delegated Responses model should call it.

          - `parameters: Hash[Symbol, untyped]`

            A JSON Schema object describing the arguments accepted by the function.

          - `strict: bool`

            Whether the delegated Responses model must follow the function’s parameter schema exactly.

        - `class WebSearch`

          A web search tool available to the Live session’s Responses backend.

          - `type: :web_search`

            The tool type. Always `web_search`.

            - `:web_search`

        - `class FileSearch`

          - `type: :file_search`

            - `:file_search`

        - `class CodeInterpreter`

          - `type: :code_interpreter`

            - `:code_interpreter`

        - `class Shell`

          A Responses shell tool. Use a hosted container or return local shell results with response.item.create. Domain secrets are not supported.

          - `type: :shell`

            - `:shell`

          - `environment: ContainerAuto{ type, file_ids, memory_limit, 2 more} | ContainerReference{ container_id, type} | Local{ type, skills}`

            - `class ContainerAuto`

              - `type: :container_auto`

                Automatically creates a container for this request

                - `:container_auto`

              - `file_ids: Array[String]`

                An optional list of uploaded files to make available to your code.

                `maxItems: 50`

              - `memory_limit: :"1g" | :"4g" | :"16g" | :"64g"`

                The memory limit for the container.

                - `:"1g"`

                - `:"4g"`

                - `:"16g"`

                - `:"64g"`

              - `network_policy: Disabled{ type} | Allowlist{ allowed_domains, type}`

                Network access policy for the container.

                - `class Disabled`

                  - `type: :disabled`

                    Disable outbound network access. Always `disabled`.

                    - `:disabled`

                - `class Allowlist`

                  - `allowed_domains: Array[String]`

                    A list of allowed domains when type is `allowlist`.

                    `minItems: 1`

                  - `type: :allowlist`

                    Allow outbound network access only to specified domains. Always `allowlist`.

                    - `:allowlist`

              - `skills: Array[SkillReference{ skill_id, type, version} | Inline{ description, name, source, type}]`

                An optional list of skills referenced by id or inline data.

                `maxItems: 200`

                - `class SkillReference`

                  - `skill_id: String`

                    The ID of the referenced skill.

                    `minLength: 1`, `maxLength: 64`

                  - `type: :skill_reference`

                    References a skill created with the /v1/skills endpoint.

                    - `:skill_reference`

                  - `version: String`

                    Optional skill version. Use a positive integer or 'latest'. Omit for default.

                - `class Inline`

                  - `description: String`

                    The description of the skill.

                  - `name: String`

                    The name of the skill.

                  - `source: Source{ data, media_type, type}`

                    Inline skill payload

                    - `data: String`

                      Base64-encoded skill zip bundle.

                      `minLength: 1`, `maxLength: 70254592`

                    - `media_type: :"application/zip"`

                      The media type of the inline skill payload. Must be `application/zip`.

                      - `:"application/zip"`

                    - `type: :base64`

                      The type of the inline skill source. Must be `base64`.

                      - `:base64`

                  - `type: :inline`

                    Defines an inline skill for this request.

                    - `:inline`

            - `class ContainerReference`

              - `container_id: String`

                The ID of the referenced container.

              - `type: :container_reference`

                References a container created with the /v1/containers endpoint

                - `:container_reference`

            - `class Local`

              - `type: :local`

                Use a local computer environment.

                - `:local`

              - `skills: Array[Skill{ description, name, path}]`

                An optional list of skills.

                `maxItems: 200`

                - `description: String`

                  The description of the skill.

                - `name: String`

                  The name of the skill.

                - `path: String`

                  The path to the directory containing the skill.

        - `class ImageGeneration`

          - `type: :image_generation`

            - `:image_generation`

        - `class Mcp`

          - `type: :mcp`

            - `:mcp`

        - `class Custom`

          - `type: :custom`

            - `:custom`

        - `class Namespace`

          - `type: :namespace`

            - `:namespace`

        - `class ToolSearch`

          - `type: :tool_search`

            - `:tool_search`

        - `class ProgrammaticToolCalling`

          - `type: :programmatic_tool_calling`

            - `:programmatic_tool_calling`

        - `class Computer`

          - `type: :computer`

            - `:computer`

        - `class ApplyPatch`

          - `type: :apply_patch`

            - `:apply_patch`

  - `store: bool`

    Whether to store the forked session. Omission inherits the stored session's setting.

### Returns

- `class SessionForkResponse`

  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{ id}`

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

    - `id: String`

      Opaque session identifier. Preserve the returned value unchanged, including its prefix.

  - `transport: Transport{ sdp, type}`

    WebRTC transport with the SDP answer.

    - `sdp: String`

      Session Description Protocol message for the WebRTC connection.

      `minLength: 1`

    - `type: :webrtc`

      The transport used for the Live session. Always `webrtc`.

      - `:webrtc`

### Example

```ruby
require "openai"

openai = OpenAI::Client.new(api_key: "My API Key")

response = openai.live.sessions.fork("session_id", transport: {sdp: "x", type: :webrtc})

puts(response)
```

#### 201 — Example

```json
{
  "session": {
    "id": "id"
  },
  "transport": {
    "sdp": "x",
    "type": "webrtc"
  }
}
```
