Skip to content
中文

Create conversation items

Call Create conversation first, then replace conv_123 with the returned conv_ ID.

POST/openai/v1/conversations/{conversation_id}/items● Supported

Official OpenAI docs ↗

Request parameters

  • conversation_idstringrequired

    path:

  • itemsarrayrequired

    Verified to take effect.

Returns

200 list

Appends items to a conversation (up to 20 at a time) and returns the items just added.

Errors follow the OpenAI format — see error codes

Request

curl
# Call Create conversation first, then replace conv_123 with the returned conv_ ID.
curl https://api.deepraxis.com/openai/v1/conversations/conv_123/items \
  -H "Authorization: Bearer $PRAXIS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"items":[{"role":"user","content":"你好"}]}'
Python
# Call Create conversation first, then replace conv_123 with the returned conv_ ID.
from openai import OpenAI

client = OpenAI(
    base_url="https://api.deepraxis.com/openai/v1",
    api_key="$PRAXIS_API_KEY",
)

items = client.conversations.items.create(
    "conv_123",
    items=[{"role": "user", "content": "你好"}],
)
TypeScript
// Call Create conversation first, then replace conv_123 with the returned conv_ ID.
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.deepraxis.com/openai/v1",
  apiKey: "$PRAXIS_API_KEY",
});

const items = await client.conversations.items.create("conv_123", {
  items: [{ role: "user", content: "你好" }],
});

Response 200

{
  "object": "list",
  "data": [
    {
      "type": "message",
      "role": "user",
      "content": [
        {
          "type": "input_text",
          "text": "你好"
        }
      ],
      "id": "item_1482e1c810964bdf900fda01",
      "status": "completed"
    }
  ],
  "first_id": "item_1482e1c810964bdf900fda01",
  "last_id": "item_1482e1c810964bdf900fda01",
  "has_more": false
}

Response

HTTP 200

The items just added

application/json

Name Type Description
object string Object type; always list.
data array<object> Items of the conversation, in the order the list requested.
first_id string Id of the first item of this page; null for an empty page.
last_id string Id of the last item of this page; null for an empty page.
has_more boolean Whether more items exist beyond this page; pass last_id as after to read them.