Responses

向支持 Responses 的 Genesis 模型提交输入,并从返回的输出项中取得生成文本。

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

调用前准备

准备具有 Genesis 权限的访问凭据。选择支持 Responses 的模型;可从查看模型列表取得模型 ID。

请求体

$GENESIS_ACCESS_TOKEN 替换为访问令牌或服务账号 API Key,将 $MODEL_ID 替换为所选模型的 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": "用一句话说明索引的作用。",
    "store": false,
    "stream": false,
    "temperature": 0.7,
    "top_p": 0.9,
    "max_output_tokens": 2048,
    "instructions": "You are a concise API debugging assistant."
  }'

字段

类型

必填

说明

model

string

要调用的 Responses 模型 ID。

input

string

本次请求的文本输入。

store

boolean

是否保存本次 Response。

stream

boolean

是否请求 Responses 原生 SSE 事件。

temperature

number

采样温度。

top_p

number

核采样参数。

max_output_tokens

integer

输出 Token 上限。

instructions

string

本次请求的附加指令。

成功响应

服务返回本次 Response 的标识、状态和输出项。

{
  "id": "<RESPONSE_ID>",
  "object": "response",
  "status": "completed",
  "model": "<MODEL_ID>",
  "output": [
    {
      "type": "message",
      "role": "assistant",
      "content": [
        {
          "type": "output_text",
          "text": "索引通过建立可快速定位的数据结构来减少查询扫描范围。"
        }
      ]
    }
  ]
}

字段

类型

说明

id

string

本次 Response 的标识。

object

string

响应对象类型,示例为 response

status

string

当前响应状态。

model

string

实际处理请求的模型 ID。

output

array of object

输出项列表。

下面表格展开示例中 output 数组的每一项;每一行是该数组项的一个字段。

字段

类型

说明

type

string

输出项类型,例如 reasoningmessage

role

string

消息输出项的角色,示例为 assistant

content

array of object

消息输出项的内容块列表。

下面表格展开示例中 output[].content 数组的每一项;每一行是该数组项的一个字段。

字段

类型

说明

type

string

内容块类型。

text

string

typeoutput_text 时的生成文本。

错误响应

{
  "error": {
    "message": "<可读错误信息>",
    "type": "<错误类型,可能省略>",
    "code": "<错误代码,可能省略>"
  }
}

字段

类型

说明

error

object

错误对象。

下面表格展开示例中 error 对象;每一行是该对象的一个字段。

字段

类型

说明

message

string

可读错误信息。

type

string

模型服务返回的错误类别,可能省略。

code

string 或 null

模型服务返回的错误代码,可能省略。

最后更新于