创建会话
POST
/model/v1/conversations● 支持请求体
itemsarray可选Initial items, at most 20 per request. Router support (supported): Verified to take effect.
已验证生效。
metadataobject可选Up to 16 string key/value pairs stored with the conversation; keys at most 64 characters and values at most 512. Router support (supported): Verified to take effect.
已验证生效。
返回
200 conversation
创建一个会话,可选携带初始 items(一次最多 20 条)与 metadata。会话按租户分区,创建者是唯一能引用它的租户。
鉴权、限流、参数校验等平台错误按 problem+json 返回;OCR 的错误也为 problem+json,其它模型调用的错误按该端点所属格式(OpenAI 或 Anthropic)返回,参见 错误码
请求示例
curl
curl https://api.deepraxis.com/model/v1/conversations \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"metadata":{"topic":"example"}}'Python
from openai import OpenAI
client = OpenAI(
base_url="https://api.deepraxis.com/model/v1",
api_key="$PRAXIS_API_KEY",
)
conversation = client.conversations.create(
metadata={"topic": "example"},
)TypeScript
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.deepraxis.com/model/v1",
apiKey: "$PRAXIS_API_KEY",
});
const conversation = await client.conversations.create({
metadata: { topic: "example" },
});响应示例 200
{
"id": "conv_2359675c12b145c6b4350e76",
"object": "conversation",
"created_at": 1790305669,
"metadata": {
"topic": "example"
}
}响应
HTTP 200
The created conversation
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Id of the conversation, such as conv_...; use it as conversation_id in conversation calls and as conversation in createResponse. |
| object | string | Object type; always conversation. |
| created_at | integer | Unix time in seconds at which the conversation was created. |
| metadata | object | Up to 16 string key/value pairs; keys at most 64 characters and values at most 512. |