Messages (Anthropic)

Send messages using the Anthropic-compatible Genesis Messages API and return generated content.

POST https://token.moi.matrixorigin.cn/v1/messages

Before you call

Prepare credentials with Genesis access and a model ID that supports the Messages request shape.

Request body

Replace $GENESIS_ACCESS_TOKEN with an access token or service-account API key, and $MODEL_ID with the model ID to call.

curl -X POST \
  "https://token.moi.matrixorigin.cn/v1/messages" \
  -H "Authorization: Bearer $GENESIS_ACCESS_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "'"$MODEL_ID"'",
    "max_tokens": 256,
    "messages": [{"role":"user","content":"Explain data lineage in one sentence."}],
    "stream": false
  }'

Field

Type

Required

Description

model

string

Yes

Anthropic Messages model ID to call.

max_tokens

integer

Yes

Maximum tokens to generate.

messages

array of object

Yes

Ordered list of messages to submit.

stream

boolean

No

Set to true to return Anthropic Messages SSE events.

Field

Type

Required

Description

role

string

Yes

Message role.

content

string

Yes

Text content of the message.

Successful response

The service returns generated content in the content array.

{
  "id": "<MESSAGE_ID>",
  "type": "message",
  "role": "assistant",
  "model": "<MODEL_ID>",
  "content": [{"type":"text","text":"A transaction executes a group of operations as a whole to preserve data consistency."}],
  "stop_reason": "end_turn"
}

Field

Type

Description

id

string

Identifier for this Message.

type

string

Response type; the example is message.

role

string

Role of the generated message.

model

string

Model ID that processed the request.

content

array of object

Generated content items.

stop_reason

string or null

Reason the current generation stopped.

Field

Type

Description

type

string

Content type; the example is text.

text

string

Generated text when the content type is text.

thinking

string

Reasoning content when the content type is thinking.

Error response

{"error":{"message":"<human-readable error message>","type":"<error type; may be omitted>","code":"<error code; may be omitted>"}}

Field

Type

Description

error

object

Error object.

Field

Type

Description

message

string

Human-readable error message.

type

string

Error category returned by the model service; it may be omitted.

code

string or null

Error code returned by the model service; it may be omitted.

Last updated on