Chat Completions vs Responses API

改左边的参数,右边实时生成对应的请求体、curl 和 Python SDK 代码。配套文章见博客《Chat Completions 到 Responses》。

请求参数

此页面纯前端运行,不会发出任何真实请求,只生成代码。


    
维度Chat CompletionsResponses
定位为「聊天」设计的消息补全接口为「Agent / 任务」设计的状态化接口
状态管理无状态,每次手动回传全部历史可用 previous_response_id 让服务端接管历史
系统提示messages 里 role=system独立参数 instructions
多模态输入content 数组中 image_urlinput 数组中 input_image
工具定义tools: [{ function: {...} }] 嵌套一层tools: [{ type: "web_search" }] 内置工具扁平化
输出读取choices[0].message.content遍历 output 数组按类型取块
适用场景简单对话、兼容存量生态多轮 Agent、工具编排、需要持久化会话