input[].content 数组,图片用 input_image,文件用 input_file。来源三选一:base64(file_data / image_url 用 data URI)、URL(image_url / file_url)、Files API 上传后的 file_id。兼容性:base64 最通用最稳;外链由网关拉取,部分逆向上游可能不支持; file_id需先调用/v1/files上传接口拿到 ID。
{
"model": "gpt-4o",
"input": [
{
"role": "user",
"content": [
{ "type": "input_text", "text": "这张图里有什么?" },
{ "type": "input_image", "image_url": "https://example.com/a.png" }
]
}
]
}{
"model": "gpt-4o",
"input": [
{
"role": "user",
"content": [
{ "type": "input_text", "text": "这张图里有什么?" },
{ "type": "input_image", "image_url": "data:image/png;base64,<BASE64>" }
]
}
]
}input_image 也可用 { "type": "input_image", "file_id": "file-xxx" } 引用已上传文件。{
"model": "gpt-4o",
"input": [
{
"role": "user",
"content": [
{ "type": "input_text", "text": "总结这份文件" },
{ "type": "input_file", "filename": "a.pdf", "file_data": "data:application/pdf;base64,<BASE64>" }
]
}
]
}{
"model": "gpt-4o",
"input": [
{
"role": "user",
"content": [
{ "type": "input_text", "text": "总结这份文件" },
{ "type": "input_file", "file_id": "file-xxx" }
]
}
]
}input_file 也支持 { "type": "input_file", "file_url": "https://example.com/a.pdf" } 形式传外链。curl --location 'https://api.openai-hub.net/v1/responses' \
--header 'Authorization: Bearer sk-0ABIEXVjh9****Qckjy' \
--header 'Content-Type: application/json' \
--data '{
"model": "string",
"input": "string",
"instructions": "string",
"max_output_tokens": 0,
"temperature": 0,
"top_p": 0,
"stream": true,
"tools": [
{}
],
"tool_choice": "string",
"reasoning": {
"effort": "low",
"summary": "string"
},
"previous_response_id": "string",
"truncation": "auto"
}'{
"id": "string",
"object": "response",
"created_at": 0,
"status": "completed",
"model": "string",
"output": [
{
"type": "string",
"id": "string",
"status": "string",
"role": "string",
"content": [
{
"type": "string",
"text": "string"
}
]
}
],
"usage": {
"prompt_tokens": 0,
"completion_tokens": 0,
"total_tokens": 0,
"prompt_tokens_details": {
"cached_tokens": 0,
"text_tokens": 0,
"audio_tokens": 0,
"image_tokens": 0
},
"completion_tokens_details": {
"text_tokens": 0,
"audio_tokens": 0,
"reasoning_tokens": 0
}
}
}