Skip to content

GPT 5.6 Luna ​

本页由 ModelFold 文档站根据上游官方 OpenAPI 文档同步生成。接口路径、参数、示例与官方保持一致;品牌与 API 域名已替换为 ModelFold。

接口 ​

POST /codex/v1/responses

完整 URL: https://ai.modelfold.online/codex/v1/responses

鉴权:所有请求都需要 Authorization: Bearer <API_KEY> 请求头。

GPT 5.6 Luna ​

GPT 5.6 Luna 通过兼容 OpenAI Responses 协议的端点提供(input/output 结构,流式为 response.* 事件)。

上下文窗口:272K token。响应中的 model 字段使用点号写法(如 gpt-5.6-sol),请求时两种写法都可以。可用 GET /openai/v1/models 查询当前可用型号。

  • 多模态输入 — 支持在单条消息中混合文本、图像和文件输入。

  • 推理控制 — 推理强度可从最低调整到最高。

  • 工具与网页搜索 — 集成网页搜索或自定义函数调用工具。

  • 统一端点 — 使用统一的 /codex/v1/responses 端点, model 参数设置为 gpt-5-6-luna 。

工具与工具选择 ​

tools 数组启用了网页搜索或函数调用功能。

WARNING

网页搜索与函数调用是互斥的。
在单次请求中只能选择其一:不要在同一个 tools 数组中同时包含 {"type": "web_search"} 和 {"type": "function", ...}。

网页搜索

使用内置的网页搜索工具获取最新信息:

json
{
  "tools": [
    {
      "type": "web_search"
    }
  ]
}

函数调用

定义模型需要时可调用的业务函数:

json
{
  "tools": [
    {
      "type": "function",
      "name": "get_current_weather",
      "description": "获取指定地点的当前天气",
      "parameters": {
        "type": "object",
        "properties": {
          "location": {
            "type": "string",
            "description": "城市和州名,例如 San Francisco, CA"
          },
          "unit": {
            "type": "string",
            "enum": ["celsius", "fahrenheit"]
          }
        },
        "required": ["location", "unit"]
      }
    }
  ],
  "tool_choice": "auto"
}

当配置函数工具时,将 tool_choice 设为 "auto" 让模型自主决定调用时机。
如果未配置任何函数工具,请省略 tool_choice 字段。

错误处理 ​

请检查响应体,不要只看 HTTP 状态码。错误有两种形态:{"code": ..., "msg": "..."}(如 401 API key 无效、402 积分不足、429 频率超限;HTTP 状态可能仍为 200),或 {"error": {"type": "...", "message": "..."}}。

请求参数 ​

请求体 (application/json) ​

参数类型必填说明
modelstring是目标模型名称。可选值:gpt-5-6-luna。 默认值:"gpt-5-6-luna"。 可选值:gpt-5-6-luna。 示例:gpt-5-6-luna。
streamboolean否默认 true,以 SSE 流式返回;设为 false 时生成结束后一次性返回 JSON。 默认值:true。 示例:true。
input`stringarray<object>`是
reasoningobject否模型推理配置。
  reasoning.effortstring否推理强度:low、medium、high、xhigh、max,默认 medium。 默认值:"medium"。 可选值:low / medium / high / xhigh / max。 示例:low。
tools`array<objectobject>`否
tool_choicestring否工具选择行为。当在 tools 中配置了函数调用工具时,将其设置为 auto,让模型自动决定何时调用函数。 示例:auto。
textobject否text.format:{"type":"json_schema","name":"...","strict":true,"schema":{...}},输出按你给的 JSON Schema 返回。
  text.formatobject是输出格式定义
    text.format.typestring是固定值 json_schema
    text.format.namestring是Schema 名称,用于标识该 schema
    text.format.strictboolean是是否启用严格模式。为 true 时输出必须严格符合 schema 定义
    text.format.schemaobject是输出对象的 JSON Schema,例如 {"type":"object","properties":{"answer":{"type":"string"}},"required":["answer"],"additionalProperties":false}。

请求示例 ​

bash
curl -X POST "https://ai.modelfold.online/codex/v1/responses" \
  -H "Authorization: Bearer $MODELFOLD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "gpt-5-6-luna",
  "stream": false,
  "input": [
    {
      "role": "user",
      "content": [
        {
          "type": "input_text",
          "text": "What is in this image?"
        },
        {
          "type": "input_image",
          "image_url": "https://file.aiquickdraw.com/custom-page/akr/section-images/1759055072437dqlsclj2.png"
        }
      ]
    }
  ],
  "tools": [
    {
      "type": "web_search"
    }
  ],
  "reasoning": {
    "effort": "high"
  }
}'
json
{
  "model": "gpt-5-6-luna",
  "stream": false,
  "input": [
    {
      "role": "user",
      "content": [
        {
          "type": "input_text",
          "text": "What is in this image?"
        },
        {
          "type": "input_image",
          "image_url": "https://file.aiquickdraw.com/custom-page/akr/section-images/1759055072437dqlsclj2.png"
        }
      ]
    }
  ],
  "tools": [
    {
      "type": "web_search"
    }
  ],
  "reasoning": {
    "effort": "high"
  }
}

响应 ​

200 — 请求成功。 ​

json
"{\n  \"output\": [\n    {\n      \"type\": \"reasoning\",\n      \"id\": \"rs_xxx\",\n      \"summary\": []\n    },\n    {\n      \"type\": \"message\",\n      \"role\": \"assistant\",\n      \"id\": \"msg_xxx\",\n      \"content\": [\n        {\n          \"type\": \"output_text\",\n          \"text\": \"Hello! How can I help you today?\"\n        }\n      ],\n      \"status\": \"completed\"\n    }\n  ],\n  \"usage\": {\n    \"total_tokens\": 4490,\n    \"output_tokens\": 47,\n    \"input_tokens\": 4443\n  },\n  \"credits_consumed\": 0.48,\n  \"status\": \"completed\"\n}"

400 — 错误请求 - 无效的请求参数 ​

参数类型必填说明
errorobject否—
  error.messagestring否示例:无效的请求参数。
  error.typestring否示例:invalid_request_error。
json
{
  "error": {
    "message": "无效的请求参数",
    "type": "invalid_request_error"
  }
}

401 — 未授权 - 无效或缺少 API key ​

参数类型必填说明
errorobject否—
  error.messagestring否示例:未授权。
  error.typestring否示例:authentication_error。
json
{
  "error": {
    "message": "未授权",
    "type": "authentication_error"
  }
}

429 — 速率限制 - 请求过多 ​

参数类型必填说明
errorobject否—
  error.messagestring否示例:超出速率限制。
  error.typestring否示例:rate_limit_error。
json
{
  "error": {
    "message": "超出速率限制",
    "type": "rate_limit_error"
  }
}

500 — 服务器错误 ​

ModelFold — 一个 API,接入所有主流 AI 模型。