SurgeAI
  1. official-format
SurgeAI
  • SurgeAI
    • SurgeAI核心优势
    • 快速开始
    • 认证
    • 如何使用
      • OpenClaw
      • Codex
      • 聊天应用
      • Claude Code
      • Dify
    • API参考
      • OpenAI
        • gpt-5
          • official-format
            • gpt-5 (网络搜索 (Response))
            • gpt-5 (文本转文本)
            • gpt-5 (文本转文本)
            • gpt-5 (图像转文本 (Chat))
            • gpt-5 (图像转文本 (Response))
            • gpt-5 (文件分析)
        • gpt-4o
          • official-format
            • gpt-4o (网络搜索 (Response))
            • gpt-4o (文本转文本 (Response))
            • gpt-4o (文本转文本 (Chat))
            • gpt-4o (图像转文本 (Chat))
            • gpt-4o (图像转文本 (Response))
            • gpt-4o (文件分析 (Response))
        • gpt-4.1
          • official-format
            • gpt-4.1 (联网搜索)
            • gpt-4.1 (文本转文本)
            • gpt-4.1 (文本转文本)
            • gpt-4.1 (图像分析)
            • gpt-4.1 (图像分析)
            • gpt-4.1 (文件分析)
      • Vidu
        • viduq3-pro
          • gptproto-format
            • viduq3-pro (Image To Video)
            • viduq3-pro (Text To Video)
        • viduq2-pro
          • gptproto-format
            • viduq2-pro (Image To Video)
            • viduq2-pro (Text To Video)
      • Suno
        • suno-music
          • official-format
            • official-format (查询任务)
            • official-format (文本转音频)
      • Midjourney
        • Midjourney
          • task-submission
            • midjourney (imagine)
          • task-query
            • midjourney (fetchfromtask)
      • Grok
        • grok-3
          • openai-format
            • grok-3 (文本转文本 (聊天))
        • grok-4
          • openai-format
            • grok-4 (文本转文本 (聊天))
      • DeepSeek
        • deepseek-v3.2
          • openai-format
            • deepseek-v3.2 (文本转文本)
      • Alibaba
        • qwen-plus
          • openai-format
            • qwen-plus (文本转文本)
        • qwen3-max
          • openai-format
            • qwen3-max (文本转文本)
        • wan-2.5-preview
          • gptproto-format
            • wan-2.5-preview (图片编辑)
            • wan-2.5-preview (查询任务)
            • wan-2.5-preview (图生视频)
            • wan-2.5-preview (文生图)
            • wan-2.5-preview (文生视频)
        • qwen-turbo
          • openai-format
            • qwen-turbo (文本转文本)
      • MiniMax
        • hailuo-02-pro
          • gptproto-format
            • hailuo-02-pro (图生视频)
            • hailuo-02-pro (文生视频)
      • Kling
        • kling-v2.1-pro
          • gptproto-format
            • kling-v2.1-pro (图生视频)
            • kling-v2.1-pro (文生视频)
        • kling-v3.0-pro
          • gptproto-format
            • kling-v3.0-pro (图生视频)
            • kling-v3.0-pro (文生视频)
      • Claude
        • claude-haiku-4-5-20251001
          • official-format
            • claude-haiku-4-5-20251001 (联网搜索)
            • claude-haiku-4-5-20251001 (文件分析)
            • claude-haiku-4-5-20251001 (文本生成)
          • openai-format
            • claude-haiku-4-5-20251001 (联网搜索)
            • claude-haiku-4-5-20251001 (文件分析)
            • claude-haiku-4-5-20251001 (文本生成)
      • Google
        • gemini-2.5-flash
          • official-format
            • gemini-2.5-flash (联网搜索)
            • gemini-2.5-flash (文件分析)
            • gemini-2.5-flash (文本生成)
            • gemini-2.5-flash (图像理解)
        • gemini-2.5-pro
          • official-format
            • gemini-2.5-pro (联网搜索)
            • gemini-2.5-pro (文件分析)
            • gemini-2.5-pro (文本生成)
            • gemini-2.5-pro (图像理解)
      • Runway
        • runwayml-gen3a_turbo-5
          • official-format
            • official-format (提交视频生成任务)
            • official-format (查询任务)
  1. official-format

gpt-4.1 (图像分析)

来源: https://docs.surgeai.one/docs/allapi/OpenAI/gpt-4.1/official-format/image-to-text-response
使用支持视觉的模型分析和理解图像内容

OpenAI 图像分析 API 的官方格式(chat)。

端点#

POST /v1/chat/completions

cURL 示例#

成功响应 (200)#

{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "created": 1699896916,
  "model": "gpt-4.1",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "The image shows a wooden boardwalk path extending through a lush green grassland. The boardwalk appears to lead toward a distant tree line under a bright blue sky with some clouds. The grass on either side of the boardwalk is vibrant green, suggesting it might be spring or summer. The scene has a peaceful, natural atmosphere with good visibility and sunny weather conditions."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 1250,
    "completion_tokens": 89,
    "total_tokens": 1339
  }
}

错误响应#

401 - 无效签名
403 - 余额不足
500 - 服务器内部错误
503 - 内容策略违规

请求体#

参数类型必填默认值描述
modelstring是gpt-4.1请求使用的模型
messagesarray是-对话的消息对象数组
streamboolean否false是否流式返回响应

消息数组结构#

messages 数组中的每个消息对象应具有以下结构:
字段类型必填描述
rolestring是消息的角色。可以是: user、assistant 或 system
contentarray是内容对象数组(可包含文本和图像)

内容数组项#

content 数组可以包含多种不同类型的项:

文本内容#

字段类型必填示例描述
typestring是"text"文本内容必须为 text
textstring是"What is in this image?"文本提示或问题

图像 URL 内容#

字段类型必填示例描述
typestring是"image_url"图像内容必须为 image_url
image_urlobject是见下方包含图像 URL 的对象
image_url.urlstring是"https://example.com/image.jpg"要分析的图像 URL
修改于 2026-03-11 06:24:05
上一页
gpt-4.1 (图像分析)
下一页
gpt-4.1 (文件分析)
Built with