Responses

创建 Responses 响应

POST
/v1/responses

OpenAI Responses 格式。线上实测:qwen3.7-flash 可用(非流式与流式 SSE 均通过);deepseek-v3.2、kimi-k2.7-code 返回 400(Agent capabilities are not enabled for the current model),claude-haiku-4-5 返回 500(not implemented),请在这些模型上改用 Chat Completions 或 Anthropic Messages。

鉴权

BearerAuth
header鉴权Bearer <令牌>

使用令牌(API Key)认证。 格式:Authorization: Bearer sk-xxxxxx。令牌在控制台「API 密钥」页创建。

请求体

application/json
  1. body
model*string
input?|array<>

输入内容,可以是字符串或消息数组

instructions?string
max_output_tokens?integer
temperature?number
top_p?number
stream?boolean
tools?array<>
tool_choice?string|
reasoning?
previous_response_id?string
truncation?string
可选值"auto""disabled"
enable_thinking?boolean

千问系列专用:设为 false 关闭思考,节省 token。其他模型请去掉。

响应体

成功创建响应

application/json
  1. response
id?string
object?string
created_at?integer
status?string
可选值"completed""failed""in_progress""incomplete"
model?string
output?array<>
usage?
curl -X POST "https://ai.athandra.com/v1/responses" \  -H "Content-Type: application/json" \  -d '{    "model": "qwen3.7-flash",    "input": "用一句话介绍你自己",    "max_output_tokens": 600,    "enable_thinking": false  }'
{  "id": "resp_deaedc17-0a80-9bbf-bab3-9aa18d893838",  "object": "response",  "created_at": 1791367100,  "model": "qwen3.7-flash",  "status": "completed",  "output": [    {      "id": "msg_ffe2ee94",      "type": "message",      "role": "assistant",      "status": "completed",      "content": [        {          "type": "output_text",          "text": "我是通义千问,由阿里巴巴集团通义实验室独立开发的大型语言模型。"        }      ]    }  ],  "usage": {    "input_tokens": 52,    "output_tokens": 18,    "total_tokens": 70  }}