Responses¶
Submit input to a Genesis model that supports Responses, then retrieve generated text from returned output items.
POST https://token.moi.matrixorigin.cn/v1/responses
Before you call¶
Prepare credentials with Genesis access and select a model that supports Responses. Obtain a model ID from List models.
Request body¶
Replace $GENESIS_ACCESS_TOKEN with an access token or service-account API key, and $MODEL_ID with the selected model ID.
curl -X POST \
"https://token.moi.matrixorigin.cn/v1/responses" \
-H "Authorization: Bearer $GENESIS_ACCESS_TOKEN" \
-H 'Content-Type: application/json' \
-d '{
"model": "'"$MODEL_ID"'",
"input": "Explain the purpose of an index in one sentence.",
"store": false,
"stream": false,
"temperature": 0.7,
"top_p": 0.9,
"max_output_tokens": 2048,
"instructions": "You are a concise API debugging assistant."
}'
Field |
Type |
Required |
Description |
|---|---|---|---|
|
string |
Yes |
Responses model ID to call. |
|
string |
Yes |
Text input for this request. |
|
boolean |
No |
Whether to store this Response. |
|
boolean |
No |
Whether to request native Responses SSE events. |
|
number |
No |
Sampling temperature. |
|
number |
No |
Nucleus-sampling parameter. |
|
integer |
No |
Maximum output tokens. |
|
string |
No |
Additional instructions for this request. |
Successful response¶
The service returns the Response ID, status, and output items.
{
"id": "<RESPONSE_ID>",
"object": "response",
"status": "completed",
"model": "<MODEL_ID>",
"output": [{"type":"message","role":"assistant","content":[{"type":"output_text","text":"An index uses a data structure for fast lookup and reduces the amount of data scanned by a query."}]}]
}
Field |
Type |
Description |
|---|---|---|
|
string |
Identifier for this Response. |
|
string |
Response object type; the example is |
|
string |
Current response status. |
|
string |
Model ID that processed the request. |
|
array of object |
Output items returned for the request. |
The following table expands each item in the example output array.
Field |
Type |
Description |
|---|---|---|
|
string |
Output item type; the example is |
|
string |
Message role; the example is |
|
array of object |
Content items in this message. |
The following table expands each item in the example output[].content array.
Field |
Type |
Description |
|---|---|---|
|
string |
Content type; the example is |
|
string |
Generated text 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. |