Get the latest LLM message ID

Query the maximum message ID in the specified conversation for the current user.

GET https://api.moi.matrixorigin.cn/v5/workspaces/{workspace_id}/llm/sessions/{session_id}/messages/latest

Before you call this API

BASE_URL uses the product API prefix https://api.moi.matrixorigin.cn/v5. For a dedicated deployment, use its corresponding product API address.

Configure Workspace identity and variables in the same environment.

Request

curl --request GET \
  "$BASE_URL/workspaces/$WORKSPACE_ID/llm/sessions/$SESSION_ID/messages/latest?completed_only=true" \
  --header "X-API-Key: $MOI_KEY" \
  --header "X-Workspace-ID: $WORKSPACE_ID"

Parameter

Location

Type

Required

Description

workspace_id

Path

string

Yes

Target Workspace, matching X-Workspace-ID.

session_id

Path

integer

Yes

Positive integer ID returned by this service.

completed_only

Query

string

No

1 or case-insensitive true selects status=completed only; other values do not restrict state.

message_id is0 without matching messages. This read does not independently check conversation existence, so0 proves neither existence nor absence. completed is a stored state, not proof of model task completion. Current dedicated SDK/CLI latest-message methods have no completed_only parameter. Use verified HTTP or generic resource requests for this condition.

Successful response

{
  "code": 0,
  "data": {
    "message_id": 0
  }
}

Field

Type

Description

code

integer

0 on success; HTTP status is 200.

data.message_id

integer

Maximum message ID;0 if no message matches.

Error response

Error formats and read scope explains differing identity, parameter, resource-read, and storage-failure outcomes.

Last updated on