Mix LogoMix

Fork a session

Create a new session based on an existing session, copying messages up to a specified index

Create a new session based on an existing session, copying messages up to a specified index

POST
/api/sessions/{id}/fork

Path Parameters

idstring

Source session ID to fork from

messageIndexinteger

Index of the last message to include in the fork (0-based)

Range0 <= value
title?string

Optional title for the forked session (defaults to 'Forked Session')

Response Body

from mix_python_sdk import Mixwith Mix() as mix:    res = mix.sessions.fork(id="<id>", message_index=385832)    # Handle response    print(res)
{
  "assistantMessageCount": 0,
  "completionTokens": 0,
  "cost": 0.1,
  "createdAt": "2019-08-24T14:15:22Z",
  "firstUserMessage": "string",
  "id": "string",
  "promptTokens": 0,
  "title": "string",
  "toolCallCount": 0,
  "userMessageCount": 0
}
{
  "error": {
    "code": 0,
    "message": "string",
    "type": "bad_request"
  }
}
{
  "error": {
    "code": 0,
    "message": "string",
    "type": "bad_request"
  }
}