/v1/schemas/moonshotai-cn/chat/v1/responses
| field | recorded source |
|---|---|
| schema | Source linked above. upstream-spec Source trace0fc1213cc878662cfb4dc71f9526e83e0a192b10691c543339fda4d21e784977{
"fetchedAt": 1792819843,
"extractorVersion": "1",
"verifiedAt": null
} |
Request body
13 properties · 2 required · 16 $defs| property | type | description | constraints |
|---|---|---|---|
| model* | string | 使用的模型 ID。本接口当前支持 `kimi-k3.1-pro`、`kimi-k3.1-pro-highspeed` 和 `kimi-k3`。 | |
| input* | string | ResponsesInputItem[] | 本次请求的输入。传字符串等价于一条 user 消息;传数组时按顺序给出带类型的 item,可包含历史对话、工具调用与工具结果。 | |
| instructions | string | 顶层系统指令,作为最靠前的指令生效。 | |
| stream | boolean | 为 true 时以 SSE 事件流返回响应。 | default: false |
| max_output_tokens | integer | 本次响应最多生成的 Token 数量。Kimi K3 系列(`kimi-k3.1-pro`、`kimi-k3.1-pro-highspeed`、`kimi-k3`)默认为 131072,最大可设置为 1048576。此值为期望返回的 Token 长度,而非输入加输出的总长度。达到上限时 `status` 为 `incomplete`,`incomplete_details.reason` 为 `max_output_tokens`。 | |
| reasoning | object | 推理相关配置。 | |
| text | object | 输出文本配置。 | |
| tools | ResponsesTool[] | 模型可调用的工具列表。 | |
| tool_choice | enum | 控制工具调用行为。取 `auto` 时由模型自行决定是否调用工具。 | auto |
| include | enum[] | 要额外返回的字段,仅在使用 `web_search` 工具时有效。`web_search_call.action.sources` 返回搜索命中的网页来源;`web_search_call.results` 返回图片搜索结果。 | |
| prompt_cache_key | string | 上下文缓存标识,同一会话使用相同取值可提升缓存命中率。 | |
| prompt_cache_options | object | 上下文缓存写入选项。不传时默认开启缓存写入(5m 档):系统自动将请求前缀写入 5m 档缓存 | |
| safety_identifier | string | 用于检测可能违反使用政策的用户的稳定标识符。应为唯一标识每个用户的字符串。建议对用户名或邮箱进行哈希处理以避免发送可识别信息 |
Types
16 $defsResponsesAdditionalToolsItemobject
在对话中途追加可调用的工具,作用范围从该 item 所在位置开始。
| type* | enum | additional_tools | |
| id | string | ||
| role* | enum | developer | |
| tools* | ResponsesTool[] |
ResponsesCustomToolobject
接收自由文本输入的自定义工具。当前仅支持名为 `apply_patch` 的自定义工具,且必须提供 `grammar` + `lark` 格式定义;模型调用时在 output 中返回 `custom_tool_call` item。
| type* | enum | custom | |
| name* | enum | 工具名称,当前仅支持 `apply_patch`。 | apply_patch |
| description | string | ||
| format* | object | 输入格式约束。当前仅支持 `grammar` 类型与 `lark` 语法。 |
ResponsesCustomToolCallItemobject
回放一次自定义工具调用。
| type* | enum | custom_tool_call | |
| id | string | ||
| call_id* | string | 与对应 `custom_tool_call_output` 配对的调用 ID。 | |
| name* | string | ||
| namespace | string | 工具所属的命名空间,调用命名空间工具时返回。 | |
| input* | string | 模型生成的自由文本输入。 | |
| status | enum | completed |
ResponsesCustomToolCallOutputItemobject
自定义工具调用的执行结果。
| type* | enum | custom_tool_call_output | |
| call_id* | string | 与对应 `custom_tool_call` 相同的调用 ID。 | |
| output* | string | ResponsesInputContentPart[] | 工具返回的内容。 | |
| status | enum | completed |
ResponsesFunctionCallItemobject
回放一次函数调用。
| type* | enum | function_call | |
| id | string | ||
| call_id* | string | 与对应 `function_call_output` 配对的调用 ID。 | |
| name* | string | ||
| namespace | string | 工具所属的命名空间,调用命名空间工具时返回。 | |
| arguments* | string | 函数参数的 JSON 字符串。 | |
| status | enum | completed |
ResponsesFunctionCallOutputItemobject
函数调用的执行结果。
| type* | enum | function_call_output | |
| call_id* | string | 与对应 `function_call` 相同的调用 ID。 | |
| output* | string | ResponsesInputContentPart[] | 工具返回的内容。 | |
| status | enum | completed |
ResponsesFunctionToolobject
用 JSON Schema 描述参数的函数工具。
| type* | enum | function | |
| name* | string | 函数名称。必须符合正则表达式:^[a-zA-Z_][a-zA-Z0-9-_]{0,127}$ | |
| description | string | ||
| parameters | object | 描述函数参数的 JSON Schema。 | |
| strict | boolean |
ResponsesInputContentPart输入文本 | 输入图片 | 输出文本
content 数组的元素,按 `type` 区分。
ResponsesInputItem消息 | 推理 | 函数调用 | …
input 数组的元素,按 `type` 区分。省略 `type` 时按 `message` 处理。
ResponsesMessageItemobject
一条对话消息。`type` 可省略。
| type | enum | message | |
| role* | enum | 消息角色。`developer` 按系统指令处理。 | user | assistant | developer |
| content* | string | ResponsesInputContentPart[] | 消息内容,字符串或 content part 数组。 | |
| status | enum | completed |
ResponsesNamespaceToolobject
把一组函数工具或自定义工具收纳到同一个命名空间下。
| type* | enum | namespace | |
| name* | string | ||
| description* | string | ||
| tools* | ResponsesFunctionTool | ResponsesCustomTool[] |
ResponsesReasoningItemobject
回放上一轮的推理内容。`content` 优先于 `summary`。
| type* | enum | reasoning | |
| id | string | ||
| summary | object[] | ||
| content | object[] | ||
| status | enum | completed |
ResponsesTool函数工具 | 自定义工具 | 命名空间工具 | …
工具定义,按 `type` 区分。支持 `function`、`custom`(仅 `apply_patch`)、`namespace` 与 `web_search`,其他工具类型不支持。
ResponsesToolChoiceenum
控制工具调用行为。取 `auto` 时由模型自行决定是否调用工具。
auto
ResponsesWebSearchCallItemobject
回放上一轮的联网搜索调用。仅用于保留历史,转换时会被忽略;搜索结果已包含在其后的 assistant 消息中。
| type* | enum | web_search_call | |
| id | string | ||
| status | enum | completed | |
| action | object |
ResponsesWebSearchToolobject
由服务端执行的联网搜索工具。加入后服务端会先根据输入判断是否需要搜索;需要时执行搜索并把结果注入模型上下文,同时在 output 中返回一个 `web_search_call` item。每个请求最多包含一个 `web_search` 工具。`search_context_size`、`blocked_domains`、`filters.blocked_domains` 不支持,传入会返回 `invalid_request_error`;`user_location`、`external_web_access`、`…
| type* | enum | web_search | |
| filters | object | 搜索范围过滤。 | |
| search_content_types | enum[] | 搜索结果类型,默认仅 `text`。包含 `image` 时会额外执行图片搜索。 | default: ["text"] |
| image_settings | object | 图片搜索设置,仅在 `search_content_types` 包含 `image` 时生效。 |
Validate a payload
before you spend tokens$ curl -X POST https://modelschemas.com/v1/validate \
-d '{"provider":"moonshotai-cn","endpointId":"v1/responses","payload":{…}}'
→ {"valid": false, "errors": [{"path": "#", "keyword": "required", …}]}