> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vivix.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# conversation.item.create

向会话添加对话项。可以用它提供用户消息、函数调用或函数调用结果，并将其加入对话上下文。服务端通过 `conversation.item.created` 确认。

**`conversation.item.create` → `response.create`：** 等待匹配的 `conversation.item.created`，再请求使用新消息生成回答。返回工具结果时也使用相同顺序。

## 事件字段

**event\_id** `string`

客户端为本事件生成的 ID。

**type** `string` *required*

事件类型。必须为 `conversation.item.create`。

**previous\_item\_id** `string`

新对话项应插入到哪个对话项之后。省略时追加到末尾。使用 `root` 可插入到对话开头。

**item** `object` *required*

实时对话中的单个对话项。请选择下列变体之一。

**item.id** `string`

服务端分配或客户端提供的对话项 ID。

**item.type** `string` *required*

`message`、`function_call` 或 `function_call_output` 之一。

**item.status** `string`

`completed`、`incomplete` 或 `in_progress` 之一。通常由服务端返回。

**消息变体**

`item.type: "message"` 的消息对话项。

**消息 `item.role`：字符串枚举**

与角色互动的用户输入使用 `user`，之前的角色回答使用 `assistant`。角色行为通过 [Persona](https://docs.vivix.ai/cn/streaming-avatar/character/persona.md) 定义。对于 `assistant` 消息，生成的音频和视频通过 RTC 媒体轨道传输，语音输出文本则通过 `response.output_text.*` 事件流式返回。

**消息 `item.content`：数组**

消息内容片段。系统消息通常使用 `input_text`；用户消息通常使用 `input_text`、`input_audio` 和 `input_image`；助手消息通常使用 `text`。

**消息 `item.content[].type`：字符串枚举**

`input_text`、`input_audio`、`input_image` 或 `text` 之一。

**消息 `item.content[].text`：可选字符串**

文本内容，与 `input_text` 和 `text` 一同使用。

**消息 `item.content[].audio`：可选字符串**

Base64 编码的音频，与 `input_audio` 一同使用。

**消息 `item.content[].transcript`：可选字符串**

可选转录文本，与 `input_audio` 一同使用。

**消息 `item.content[].image_url`：可选字符串**

图像 URL，与 `input_image` 一同使用。

**消息 `item.content[].detail`：可选字符串枚举**

图像细节级别：`auto`、`low` 或 `high`，与 `input_image` 一同使用。

**函数调用变体**

`item.type: "function_call"` 的函数调用对话项。

**函数调用 `item.call_id`：可选字符串**

函数调用 ID。

**函数调用 `item.name`：字符串**

函数名称。

**函数调用 `item.arguments`：字符串**

经过 JSON 编码的函数参数。

**函数调用输出变体**

`item.type: "function_call_output"` 的函数调用输出对话项。

**函数调用输出 `item.call_id`：字符串**

该输出所属的函数调用 ID。

**函数调用输出 `item.output`：字符串**

字符串形式的函数输出。

```json conversation.item.create theme={null}
{
  "event_id": "evt_item_create_001",
  "type": "conversation.item.create",
  "previous_item_id": "item_000",
  "item": {
    "type": "message",
    "role": "user",
    "content": [
      {
        "type": "input_text",
        "text": "Show me the second product."
      }
    ]
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.