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-4o (文本转文本 (Response))

来源: https://docs.surgeai.one/docs/allapi/OpenAI/gpt-4o/official-format/text-to-text-response
使用 responses API 生成文本响应

OpenAI 文本转文本 API 的官方格式(response)。

身份验证#

1.
在 https://surgeai.one 注册 SurgeAI 账户
2.
进入控制台的 API Keys 部分
3.
生成新的 API 密钥 (sk-xxxxx)
4.
复制并安全存储您的 API 密钥

端点#

POST /v1/responses

cURL 示例#

成功响应 (200)#

{
  "id": "resp-abc123",
  "object": "response",
  "created": 1699896916,
  "model": "gpt-4.1-2025-04-14",
  "output": "# Document Analysis Summary\n\n## Key Information:\n- Document Type: Financial Report Q3 2024\n- Total Pages: 45\n- Date: September 30, 2024\n\n## Main Topics:\n1. **Revenue Growth**: The company reported a 23% increase in quarterly revenue, reaching $4.2 billion\n2. **Market Expansion**: Successfully entered three new international markets in Asia-Pacific region\n3. **Product Innovation**: Launched two major product lines with positive customer reception\n4. **Operational Efficiency**: Reduced operational costs by 15% through process optimization\n\n## Financial Highlights:\n- Total Revenue: $4.2B (↑23% YoY)\n- Net Income: $850M (↑18% YoY)\n- Operating Margin: 28.5%\n- Cash Flow: $1.1B positive\n\n## Strategic Initiatives:\n- Investment in R&D increased by 30%\n- New partnership agreements with 5 major technology companies\n- Sustainability goals on track with 40% reduction in carbon emissions\n\n## Future Outlook:\nThe company maintains a positive outlook for Q4 2024, projecting continued growth driven by strong product demand and market expansion efforts.",
  "usage": {
    "prompt_tokens": 3500,
    "completion_tokens": 245,
    "total_tokens": 3745
  }
}

错误响应#

401 - 未授权 / API 密钥缺失或无效
403 - 禁止访问 / 您的 API 密钥没有权限或余额不足
429 - 请求过多 / 您已超出速率限制
500 - 服务器内部错误
503 - 内容策略违规

核心参数#

参数类型必填默认值范围描述
modelstring是--用于生成响应的模型 ID,如 gpt-4o 或 o3。
inputstring/array是--模型的输入内容。
input.rolestring是-user、assistant、system、developer消息输入的角色。
input.contentstring/array是--字符串时为模型的文本输入;数组时为包含不同内容类型的一个或多个输入项列表。

高级参数#

参数类型必填默认值范围描述
streamboolean否falsetrue、false是否以增量方式流式返回响应。默认为 false。
max_output_tokensinteger否--响应可生成的 token 数量上限,包括可见的输出 token 和推理 token。
reasoningobject否--推理模型的配置选项(仅限 gpt-5 和 o 系列模型)。
reasoning.effortstring否mediumnone、minimal、low、medium、high、xhigh限制推理模型的推理投入程度。
reasoning.summarystring否-auto、concise、detailed模型执行的推理摘要。
toolsarray否--模型可能调用的工具列表。

多模态输入#

参数类型必填默认值范围 / 示例描述
content.typestring是—input_text、input_image、input_file标识多模态输入的内容块类型。
content.textstring否—-模型的文本输入。
content.file_idstring否--要发送给模型的文件 ID。
content.detailstring否autohigh、low、auto图像的细节级别。仅当 type=input_image 时需要。
content.image_urlstring否--图像的 URL。仅当 type=input_image 时需要。
content.file_urlstring否--文件的 URL。仅当 type=input_file 时需要。
content.file_datastring否--文件的内容。仅当 type=input_file 时需要。
content.filenamestring否--文件的名称。仅当 type=input_file 时需要。

模型特定的 reasoning.effort 配置#

限制推理模型的推理投入程度:
gpt-5.1: 默认为 none(无推理)。支持的值: none、low、medium、high。所有推理值都支持工具调用。
gpt-5.1 之前的模型: 默认为 medium 推理投入,不支持 none。
gpt-5-pro: 默认且仅支持 high 推理投入。
xhigh: 支持 gpt-5.1-codex-max 之后的所有模型。
修改于 2026-03-11 06:24:05
上一页
gpt-4o (网络搜索 (Response))
下一页
gpt-4o (文本转文本 (Chat))
Built with