Create an LLM session record¶
Save a separate session record for the current user. This request does not call a model.
POST https://api.moi.matrixorigin.cn/v5/workspaces/{workspace_id}/llm/sessions
Before you call this API¶
Set BASE_URL to the product API prefix https://api.moi.matrixorigin.cn/v5. For private deployments, use the corresponding product API URL.
Configure Workspace identity and variables in the same environment.
Request¶
curl --request POST \
"$BASE_URL/workspaces/$WORKSPACE_ID/llm/sessions" \
--header "X-API-Key: $MOI_KEY" \
--header "X-Workspace-ID: $WORKSPACE_ID" \
--header "Content-Type: application/json" \
--data-raw '{"title":"临时会话","source":"moi","config":"{}"}'
Parameter |
Location |
Type |
Required |
Description |
|---|---|---|---|---|
|
Path |
string |
Yes |
Target Workspace, matching X-Workspace-ID. |
|
Body |
string |
No |
Session title; omission/null is saved as an empty string. |
|
Body |
string |
No |
Application source identifier, an open string. Omission/null becomes empty. |
|
Body |
string |
No |
Configuration stored as text. Serialize JSON configuration to a string first. |
The server generates the ID. No business request_id idempotency parameter is provided. For unknown creation outcomes, read the session list first to avoid immediate duplicate creation.
Successful response¶
{
"code": 0,
"data": {
"id": 41,
"title": "临时会话",
"source": "moi",
"user_id": "user-example",
"config": "{}",
"created_at": 1794445200,
"updated_at": 1794445200
}
}
Field |
Type |
Description |
|---|---|---|
|
integer |
0 on success; HTTP status is 201. |
|
object |
Error responses¶
Error formats and read scope explains differing identity, parameter, resource-read, and storage-failure outcomes.