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 |
|---|---|---|---|
|
string |
Yes |
Anthropic Messages model ID to call. |
|
integer |
Yes |
Maximum tokens to generate. |
|
array of object |
Yes |
Ordered list of messages to submit. |
|
boolean |
No |
Set to |
Field |
Type |
Required |
Description |
|---|---|---|---|
|
string |
Yes |
Message role. |
|
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 |
|---|---|---|
|
string |
Identifier for this Message. |
|
string |
Response type; the example is |
|
string |
Role of the generated message. |
|
string |
Model ID that processed the request. |
|
array of object |
Generated content items. |
|
string or null |
Reason the current generation stopped. |
Field |
Type |
Description |
|---|---|---|
|
string |
Content type; the example is |
|
string |
Generated text when the content type is |
|
string |
Reasoning content when the content type is |
Error response¶
{"error":{"message":"<human-readable error message>","type":"<error type; may be omitted>","code":"<error code; may be omitted>"}}
Field |
Type |
Description |
|---|---|---|
|
object |
Error object. |
Field |
Type |
Description |
|---|---|---|
|
string |
Human-readable error message. |
|
string |
Error category returned by the model service; it may be omitted. |
|
string or null |
Error code returned by the model service; it may be omitted. |