Responses
创建模型响应,支持多轮对话、工具调用和推理。
调用约定
| 项目 | 值 |
|---|---|
| Base URL | https://token.wdcloud.ai |
| 认证请求头 | Authorization: Bearer <API_KEY> |
| JSON 请求类型 | Content-Type: application/json |
接口
POST /v1/responses
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
model | string | 是 | 模型 ID |
input | string 或 array | 否 | 输入文本或消息列表 |
instructions | string | 否 | 模型需要遵循的系统指令 |
max_output_tokens | integer | 否 | 最大输出 Token 数 |
stream | boolean | 否 | 是否使用流式响应 |
tools | array | 否 | 可供模型调用的工具列表 |
tool_choice | string 或 object | 否 | 工具调用策略 |
reasoning | object | 否 | 推理配置 |
previous_response_id | string | 否 | 上一轮响应 ID |
truncation | string | 否 | 截断策略:auto 或 disabled |
示例
bash
curl -X POST "https://token.wdcloud.ai/v1/responses" \
-H "Authorization: Bearer sk-xxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "YOUR_MODEL_ID",
"input": "Explain why the sky is blue in one sentence."
}'