# GPT-6 Luna — Scenepond API

模型 ID: `gpt-6-luna`

模型开发者: OpenAI

原始页面: https://open.scenepond.ai/zh/models/gpt-6-luna#api

核对日期: 2026-10-21

API 地址: `https://open.scenepond.ai/v1`

每次请求使用 Authorization: Bearer 和 Scenepond API Key 认证；密钥保存在服务器。

## 对话补全

`POST /v1/chat/completions`

### 请求参数

- `model` — **必填**; `string`. 使用此处公布的完整模型 ID。
  - 约束: gpt-6-luna

- `messages` — **必填**; `object[]`. 按顺序发送对话历史。
  - 约束: 至少一条消息

### messages 中的字段

仅在提供 messages 时适用；子字段必填不代表可选的父字段也必填。

- `messages[].role` — **必填**; `string`. 消息作者的角色。
  - 约束: developer; system; user; assistant; tool

- `messages[].content` — **条件必填**; `string | object[] | null`. 消息文本、图片、PDF 或助手拒绝内容。
  - assistant 的 content 可为 null；请保留原始拒绝内容或工具调用。
  - developer、system、user 和 tool 消息必填。

### messages[].content 中的字段

仅在提供 messages[].content 时适用；子字段必填不代表可选的父字段也必填。

- `messages[].content[].type` — **必填**; `string`. 内容项类型。
  - developer、system 和 tool 消息仅接受 text 内容。user 消息接受 text、image_url 或 file；assistant 历史消息接受 text 或 refusal。
  - 约束: text; image_url; file; refusal

- `messages[].content[].text` — **条件必填**; `string`. 文本内容。
  - text 内容项必须提供。

- `messages[].content[].image_url` — **条件必填**; `object`. 图片内容。
  - image_url 图片片段必填。

### messages[].content[].image_url 中的字段

仅在提供 messages[].content[].image_url 时适用；子字段必填不代表可选的父字段也必填。

- `messages[].content[].image_url.url` — **必填**; `string`. 图片 URL 或 Base64 图片数据 URL。

- `messages[].content[].image_url.detail` — **可选**; `string`. 选择图片细节级别。
  - 默认: `"auto"`
  - 约束: auto; low; high


- `messages[].content[].file` — **条件必填**; `object`. 用户消息中的 PDF 输入。
  - 每个 PDF 必须小于 50 MB；每次请求的文件总量不得超过 50 MB。
  - 文件内容片段必填。

### messages[].content[].file 中的字段

仅在提供 messages[].content[].file 时适用；子字段必填不代表可选的父字段也必填。

- `messages[].content[].file.file_data` — **可选**; `string`. Base64 编码的 PDF 数据，需同时提供文件名。
  - 使用 file_data 或已有的上游 file_id。

- `messages[].content[].file.file_id` — **可选**; `string`. 执行请求的上游账户中已有的文件 ID。
  - 使用 file_data 或 file_id；网关没有文件上传接口。

- `messages[].content[].file.filename` — **可选**; `string`. PDF 文件名。
  - 与内嵌的 file_data 一起使用。


- `messages[].content[].refusal` — **条件必填**; `string`. 助手返回的拒绝文本。
  - 助手拒绝内容必须提供。

- `messages[].content[].prompt_cache_breakpoint` — **可选**; `object`. 标记可复用提示词前缀的精确结束位置。
  - 仅用于 text、image_url 或 file 输入内容项。

### messages[].content[].prompt_cache_breakpoint 中的字段

仅在提供 messages[].content[].prompt_cache_breakpoint 时适用；子字段必填不代表可选的父字段也必填。

- `messages[].content[].prompt_cache_breakpoint.mode` — **必填**; `string`. 显式缓存断点模式。
  - 约束: explicit



- `messages[].tool_call_id` — **条件必填**; `string`. 使用先前的函数调用 ID 关联工具回复。
  - 工具回复必填。

- `messages[].name` — **可选**; `string`. 消息作者的可选名称。
  - 用于 developer、system、user 或 assistant 消息。

- `messages[].refusal` — **可选**; `string | null`. 助手返回的拒绝文本。
  - 用于回放先前响应中的助手消息。

- `messages[].tool_calls` — **可选**; `object[]`. 重放先前的助手函数调用，并保留原始调用 ID。
  - 用于助手发出的函数调用消息，且 reasoning_effort 必须显式设为 none。

### messages[].tool_calls 中的字段

仅在提供 messages[].tool_calls 时适用；子字段必填不代表可选的父字段也必填。

- `messages[].tool_calls[].id` — **必填**; `string`. 函数调用 ID。

- `messages[].tool_calls[].type` — **必填**; `string`. 工具类型。
  - 约束: function

- `messages[].tool_calls[].function` — **必填**; `object`. 先前的函数调用。

### messages[].tool_calls[].function 中的字段

仅在提供 messages[].tool_calls[].function 时适用；子字段必填不代表可选的父字段也必填。

- `messages[].tool_calls[].function.name` — **必填**; `string`. 函数名称。

- `messages[].tool_calls[].function.arguments` — **必填**; `string`. 经过 JSON 编码的函数参数字符串。




- `stream` — **可选**; `boolean | null`. 设为 true 时返回 SSE 事件流；false 或 null 返回非流式响应。

- `metadata` — **可选**; `object | null`. 为请求附加字符串类型的元数据。
  - 约束: 最多 16 组键值对；键最长 64 个字符，字符串值最长 512 个字符。

- `store` — **可选**; `boolean | null`. 控制对话补全的存储。上游会默认存储新账号的补全结果；请显式设置 store 来指定存储策略。

- `prompt_cache_key` — **可选**; `string | null`. 将共享可复用提示词前缀的请求归为一组。

- `prompt_cache_options` — **可选**; `object`. 配置提示词缓存。

### prompt_cache_options 中的字段

仅在提供 prompt_cache_options 时适用；子字段必填不代表可选的父字段也必填。

- `prompt_cache_options.ttl` — **可选**; `string`. 缓存的最短保留时间。
  - 默认: `"30m"`
  - 约束: 30m

- `prompt_cache_options.mode` — **可选**; `string`. 选择隐式或显式缓存断点。
  - 默认: `"implicit"`
  - 约束: implicit; explicit


- `stream_options` — **可选**; `object | null`. 配置流式响应选项。
  - 仅在 stream = true 时使用。

### stream_options 中的字段

仅在提供 stream_options 时适用；子字段必填不代表可选的父字段也必填。

- `stream_options.include_usage` — **可选**; `boolean`. 在响应流末尾返回用量块。即使请求传入 false，网关仍可能强制返回用量信息。


- `reasoning_effort` — **可选**; `string | null`. 选择本次请求的推理强度。
  - 默认: `"medium"`
  - 约束: none; low; medium; high; xhigh; max

- `max_completion_tokens` — **可选**; `integer | null`. 限制生成的 Token 总数，包括推理 Token。
  - 约束: 最大值: 128000

- `verbosity` — **可选**; `string | null`. 选择回答的详细程度。
  - 默认: `"medium"`
  - 约束: low; medium; high

- `response_format` — **可选**; `object`. 配置文本或结构化 JSON 输出。

### response_format 中的字段

仅在提供 response_format 时适用；子字段必填不代表可选的父字段也必填。

- `response_format.type` — **必填**; `string`. 输出格式。
  - 约束: text; json_object; json_schema

- `response_format.json_schema` — **条件必填**; `object`. 命名的输出 Schema，可启用严格校验。
  - type 为 json_schema 时必填。

### response_format.json_schema 中的字段

仅在提供 response_format.json_schema 时适用；子字段必填不代表可选的父字段也必填。

- `response_format.json_schema.name` — **必填**; `string`. 输出结构名称。
  - 约束: 最多字符数: 64; 仅可使用 ASCII 英文字母、数字、下划线（_）或连字符（-）。

- `response_format.json_schema.description` — **可选**; `string`. 描述期望的结构化输出。

- `response_format.json_schema.schema` — **可选**; `object`. 结构化输出使用的 JSON Schema。

- `response_format.json_schema.strict` — **可选**; `boolean | null`. 启用严格模式，使结果符合受支持的 JSON Schema 子集。



- `temperature` — **可选**; `number | null`. 调整采样的随机性。
  - 仅在显式将 reasoning_effort 设为 none 时支持。
  - 约束: 最小值: 0; 最大值: 2

- `top_p` — **可选**; `number | null`. 调整核采样参数；通常与 temperature 二选一。
  - 仅在显式将 reasoning_effort 设为 none 时支持。
  - 约束: 最小值: 0; 最大值: 1

- `logprobs` — **可选**; `boolean | null`. 返回输出 Token 的对数概率。
  - 仅在显式将 reasoning_effort 设为 none 时支持。

- `top_logprobs` — **可选**; `integer | null`. 返回各输出位置最可能出现的 Token。
  - 仅在显式将 reasoning_effort 设为 none 时支持，且必须同时设置 logprobs = true。
  - 约束: 最小值: 0; 最大值: 20

- `tools` — **可选**; `object[]`. 声明可用工具；函数调用由你的应用执行。
  - 仅在显式将 reasoning_effort 设为 none 时支持。

### tools 中的字段

仅在提供 tools 时适用；子字段必填不代表可选的父字段也必填。

- `tools[].type` — **必填**; `string`. 工具类型。
  - 约束: function

- `tools[].function` — **必填**; `object`. Chat Completions 的函数定义。

### tools[].function 中的字段

仅在提供 tools[].function 时适用；子字段必填不代表可选的父字段也必填。

- `tools[].function.name` — **必填**; `string`. 函数或命名空间名称。
  - 约束: 最多字符数: 64; 仅可使用 ASCII 英文字母、数字、下划线（_）或连字符（-）。

- `tools[].function.description` — **可选**; `string`. 说明应在何时调用该函数。

- `tools[].function.parameters` — **可选**; `object`. 定义函数参数的 JSON Schema。

- `tools[].function.strict` — **可选**; `boolean | null`. 启用严格模式，使结果符合受支持的 JSON Schema 子集。
  - 默认: `false`



- `tool_choice` — **可选**; `string | object`. 选择自动调用、必须调用、禁用调用，或指定函数。
  - 仅在 reasoning_effort 显式设为 none 时支持。省略 tool_choice 时，上游在未声明工具时使用 none，已声明工具时使用 auto。
  - 约束: none; auto; 必填

### tool_choice 中的字段

仅在提供 tool_choice 时适用；子字段必填不代表可选的父字段也必填。

- `tool_choice.type` — **必填**; `string`. 工具选择对象类型。
  - 约束: function; allowed_tools

- `tool_choice.function` — **条件必填**; `object`. 指定要调用的函数。
  - type 为 function 时必填。

### tool_choice.function 中的字段

仅在提供 tool_choice.function 时适用；子字段必填不代表可选的父字段也必填。

- `tool_choice.function.name` — **必填**; `string`. 函数名称。


- `tool_choice.allowed_tools` — **条件必填**; `object`. 将调用限制在已声明函数的指定子集中。
  - type 为 allowed_tools 时必填。

### tool_choice.allowed_tools 中的字段

仅在提供 tool_choice.allowed_tools 时适用；子字段必填不代表可选的父字段也必填。

- `tool_choice.allowed_tools.mode` — **必填**; `string`. 选择如何使用允许的工具子集。
  - 约束: auto; 必填

- `tool_choice.allowed_tools.tools` — **必填**; `object[]`. 允许使用的工具引用，函数名称结构需与当前协议一致。

### tool_choice.allowed_tools.tools 中的字段

仅在提供 tool_choice.allowed_tools.tools 时适用；子字段必填不代表可选的父字段也必填。

- `tool_choice.allowed_tools.tools[].type` — **必填**; `string`. 允许调用的工具引用类型。
  - 约束: function

- `tool_choice.allowed_tools.tools[].function` — **必填**; `object`. 指定要调用的函数。

### tool_choice.allowed_tools.tools[].function 中的字段

仅在提供 tool_choice.allowed_tools.tools[].function 时适用；子字段必填不代表可选的父字段也必填。

- `tool_choice.allowed_tools.tools[].function.name` — **必填**; `string`. 函数名称。





- `parallel_tool_calls` — **可选**; `boolean`. 允许在一轮中发起多个函数调用。
  - 仅在显式将 reasoning_effort 设为 none 时支持。

<details>
<summary>兼容参数</summary>

- `prompt_cache_retention` — **可选**; `string | null`. 已弃用的缓存保留策略；最低缓存有效期请使用 prompt_cache_options.ttl。
  - 约束: 24h

- `user` — **可选**; `string | null`. 已弃用的用户标识；缓存分组请使用 prompt_cache_key。当前渠道尚未开放 safety_identifier。

- `max_tokens` — **可选**; `integer | null`. 网关兼容的已弃用 max_completion_tokens 别名。
  - 用于替代 max_completion_tokens，请勿同时传入。
  - 约束: 最大值: 128000

</details>

### 最小调用

#### cURL

```bash
curl --fail-with-body -X POST "https://open.scenepond.ai/v1/chat/completions" \
  -H "Authorization: Bearer $SCENEPOND_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @- <<'JSON'
{
  "model": "gpt-6-luna",
  "messages": [
    {
      "role": "user",
      "content": "Hello!"
    }
  ],
  "reasoning_effort": "medium",
  "stream": false
}
JSON
```

#### Python

```python
import os
import json
from urllib.parse import quote
from urllib.request import Request, urlopen

payload = json.loads("{\n  \"model\": \"gpt-6-luna\",\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": \"Hello!\"\n    }\n  ],\n  \"reasoning_effort\": \"medium\",\n  \"stream\": false\n}")

request = Request(
    "https://open.scenepond.ai/v1/chat/completions",
    headers={
        "Authorization": "Bearer " + os.environ["SCENEPOND_API_KEY"],
        "Content-Type": "application/json",
    },
    data=json.dumps(payload).encode("utf-8"),
    method="POST",
)
with urlopen(request) as response:
    result = json.load(response)
print(json.dumps(result, indent=2))
```

#### JavaScript

```javascript
const response = await fetch("https://open.scenepond.ai/v1/chat/completions", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.SCENEPOND_API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
  "model": "gpt-6-luna",
  "messages": [
    {
      "role": "user",
      "content": "Hello!"
    }
  ],
  "reasoning_effort": "medium",
  "stream": false
})
});
if (!response.ok) throw new Error(`API error: ${response.status} ${await response.text()}`);
const result = await response.json();
console.log(result);
```

### 可选参数示例

#### 包含可选参数的流式请求 1

##### cURL

```bash
curl --fail-with-body --no-buffer -X POST "https://open.scenepond.ai/v1/chat/completions" \
  -H "Authorization: Bearer $SCENEPOND_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @- <<'JSON'
{
  "model": "gpt-6-luna",
  "messages": [
    {
      "role": "developer",
      "content": "Describe the image in one sentence. Return JSON with an answer field."
    },
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "What is shown in this image?"
        },
        {
          "type": "image_url",
          "image_url": {
            "url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg"
          }
        }
      ]
    }
  ],
  "reasoning_effort": "medium",
  "max_completion_tokens": 1024,
  "verbosity": "low",
  "response_format": {
    "type": "json_schema",
    "json_schema": {
      "name": "answer",
      "description": "A short answer.",
      "strict": true,
      "schema": {
        "type": "object",
        "properties": {
          "answer": {
            "type": "string"
          }
        },
        "required": [
          "answer"
        ],
        "additionalProperties": false
      }
    }
  },
  "stream": true,
  "stream_options": {
    "include_usage": true
  },
  "store": false,
  "metadata": {
    "example": "structured-output"
  },
  "prompt_cache_key": "image-description-v1",
  "prompt_cache_options": {
    "ttl": "30m",
    "mode": "implicit"
  }
}
JSON
```

##### Python

```python
import os
import json
import sys
from urllib.parse import quote
from urllib.request import Request, urlopen

payload = json.loads("{\n  \"model\": \"gpt-6-luna\",\n  \"messages\": [\n    {\n      \"role\": \"developer\",\n      \"content\": \"Describe the image in one sentence. Return JSON with an answer field.\"\n    },\n    {\n      \"role\": \"user\",\n      \"content\": [\n        {\n          \"type\": \"text\",\n          \"text\": \"What is shown in this image?\"\n        },\n        {\n          \"type\": \"image_url\",\n          \"image_url\": {\n            \"url\": \"https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg\"\n          }\n        }\n      ]\n    }\n  ],\n  \"reasoning_effort\": \"medium\",\n  \"max_completion_tokens\": 1024,\n  \"verbosity\": \"low\",\n  \"response_format\": {\n    \"type\": \"json_schema\",\n    \"json_schema\": {\n      \"name\": \"answer\",\n      \"description\": \"A short answer.\",\n      \"strict\": true,\n      \"schema\": {\n        \"type\": \"object\",\n        \"properties\": {\n          \"answer\": {\n            \"type\": \"string\"\n          }\n        },\n        \"required\": [\n          \"answer\"\n        ],\n        \"additionalProperties\": false\n      }\n    }\n  },\n  \"stream\": true,\n  \"stream_options\": {\n    \"include_usage\": true\n  },\n  \"store\": false,\n  \"metadata\": {\n    \"example\": \"structured-output\"\n  },\n  \"prompt_cache_key\": \"image-description-v1\",\n  \"prompt_cache_options\": {\n    \"ttl\": \"30m\",\n    \"mode\": \"implicit\"\n  }\n}")

request = Request(
    "https://open.scenepond.ai/v1/chat/completions",
    headers={
        "Authorization": "Bearer " + os.environ["SCENEPOND_API_KEY"],
        "Content-Type": "application/json",
    },
    data=json.dumps(payload).encode("utf-8"),
    method="POST",
)
with urlopen(request) as response:
    for line in response:
        sys.stdout.buffer.write(line)
        sys.stdout.buffer.flush()
```

##### JavaScript

```javascript
const response = await fetch("https://open.scenepond.ai/v1/chat/completions", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.SCENEPOND_API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
  "model": "gpt-6-luna",
  "messages": [
    {
      "role": "developer",
      "content": "Describe the image in one sentence. Return JSON with an answer field."
    },
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "What is shown in this image?"
        },
        {
          "type": "image_url",
          "image_url": {
            "url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg"
          }
        }
      ]
    }
  ],
  "reasoning_effort": "medium",
  "max_completion_tokens": 1024,
  "verbosity": "low",
  "response_format": {
    "type": "json_schema",
    "json_schema": {
      "name": "answer",
      "description": "A short answer.",
      "strict": true,
      "schema": {
        "type": "object",
        "properties": {
          "answer": {
            "type": "string"
          }
        },
        "required": [
          "answer"
        ],
        "additionalProperties": false
      }
    }
  },
  "stream": true,
  "stream_options": {
    "include_usage": true
  },
  "store": false,
  "metadata": {
    "example": "structured-output"
  },
  "prompt_cache_key": "image-description-v1",
  "prompt_cache_options": {
    "ttl": "30m",
    "mode": "implicit"
  }
})
});
if (!response.ok) throw new Error(`API error: ${response.status} ${await response.text()}`);
if (!response.body) throw new Error("Missing response stream");
const reader = response.body.getReader();
const decoder = new TextDecoder();
try {
  while (true) {
    const { value, done } = await reader.read();
    if (done) break;
    process.stdout.write(decoder.decode(value, { stream: true }));
  }
  process.stdout.write(decoder.decode());
} finally {
  await reader.cancel();
  reader.releaseLock();
}
```

#### 内嵌 PDF 输入 2

此示例内嵌一份完整的 PDF。Chat Completions 支持 PDF 的 file_data 或已有上游 file_id，不支持 file_url。

##### cURL

```bash
curl --fail-with-body -X POST "https://open.scenepond.ai/v1/chat/completions" \
  -H "Authorization: Bearer $SCENEPOND_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @- <<'JSON'
{
  "model": "gpt-6-luna",
  "reasoning_effort": "medium",
  "max_completion_tokens": 1024,
  "messages": [
    {
      "role": "user",
      "name": "reader",
      "content": [
        {
          "type": "text",
          "text": "What sentence is in this PDF?",
          "prompt_cache_breakpoint": {
            "mode": "explicit"
          }
        },
        {
          "type": "file",
          "file": {
            "filename": "sample.pdf",
            "file_data": "data:application/pdf;base64,JVBERi0xLjQKMSAwIG9iago8PCAvVHlwZSAvQ2F0YWxvZyAvUGFnZXMgMiAwIFIgPj4KZW5kb2JqCjIgMCBvYmoKPDwgL1R5cGUgL1BhZ2VzIC9LaWRzIFszIDAgUl0gL0NvdW50IDEgPj4KZW5kb2JqCjMgMCBvYmoKPDwgL1R5cGUgL1BhZ2UgL1BhcmVudCAyIDAgUiAvTWVkaWFCb3ggWzAgMCAzMDAgMTQ0XSAvUmVzb3VyY2VzIDw8IC9Gb250IDw8IC9GMSA0IDAgUiA+PiA+PiAvQ29udGVudHMgNSAwIFIgPj4KZW5kb2JqCjQgMCBvYmoKPDwgL1R5cGUgL0ZvbnQgL1N1YnR5cGUgL1R5cGUxIC9CYXNlRm9udCAvSGVsdmV0aWNhID4+CmVuZG9iago1IDAgb2JqCjw8IC9MZW5ndGggNTcgPj4Kc3RyZWFtCkJUIC9GMSAxMiBUZiAyMCAxMDAgVGQgKFNjZW5lcG9uZCBzYW1wbGUgZG9jdW1lbnQuKSBUaiBFVAplbmRzdHJlYW0KZW5kb2JqCnhyZWYKMCA2CjAwMDAwMDAwMDAgNjU1MzUgZiAKMDAwMDAwMDAwOSAwMDAwMCBuIAowMDAwMDAwMDU4IDAwMDAwIG4gCjAwMDAwMDAxMTUgMDAwMDAgbiAKMDAwMDAwMDI0MSAwMDAwMCBuIAowMDAwMDAwMzExIDAwMDAwIG4gCnRyYWlsZXIKPDwgL1NpemUgNiAvUm9vdCAxIDAgUiA+PgpzdGFydHhyZWYKNDE4CiUlRU9GCg=="
          }
        }
      ]
    }
  ],
  "prompt_cache_options": {
    "ttl": "30m",
    "mode": "explicit"
  }
}
JSON
```

##### Python

```python
import os
import json
from urllib.parse import quote
from urllib.request import Request, urlopen

payload = json.loads("{\n  \"model\": \"gpt-6-luna\",\n  \"reasoning_effort\": \"medium\",\n  \"max_completion_tokens\": 1024,\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"name\": \"reader\",\n      \"content\": [\n        {\n          \"type\": \"text\",\n          \"text\": \"What sentence is in this PDF?\",\n          \"prompt_cache_breakpoint\": {\n            \"mode\": \"explicit\"\n          }\n        },\n        {\n          \"type\": \"file\",\n          \"file\": {\n            \"filename\": \"sample.pdf\",\n            \"file_data\": \"data:application/pdf;base64,JVBERi0xLjQKMSAwIG9iago8PCAvVHlwZSAvQ2F0YWxvZyAvUGFnZXMgMiAwIFIgPj4KZW5kb2JqCjIgMCBvYmoKPDwgL1R5cGUgL1BhZ2VzIC9LaWRzIFszIDAgUl0gL0NvdW50IDEgPj4KZW5kb2JqCjMgMCBvYmoKPDwgL1R5cGUgL1BhZ2UgL1BhcmVudCAyIDAgUiAvTWVkaWFCb3ggWzAgMCAzMDAgMTQ0XSAvUmVzb3VyY2VzIDw8IC9Gb250IDw8IC9GMSA0IDAgUiA+PiA+PiAvQ29udGVudHMgNSAwIFIgPj4KZW5kb2JqCjQgMCBvYmoKPDwgL1R5cGUgL0ZvbnQgL1N1YnR5cGUgL1R5cGUxIC9CYXNlRm9udCAvSGVsdmV0aWNhID4+CmVuZG9iago1IDAgb2JqCjw8IC9MZW5ndGggNTcgPj4Kc3RyZWFtCkJUIC9GMSAxMiBUZiAyMCAxMDAgVGQgKFNjZW5lcG9uZCBzYW1wbGUgZG9jdW1lbnQuKSBUaiBFVAplbmRzdHJlYW0KZW5kb2JqCnhyZWYKMCA2CjAwMDAwMDAwMDAgNjU1MzUgZiAKMDAwMDAwMDAwOSAwMDAwMCBuIAowMDAwMDAwMDU4IDAwMDAwIG4gCjAwMDAwMDAxMTUgMDAwMDAgbiAKMDAwMDAwMDI0MSAwMDAwMCBuIAowMDAwMDAwMzExIDAwMDAwIG4gCnRyYWlsZXIKPDwgL1NpemUgNiAvUm9vdCAxIDAgUiA+PgpzdGFydHhyZWYKNDE4CiUlRU9GCg==\"\n          }\n        }\n      ]\n    }\n  ],\n  \"prompt_cache_options\": {\n    \"ttl\": \"30m\",\n    \"mode\": \"explicit\"\n  }\n}")

request = Request(
    "https://open.scenepond.ai/v1/chat/completions",
    headers={
        "Authorization": "Bearer " + os.environ["SCENEPOND_API_KEY"],
        "Content-Type": "application/json",
    },
    data=json.dumps(payload).encode("utf-8"),
    method="POST",
)
with urlopen(request) as response:
    result = json.load(response)
print(json.dumps(result, indent=2))
```

##### JavaScript

```javascript
const response = await fetch("https://open.scenepond.ai/v1/chat/completions", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.SCENEPOND_API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
  "model": "gpt-6-luna",
  "reasoning_effort": "medium",
  "max_completion_tokens": 1024,
  "messages": [
    {
      "role": "user",
      "name": "reader",
      "content": [
        {
          "type": "text",
          "text": "What sentence is in this PDF?",
          "prompt_cache_breakpoint": {
            "mode": "explicit"
          }
        },
        {
          "type": "file",
          "file": {
            "filename": "sample.pdf",
            "file_data": "data:application/pdf;base64,JVBERi0xLjQKMSAwIG9iago8PCAvVHlwZSAvQ2F0YWxvZyAvUGFnZXMgMiAwIFIgPj4KZW5kb2JqCjIgMCBvYmoKPDwgL1R5cGUgL1BhZ2VzIC9LaWRzIFszIDAgUl0gL0NvdW50IDEgPj4KZW5kb2JqCjMgMCBvYmoKPDwgL1R5cGUgL1BhZ2UgL1BhcmVudCAyIDAgUiAvTWVkaWFCb3ggWzAgMCAzMDAgMTQ0XSAvUmVzb3VyY2VzIDw8IC9Gb250IDw8IC9GMSA0IDAgUiA+PiA+PiAvQ29udGVudHMgNSAwIFIgPj4KZW5kb2JqCjQgMCBvYmoKPDwgL1R5cGUgL0ZvbnQgL1N1YnR5cGUgL1R5cGUxIC9CYXNlRm9udCAvSGVsdmV0aWNhID4+CmVuZG9iago1IDAgb2JqCjw8IC9MZW5ndGggNTcgPj4Kc3RyZWFtCkJUIC9GMSAxMiBUZiAyMCAxMDAgVGQgKFNjZW5lcG9uZCBzYW1wbGUgZG9jdW1lbnQuKSBUaiBFVAplbmRzdHJlYW0KZW5kb2JqCnhyZWYKMCA2CjAwMDAwMDAwMDAgNjU1MzUgZiAKMDAwMDAwMDAwOSAwMDAwMCBuIAowMDAwMDAwMDU4IDAwMDAwIG4gCjAwMDAwMDAxMTUgMDAwMDAgbiAKMDAwMDAwMDI0MSAwMDAwMCBuIAowMDAwMDAwMzExIDAwMDAwIG4gCnRyYWlsZXIKPDwgL1NpemUgNiAvUm9vdCAxIDAgUiA+PgpzdGFydHhyZWYKNDE4CiUlRU9GCg=="
          }
        }
      ]
    }
  ],
  "prompt_cache_options": {
    "ttl": "30m",
    "mode": "explicit"
  }
})
});
if (!response.ok) throw new Error(`API error: ${response.status} ${await response.text()}`);
const result = await response.json();
console.log(result);
```

#### 回放助手拒绝消息 3

先回放助手先前返回的拒绝消息，再提出新问题。

##### cURL

```bash
curl --fail-with-body -X POST "https://open.scenepond.ai/v1/chat/completions" \
  -H "Authorization: Bearer $SCENEPOND_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @- <<'JSON'
{
  "model": "gpt-6-luna",
  "reasoning_effort": "medium",
  "max_completion_tokens": 256,
  "messages": [
    {
      "role": "assistant",
      "content": null,
      "refusal": "I cannot help with that."
    },
    {
      "role": "user",
      "content": "Tell me a harmless fun fact."
    }
  ]
}
JSON
```

##### Python

```python
import os
import json
from urllib.parse import quote
from urllib.request import Request, urlopen

payload = json.loads("{\n  \"model\": \"gpt-6-luna\",\n  \"reasoning_effort\": \"medium\",\n  \"max_completion_tokens\": 256,\n  \"messages\": [\n    {\n      \"role\": \"assistant\",\n      \"content\": null,\n      \"refusal\": \"I cannot help with that.\"\n    },\n    {\n      \"role\": \"user\",\n      \"content\": \"Tell me a harmless fun fact.\"\n    }\n  ]\n}")

request = Request(
    "https://open.scenepond.ai/v1/chat/completions",
    headers={
        "Authorization": "Bearer " + os.environ["SCENEPOND_API_KEY"],
        "Content-Type": "application/json",
    },
    data=json.dumps(payload).encode("utf-8"),
    method="POST",
)
with urlopen(request) as response:
    result = json.load(response)
print(json.dumps(result, indent=2))
```

##### JavaScript

```javascript
const response = await fetch("https://open.scenepond.ai/v1/chat/completions", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.SCENEPOND_API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
  "model": "gpt-6-luna",
  "reasoning_effort": "medium",
  "max_completion_tokens": 256,
  "messages": [
    {
      "role": "assistant",
      "content": null,
      "refusal": "I cannot help with that."
    },
    {
      "role": "user",
      "content": "Tell me a harmless fun fact."
    }
  ]
})
});
if (!response.ok) throw new Error(`API error: ${response.status} ${await response.text()}`);
const result = await response.json();
console.log(result);
```

#### 包含可选参数的函数调用 4

##### cURL

```bash
curl --fail-with-body -X POST "https://open.scenepond.ai/v1/chat/completions" \
  -H "Authorization: Bearer $SCENEPOND_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @- <<'JSON'
{
  "model": "gpt-6-luna",
  "messages": [
    {
      "role": "user",
      "content": "What is the weather in Singapore?"
    },
    {
      "role": "assistant",
      "content": null,
      "tool_calls": [
        {
          "id": "call_weather_example",
          "type": "function",
          "function": {
            "name": "get_weather",
            "arguments": "{\"city\":\"Singapore\"}"
          }
        }
      ]
    },
    {
      "role": "tool",
      "tool_call_id": "call_weather_example",
      "content": "{\"temperature_c\":30,\"condition\":\"sunny\"}"
    }
  ],
  "reasoning_effort": "none",
  "max_completion_tokens": 1024,
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "get_weather",
        "description": "Get the weather for a city.",
        "strict": true,
        "parameters": {
          "type": "object",
          "properties": {
            "city": {
              "type": "string"
            }
          },
          "required": [
            "city"
          ],
          "additionalProperties": false
        }
      }
    }
  ],
  "tool_choice": {
    "type": "function",
    "function": {
      "name": "get_weather"
    }
  },
  "parallel_tool_calls": false,
  "stream": false
}
JSON
```

##### Python

```python
import os
import json
from urllib.parse import quote
from urllib.request import Request, urlopen

payload = json.loads("{\n  \"model\": \"gpt-6-luna\",\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": \"What is the weather in Singapore?\"\n    },\n    {\n      \"role\": \"assistant\",\n      \"content\": null,\n      \"tool_calls\": [\n        {\n          \"id\": \"call_weather_example\",\n          \"type\": \"function\",\n          \"function\": {\n            \"name\": \"get_weather\",\n            \"arguments\": \"{\\\"city\\\":\\\"Singapore\\\"}\"\n          }\n        }\n      ]\n    },\n    {\n      \"role\": \"tool\",\n      \"tool_call_id\": \"call_weather_example\",\n      \"content\": \"{\\\"temperature_c\\\":30,\\\"condition\\\":\\\"sunny\\\"}\"\n    }\n  ],\n  \"reasoning_effort\": \"none\",\n  \"max_completion_tokens\": 1024,\n  \"tools\": [\n    {\n      \"type\": \"function\",\n      \"function\": {\n        \"name\": \"get_weather\",\n        \"description\": \"Get the weather for a city.\",\n        \"strict\": true,\n        \"parameters\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"city\": {\n              \"type\": \"string\"\n            }\n          },\n          \"required\": [\n            \"city\"\n          ],\n          \"additionalProperties\": false\n        }\n      }\n    }\n  ],\n  \"tool_choice\": {\n    \"type\": \"function\",\n    \"function\": {\n      \"name\": \"get_weather\"\n    }\n  },\n  \"parallel_tool_calls\": false,\n  \"stream\": false\n}")

request = Request(
    "https://open.scenepond.ai/v1/chat/completions",
    headers={
        "Authorization": "Bearer " + os.environ["SCENEPOND_API_KEY"],
        "Content-Type": "application/json",
    },
    data=json.dumps(payload).encode("utf-8"),
    method="POST",
)
with urlopen(request) as response:
    result = json.load(response)
print(json.dumps(result, indent=2))
```

##### JavaScript

```javascript
const response = await fetch("https://open.scenepond.ai/v1/chat/completions", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.SCENEPOND_API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
  "model": "gpt-6-luna",
  "messages": [
    {
      "role": "user",
      "content": "What is the weather in Singapore?"
    },
    {
      "role": "assistant",
      "content": null,
      "tool_calls": [
        {
          "id": "call_weather_example",
          "type": "function",
          "function": {
            "name": "get_weather",
            "arguments": "{\"city\":\"Singapore\"}"
          }
        }
      ]
    },
    {
      "role": "tool",
      "tool_call_id": "call_weather_example",
      "content": "{\"temperature_c\":30,\"condition\":\"sunny\"}"
    }
  ],
  "reasoning_effort": "none",
  "max_completion_tokens": 1024,
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "get_weather",
        "description": "Get the weather for a city.",
        "strict": true,
        "parameters": {
          "type": "object",
          "properties": {
            "city": {
              "type": "string"
            }
          },
          "required": [
            "city"
          ],
          "additionalProperties": false
        }
      }
    }
  ],
  "tool_choice": {
    "type": "function",
    "function": {
      "name": "get_weather"
    }
  },
  "parallel_tool_calls": false,
  "stream": false
})
});
if (!response.ok) throw new Error(`API error: ${response.status} ${await response.text()}`);
const result = await response.json();
console.log(result);
```

#### 选择允许调用的函数 5

Chat Completions 将允许调用的函数子集放在 tool_choice.allowed_tools 内。

##### cURL

```bash
curl --fail-with-body -X POST "https://open.scenepond.ai/v1/chat/completions" \
  -H "Authorization: Bearer $SCENEPOND_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @- <<'JSON'
{
  "model": "gpt-6-luna",
  "messages": [
    {
      "role": "user",
      "content": "What is the weather in Singapore?"
    }
  ],
  "reasoning_effort": "none",
  "max_completion_tokens": 1024,
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "get_weather",
        "description": "Get the weather for a city.",
        "strict": true,
        "parameters": {
          "type": "object",
          "properties": {
            "city": {
              "type": "string"
            }
          },
          "required": [
            "city"
          ],
          "additionalProperties": false
        }
      }
    }
  ],
  "tool_choice": {
    "type": "allowed_tools",
    "allowed_tools": {
      "mode": "required",
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_weather"
          }
        }
      ]
    }
  }
}
JSON
```

##### Python

```python
import os
import json
from urllib.parse import quote
from urllib.request import Request, urlopen

payload = json.loads("{\n  \"model\": \"gpt-6-luna\",\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": \"What is the weather in Singapore?\"\n    }\n  ],\n  \"reasoning_effort\": \"none\",\n  \"max_completion_tokens\": 1024,\n  \"tools\": [\n    {\n      \"type\": \"function\",\n      \"function\": {\n        \"name\": \"get_weather\",\n        \"description\": \"Get the weather for a city.\",\n        \"strict\": true,\n        \"parameters\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"city\": {\n              \"type\": \"string\"\n            }\n          },\n          \"required\": [\n            \"city\"\n          ],\n          \"additionalProperties\": false\n        }\n      }\n    }\n  ],\n  \"tool_choice\": {\n    \"type\": \"allowed_tools\",\n    \"allowed_tools\": {\n      \"mode\": \"required\",\n      \"tools\": [\n        {\n          \"type\": \"function\",\n          \"function\": {\n            \"name\": \"get_weather\"\n          }\n        }\n      ]\n    }\n  }\n}")

request = Request(
    "https://open.scenepond.ai/v1/chat/completions",
    headers={
        "Authorization": "Bearer " + os.environ["SCENEPOND_API_KEY"],
        "Content-Type": "application/json",
    },
    data=json.dumps(payload).encode("utf-8"),
    method="POST",
)
with urlopen(request) as response:
    result = json.load(response)
print(json.dumps(result, indent=2))
```

##### JavaScript

```javascript
const response = await fetch("https://open.scenepond.ai/v1/chat/completions", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.SCENEPOND_API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
  "model": "gpt-6-luna",
  "messages": [
    {
      "role": "user",
      "content": "What is the weather in Singapore?"
    }
  ],
  "reasoning_effort": "none",
  "max_completion_tokens": 1024,
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "get_weather",
        "description": "Get the weather for a city.",
        "strict": true,
        "parameters": {
          "type": "object",
          "properties": {
            "city": {
              "type": "string"
            }
          },
          "required": [
            "city"
          ],
          "additionalProperties": false
        }
      }
    }
  ],
  "tool_choice": {
    "type": "allowed_tools",
    "allowed_tools": {
      "mode": "required",
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "get_weather"
          }
        }
      ]
    }
  }
})
});
if (!response.ok) throw new Error(`API error: ${response.status} ${await response.text()}`);
const result = await response.json();
console.log(result);
```

#### 使用 temperature 采样 6

##### cURL

```bash
curl --fail-with-body -X POST "https://open.scenepond.ai/v1/chat/completions" \
  -H "Authorization: Bearer $SCENEPOND_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @- <<'JSON'
{
  "model": "gpt-6-luna",
  "messages": [
    {
      "role": "user",
      "content": "Suggest a short title for a garden photo."
    }
  ],
  "reasoning_effort": "none",
  "max_completion_tokens": 128,
  "temperature": 0.2,
  "logprobs": true,
  "top_logprobs": 3
}
JSON
```

##### Python

```python
import os
import json
from urllib.parse import quote
from urllib.request import Request, urlopen

payload = json.loads("{\n  \"model\": \"gpt-6-luna\",\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": \"Suggest a short title for a garden photo.\"\n    }\n  ],\n  \"reasoning_effort\": \"none\",\n  \"max_completion_tokens\": 128,\n  \"temperature\": 0.2,\n  \"logprobs\": true,\n  \"top_logprobs\": 3\n}")

request = Request(
    "https://open.scenepond.ai/v1/chat/completions",
    headers={
        "Authorization": "Bearer " + os.environ["SCENEPOND_API_KEY"],
        "Content-Type": "application/json",
    },
    data=json.dumps(payload).encode("utf-8"),
    method="POST",
)
with urlopen(request) as response:
    result = json.load(response)
print(json.dumps(result, indent=2))
```

##### JavaScript

```javascript
const response = await fetch("https://open.scenepond.ai/v1/chat/completions", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.SCENEPOND_API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
  "model": "gpt-6-luna",
  "messages": [
    {
      "role": "user",
      "content": "Suggest a short title for a garden photo."
    }
  ],
  "reasoning_effort": "none",
  "max_completion_tokens": 128,
  "temperature": 0.2,
  "logprobs": true,
  "top_logprobs": 3
})
});
if (!response.ok) throw new Error(`API error: ${response.status} ${await response.text()}`);
const result = await response.json();
console.log(result);
```

#### 使用 top_p 采样 7

##### cURL

```bash
curl --fail-with-body -X POST "https://open.scenepond.ai/v1/chat/completions" \
  -H "Authorization: Bearer $SCENEPOND_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @- <<'JSON'
{
  "model": "gpt-6-luna",
  "messages": [
    {
      "role": "user",
      "content": "Suggest a short title for a garden photo."
    }
  ],
  "reasoning_effort": "none",
  "max_completion_tokens": 128,
  "top_p": 0.8
}
JSON
```

##### Python

```python
import os
import json
from urllib.parse import quote
from urllib.request import Request, urlopen

payload = json.loads("{\n  \"model\": \"gpt-6-luna\",\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": \"Suggest a short title for a garden photo.\"\n    }\n  ],\n  \"reasoning_effort\": \"none\",\n  \"max_completion_tokens\": 128,\n  \"top_p\": 0.8\n}")

request = Request(
    "https://open.scenepond.ai/v1/chat/completions",
    headers={
        "Authorization": "Bearer " + os.environ["SCENEPOND_API_KEY"],
        "Content-Type": "application/json",
    },
    data=json.dumps(payload).encode("utf-8"),
    method="POST",
)
with urlopen(request) as response:
    result = json.load(response)
print(json.dumps(result, indent=2))
```

##### JavaScript

```javascript
const response = await fetch("https://open.scenepond.ai/v1/chat/completions", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.SCENEPOND_API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
  "model": "gpt-6-luna",
  "messages": [
    {
      "role": "user",
      "content": "Suggest a short title for a garden photo."
    }
  ],
  "reasoning_effort": "none",
  "max_completion_tokens": 128,
  "top_p": 0.8
})
});
if (!response.ok) throw new Error(`API error: ${response.status} ${await response.text()}`);
const result = await response.json();
console.log(result);
```

<details>
<summary>兼容参数示例</summary>

#### 兼容旧版 Token 上限参数 1

网关会将该模型的 max_tokens 转换为 max_completion_tokens；新请求请使用 max_completion_tokens。

##### cURL

```bash
curl --fail-with-body -X POST "https://open.scenepond.ai/v1/chat/completions" \
  -H "Authorization: Bearer $SCENEPOND_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @- <<'JSON'
{
  "model": "gpt-6-luna",
  "messages": [
    {
      "role": "user",
      "content": "Hello!"
    }
  ],
  "reasoning_effort": "medium",
  "max_tokens": 128,
  "user": "user_example",
  "prompt_cache_retention": "24h"
}
JSON
```

##### Python

```python
import os
import json
from urllib.parse import quote
from urllib.request import Request, urlopen

payload = json.loads("{\n  \"model\": \"gpt-6-luna\",\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": \"Hello!\"\n    }\n  ],\n  \"reasoning_effort\": \"medium\",\n  \"max_tokens\": 128,\n  \"user\": \"user_example\",\n  \"prompt_cache_retention\": \"24h\"\n}")

request = Request(
    "https://open.scenepond.ai/v1/chat/completions",
    headers={
        "Authorization": "Bearer " + os.environ["SCENEPOND_API_KEY"],
        "Content-Type": "application/json",
    },
    data=json.dumps(payload).encode("utf-8"),
    method="POST",
)
with urlopen(request) as response:
    result = json.load(response)
print(json.dumps(result, indent=2))
```

##### JavaScript

```javascript
const response = await fetch("https://open.scenepond.ai/v1/chat/completions", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.SCENEPOND_API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
  "model": "gpt-6-luna",
  "messages": [
    {
      "role": "user",
      "content": "Hello!"
    }
  ],
  "reasoning_effort": "medium",
  "max_tokens": 128,
  "user": "user_example",
  "prompt_cache_retention": "24h"
})
});
if (!response.ok) throw new Error(`API error: ${response.status} ${await response.text()}`);
const result = await response.json();
console.log(result);
```

</details>

### 响应示例

响应示例仅展示结构；ID、URL 和数值为占位内容。

#### 对话补全响应

```json
{
  "id": "chatcmpl_EXAMPLE",
  "object": "chat.completion",
  "model": "gpt-6-luna",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello!"
      },
      "finish_reason": "stop"
    }
  ]
}
```

### 调用注意事项

- Chat Completions 使用 max_completion_tokens；max_output_tokens 用于 Responses。
- 使用 developer 消息设置应用指令。
- 使用采样参数或 Chat Completions 函数调用时，必须显式将 reasoning_effort 设为 none；省略此参数不等于选择 none。
- 这些模型接受文本和图片输入，并生成文本输出。
- 当前渠道尚未开放 service_tier、safety_identifier 和 stream_options.include_obfuscation。这是网关的开放范围限制，并非模型不支持；参数表和示例中均不展示这些选项。
- Chat Completions 的文件内容仅支持 PDF。file_url 和 PDF 的 detail 参数属于 Responses。网关未实现文件上传、列表和下载接口。

## Responses

`POST /v1/responses`

### 请求参数

- `model` — **必填**; `string`. 使用此处公布的完整模型 ID。
  - 约束: gpt-6-luna

- `input` — **必填**; `string | object[]`. 发送文本、输入消息或先前的工具执行结果。

### input 中的字段

仅在提供 input 时适用；子字段必填不代表可选的父字段也必填。

- `input[].type` — **条件必填**; `string | null`. 输入项类型。
  - 只有 item_reference 的 type 可为 null 或省略。message 条目可省略 type；其他列出的条目都必须填写各自的字符串类型标识。
  - 除 message 和 item_reference 条目外必填。
  - 约束: message; function_call; function_call_output; reasoning; compaction; item_reference; computer_call_output; shell_call_output; apply_patch_call_output; mcp_approval_response; tool_search_call; tool_search_output; additional_tools; configuration_update; compaction_trigger; program; program_output

- `input[].role` — **条件必填**; `string`. 输入消息的角色。
  - additional_tools 的 role 必须为 developer。
  - message 和 additional_tools 条目必填。
  - 约束: developer; system; user; assistant

- `input[].content` — **条件必填**; `string | object[]`. 消息文本、输入内容项或先前的助手输出。
  - 每个 PDF 文件必须小于 50 MB；每次请求的文件总量不得超过 50 MB。
  - 消息项必填。

### input[].content 中的字段

仅在提供 input[].content 时适用；子字段必填不代表可选的父字段也必填。

- `input[].content[].type` — **必填**; `string`. 内容项类型。
  - 输入内容使用 input_text、input_image 或 input_file；output_text 和 refusal 仅用于回放助手消息。
  - 约束: input_text; input_image; input_file; output_text; refusal

- `input[].content[].text` — **条件必填**; `string`. 文本内容。
  - input_text 或回放助手消息的 output_text 必填。

- `input[].content[].refusal` — **条件必填**; `string`. 助手返回的拒绝文本。
  - 回放助手消息的 refusal 内容时必填。

- `input[].content[].annotations` — **条件必填**; `object[]`. 保留先前 output_text 项中的注释。
  - 保留其原始结构。
  - 重放完整 output_text 条目时必填。

- `input[].content[].image_url` — **可选**; `string | null`. 图片 URL 或 Base64 图片数据 URL。
  - 用于 input_image；请提供 image_url 或已有的上游 file_id。

- `input[].content[].file_id` — **可选**; `string | null`. 执行请求的上游账户中已有的文件 ID。
  - 用于 input_file 或 input_image；每个内容项只使用一种来源。

- `input[].content[].file_data` — **可选**; `string`. Base64 编码的文件数据，需同时提供文件名。
  - 用于 input_file；使用 file_data、file_url 或 file_id。

- `input[].content[].file_url` — **可选**; `string`. 可公开访问的文件 URL。
  - 用于 input_file；使用 file_data、file_url 或 file_id。

- `input[].content[].filename` — **可选**; `string`. 文件名。
  - 与内嵌的 file_data 一起使用。

- `input[].content[].detail` — **可选**; `string`. 选择图片细节级别。
  - 用于 input_image。PDF 的 input_file 请使用 auto、low 或 high，默认 auto。
  - 默认: `"auto"`
  - 约束: auto; low; high

- `input[].content[].prompt_cache_breakpoint` — **可选**; `object`. 标记可复用提示词前缀的精确结束位置。
  - 仅用于 input_text、input_image 或 input_file。

### input[].content[].prompt_cache_breakpoint 中的字段

仅在提供 input[].content[].prompt_cache_breakpoint 时适用；子字段必填不代表可选的父字段也必填。

- `input[].content[].prompt_cache_breakpoint.mode` — **必填**; `string`. 显式缓存断点模式。
  - 约束: explicit



- `input[].call_id` — **条件必填**; `string`. 原始工具或程序调用 ID。
  - 所有工具结果都应保留原始调用 ID。
  - function_call、computer_call_output、shell_call_output、apply_patch_call_output、program 和 program_output 必填。

- `input[].output` — **条件必填**; `string | object | object[]`. 使用对应工具结果格式提供工具输出。
  - apply_patch_call_output 可选，类型为字符串。
  - function_call_output、computer_call_output 和 shell_call_output 必填。

### input[].output 中的字段

仅在提供 input[].output 时适用；子字段必填不代表可选的父字段也必填。

- `input[].output[].type` — **条件必填**; `string`. 内容项类型。
  - shell 输出块请省略此项。
  - 函数结果的内容片段和计算机截图必填。
  - 约束: input_text; input_image; input_file; computer_screenshot

- `input[].output[].text` — **条件必填**; `string`. 文本内容。
  - input_text 函数结果必填。

- `input[].output[].stdout` — **条件必填**; `string`. 捕获的 shell 标准输出。
  - shell 输出块必填。

- `input[].output[].stderr` — **条件必填**; `string`. 捕获的 shell 标准错误输出。
  - shell 输出块必填。

- `input[].output[].outcome` — **条件必填**; `object`. shell 命令的退出或超时结果。
  - shell 输出块必填。

### input[].output[].outcome 中的字段

仅在提供 input[].output[].outcome 时适用；子字段必填不代表可选的父字段也必填。

- `input[].output[].outcome.type` — **必填**; `string`. shell 结果类型。
  - 约束: exit; timeout

- `input[].output[].outcome.exit_code` — **条件必填**; `number`. shell 进程退出码。
  - type 为 exit 时必填。


- `input[].output[].image_url` — **可选**; `string | null`. 图片 URL 或 Base64 图片数据 URL。
  - 用于 input_image；请提供 image_url 或已有的上游 file_id。

- `input[].output[].file_id` — **可选**; `string | null`. 执行请求的上游账户中已有的文件 ID。
  - 用于 input_file 或 input_image；每个内容项只使用一种来源。

- `input[].output[].file_data` — **可选**; `string | null`. Base64 编码的文件数据，需同时提供文件名。
  - 用于 input_file；使用 file_data、file_url 或 file_id。

- `input[].output[].file_url` — **可选**; `string | null`. 可公开访问的文件 URL。
  - 用于 input_file；使用 file_data、file_url 或 file_id。

- `input[].output[].filename` — **可选**; `string | null`. 文件名。
  - 与内嵌的 file_data 一起使用。

- `input[].output[].detail` — **可选**; `string | null`. 选择图片细节级别。
  - 用于 input_image。PDF 的 input_file 请使用 auto、low 或 high，默认 auto。
  - 默认: `"auto"`
  - 约束: auto; low; high

- `input[].output[].prompt_cache_breakpoint` — **可选**; `object | null`. 标记可复用提示词前缀的精确结束位置。
  - 仅用于 input_text、input_image 或 input_file。

### input[].output[].prompt_cache_breakpoint 中的字段

仅在提供 input[].output[].prompt_cache_breakpoint 时适用；子字段必填不代表可选的父字段也必填。

- `input[].output[].prompt_cache_breakpoint.mode` — **必填**; `string`. 显式缓存断点模式。
  - 约束: explicit



- `input[].id` — **条件必填**; `string`. 原始项目 ID。
  - 其他情况请保留已有条目 ID。
  - item_reference、重放的输出消息或 reasoning 条目、program 和 program_output 必填。

- `input[].name` — **条件必填**; `string`. 工具名称。
  - function_call_output 可选。
  - function_call 必填。

- `input[].arguments` — **条件必填**; `string | object`. 函数参数或工具搜索输入。
  - function_call 使用 JSON 编码字符串；tool_search_call 按其声明的参数定义填写。
  - function_call 或 tool_search_call 必填。

- `input[].tools` — **条件必填**; `object[]`. 已加载或新增的工具定义，结构与顶层 tools 数组相同。
  - tool_search_output 或 additional_tools 必填。

- `input[].code` — **条件必填**; `string`. program 条目中的原始 JavaScript 代码。
  - 重放 program 时必填。

- `input[].fingerprint` — **条件必填**; `string`. 用于重放程序的不透明指纹；请保留原始值。
  - 重放 program 时必填。

- `input[].result` — **条件必填**; `string`. 原始程序结果。
  - 重放 program_output 时必填。

- `input[].status` — **条件必填**; `string | null`. 原始项目状态。
  - 保留重放条目的状态；program_output 使用 completed 或 incomplete，apply_patch_call_output 使用 completed 或 failed。
  - program_output 必填。
  - 约束: in_progress; completed; incomplete; 已失败

- `input[].summary` — **条件必填**; `object[]`. 回放原始响应中的推理摘要。
  - 推理项必填。

### input[].summary 中的字段

仅在提供 input[].summary 时适用；子字段必填不代表可选的父字段也必填。

- `input[].summary[].type` — **必填**; `string`. 推理摘要内容类型。
  - 约束: summary_text

- `input[].summary[].text` — **必填**; `string`. 推理摘要文本。


- `input[].encrypted_content` — **条件必填**; `string | null`. 原样重放加密的推理或压缩内容。
  - 用于上游响应中返回的 reasoning 条目。
  - compaction 条目必填。

- `input[].approval_request_id` — **条件必填**; `string`. 正在回复的 MCP 审批请求。
  - mcp_approval_response 必填。

- `input[].approve` — **条件必填**; `boolean`. 批准或拒绝 MCP 请求。
  - mcp_approval_response 必填。

- `input[].acknowledged_safety_checks` — **可选**; `object[] | null`. 确认先前电脑调用中待处理的安全检查。
  - 用于 computer_call_output。

### input[].acknowledged_safety_checks 中的字段

仅在提供 input[].acknowledged_safety_checks 时适用；子字段必填不代表可选的父字段也必填。

- `input[].acknowledged_safety_checks[].id` — **必填**; `string`. 待处理安全检查的 ID。

- `input[].acknowledged_safety_checks[].code` — **可选**; `string | null`. 安全检查类型。

- `input[].acknowledged_safety_checks[].message` — **可选**; `string | null`. 安全检查详情。


- `input[].max_output_length` — **可选**; `number | null`. shell 输出可捕获的最大 UTF-8 字符数。
  - 用于 shell_call_output。

- `input[].namespace` — **可选**; `string | null`. 被调用工具所属的命名空间。
  - 用于命名空间内的函数调用与函数结果；请原样保留之前的 namespace。

- `input[].caller` — **可选**; `object | null`. 保留之前工具调用的执行上下文。
  - 用于函数调用与结果，以及受支持的自定义工具调用与结果。

### input[].caller 中的字段

仅在提供 input[].caller 时适用；子字段必填不代表可选的父字段也必填。

- `input[].caller.type` — **必填**; `string`. 工具调用的执行上下文。
  - 约束: direct; program

- `input[].caller.caller_id` — **条件必填**; `string`. 原始程序调用 ID。
  - caller.type 为 program 时必填。


- `input[].execution` — **可选**; `string`. 工具搜索的执行位置。
  - 用于 tool_search_call 或 tool_search_output。
  - 约束: server; client

- `input[].reasoning` — **可选**; `object`. 调整后续轮次的推理力度。
  - 用于 standard 单智能体模式下的 configuration_update。不能与自动压缩或截断组合，更新之间不能相邻。

### input[].reasoning 中的字段

仅在提供 input[].reasoning 时适用；子字段必填不代表可选的父字段也必填。

- `input[].reasoning.effort` — **可选**; `string | null`. 更新后的推理力度；原始请求级 effort 保持不变。
  - 约束: none; low; medium; high; xhigh; max


- `input[].phase` — **可选**; `string | null`. 助手消息阶段。
  - 用于助手消息。
  - 约束: commentary; final_answer

- `input[].reason` — **可选**; `string | null`. MCP 审批决定的可选说明。
  - 用于 mcp_approval_response。


- `stream` — **可选**; `boolean | null`. 设为 true 时返回 SSE 事件流；false 或 null 返回非流式响应。

- `metadata` — **可选**; `object | null`. 为请求附加字符串类型的元数据。
  - 约束: 最多 16 组键值对；键最长 64 个字符，字符串值最长 512 个字符。

- `store` — **可选**; `boolean | null`. 请求存储响应。上游默认值为 true；账号和网关策略可能覆盖存储行为。
  - 默认: `true`

- `prompt_cache_key` — **可选**; `string | null`. 将共享可复用提示词前缀的请求归为一组。

- `prompt_cache_options` — **可选**; `object`. 配置提示词缓存。

### prompt_cache_options 中的字段

仅在提供 prompt_cache_options 时适用；子字段必填不代表可选的父字段也必填。

- `prompt_cache_options.ttl` — **可选**; `string`. 缓存的最短保留时间。
  - 默认: `"30m"`
  - 约束: 30m

- `prompt_cache_options.mode` — **可选**; `string`. 选择隐式或显式缓存断点。
  - 默认: `"implicit"`
  - 约束: implicit; explicit

- `prompt_cache_options.comparison_response_id` — **可选**; `string | null`. 与此前的响应比较缓存复用情况。
  - 需要已有响应 ID 和对应的诊断功能权限。

- `prompt_cache_options.prewarm` — **可选**; `boolean`. 预热提示词缓存，不生成输出。
  - 默认: `false`


- `instructions` — **可选**; `string | null`. 设置系统指令或开发者指令。

- `previous_response_id` — **可选**; `string | null`. 通过先前的响应 ID 继续对话。

- `conversation` — **可选**; `string | object | null`. 使用已配置的会话。
  - 不能与 previous_response_id 同时使用。

### conversation 中的字段

仅在提供 conversation 时适用；子字段必填不代表可选的父字段也必填。

- `conversation.id` — **条件必填**; `string`. 已有会话 ID。
  - conversation 为对象时必填。


- `prompt` — **可选**; `object | null`. 使用已保存的提示词模板。

### prompt 中的字段

仅在提供 prompt 时适用；子字段必填不代表可选的父字段也必填。

- `prompt.id` — **必填**; `string`. 已有提示词模板 ID。

- `prompt.version` — **可选**; `string | null`. 选择已保存的提示词版本。

- `prompt.variables` — **可选**; `object | null`. 为已保存提示词中的变量提供值。


- `context_management` — **可选**; `object[] | null`. 配置上下文压缩。

### context_management 中的字段

仅在提供 context_management 时适用；子字段必填不代表可选的父字段也必填。

- `context_management[].type` — **必填**; `string`. 上下文管理操作。
  - 约束: compaction

- `context_management[].compact_threshold` — **可选**; `number | null`. 触发上下文压缩的 Token 数量阈值。


- `reasoning` — **可选**; `object | null`. 配置本次响应的推理设置。

### reasoning 中的字段

仅在提供 reasoning 时适用；子字段必填不代表可选的父字段也必填。

- `reasoning.effort` — **可选**; `string | null`. 选择本次请求的推理强度。
  - 默认: `"medium"`
  - 约束: none; low; medium; high; xhigh; max

- `reasoning.mode` — **可选**; `string | null`. 选择推理执行模式。
  - 默认: `"standard"`
  - 约束: standard; pro

- `reasoning.summary` — **可选**; `string | null`. 请求返回推理摘要。
  - 约束: auto; concise; detailed

- `reasoning.context` — **可选**; `string | null`. 控制复用哪些此前的推理内容。
  - 约束: auto; current_turn


- `max_output_tokens` — **可选**; `integer | null`. 限制生成的 Token 总数，包括推理 Token。
  - 约束: 最大值: 128000

- `moderation` — **可选**; `object | null`. 请求随生成响应返回内容审核评分。

### moderation 中的字段

仅在提供 moderation 时适用；子字段必填不代表可选的父字段也必填。

- `moderation.model` — **必填**; `string`. 内容审核模型，例如 omni-moderation-latest。

- `moderation.policy` — **可选**; `object | null`. 选择对输入和输出评分或阻止。

### moderation.policy 中的字段

仅在提供 moderation.policy 时适用；子字段必填不代表可选的父字段也必填。

- `moderation.policy.input` — **可选**; `object | null`. 请求这一部分的内容审核策略。

### moderation.policy.input 中的字段

仅在提供 moderation.policy.input 时适用；子字段必填不代表可选的父字段也必填。

- `moderation.policy.input.mode` — **必填**; `string`. 内容审核策略模式。
  - 约束: score; block


- `moderation.policy.output` — **可选**; `object | null`. 请求这一部分的内容审核策略。

### moderation.policy.output 中的字段

仅在提供 moderation.policy.output 时适用；子字段必填不代表可选的父字段也必填。

- `moderation.policy.output.mode` — **必填**; `string`. 内容审核策略模式。
  - 约束: score; block




- `text` — **可选**; `object`. 配置文本输出。

### text 中的字段

仅在提供 text 时适用；子字段必填不代表可选的父字段也必填。

- `text.verbosity` — **可选**; `string | null`. 选择回答的详细程度。
  - 默认: `"medium"`
  - 约束: low; medium; high

- `text.format` — **可选**; `object`. 配置文本或结构化 JSON 输出。
  - 默认: `{"type":"text"}`

### text.format 中的字段

仅在提供 text.format 时适用；子字段必填不代表可选的父字段也必填。

- `text.format.type` — **必填**; `string`. 输出格式。
  - 约束: text; json_object; json_schema

- `text.format.name` — **条件必填**; `string`. 输出结构名称。
  - type 为 json_schema 时必填。
  - 约束: 最多字符数: 64; 仅可使用 ASCII 英文字母、数字、下划线（_）或连字符（-）。

- `text.format.schema` — **条件必填**; `object`. 结构化输出使用的 JSON Schema。
  - type 为 json_schema 时必填。

- `text.format.description` — **可选**; `string`. 描述期望的结构化输出。
  - type 为 json_schema 时使用。

- `text.format.strict` — **可选**; `boolean | null`. 启用严格模式，使结果符合受支持的 JSON Schema 子集。
  - type 为 json_schema 时使用。



- `tools` — **可选**; `object[]`. 声明支持的内置工具或应用函数。

### tools 中的字段

仅在提供 tools 时适用；子字段必填不代表可选的父字段也必填。

- `tools[].type` — **必填**; `string`. 工具类型。
  - 约束: function; namespace; programmatic_tool_calling; web_search; file_search; image_generation; code_interpreter; shell; apply_patch; computer; mcp; tool_search

- `tools[].name` — **条件必填**; `string`. 函数或命名空间名称。
  - type 为 function 或 namespace 时必填。

- `tools[].description` — **条件必填**; `string | null`. 说明应在何时调用该函数。
  - 用于 function、namespace 或 tool_search 工具。
  - type 为 namespace 时必填。

- `tools[].parameters` — **条件必填**; `JSON value`. 定义函数参数的 JSON Schema。
  - 函数工具使用对象或 null；客户端 tool_search 的可选 parameters 可使用 JSON 值。
  - type 为 function 时必填。

- `tools[].tools` — **条件必填**; `object[]`. 命名空间内分组的工具定义。
  - type 为 namespace 时必填。

### tools[].tools 中的字段

仅在提供 tools[].tools 时适用；子字段必填不代表可选的父字段也必填。

- `tools[].tools[].type` — **必填**; `string`. 命名空间内的工具类型。
  - 约束: function

- `tools[].tools[].name` — **必填**; `string`. 命名空间内的工具名称。

- `tools[].tools[].description` — **可选**; `string | null`. 说明何时应调用此工具。

- `tools[].tools[].parameters` — **可选**; `JSON value`. 命名空间内函数的可选 JSON Schema。
  - 用于命名空间内的函数工具。

- `tools[].tools[].strict` — **可选**; `boolean | null`. 启用严格模式，使结果符合受支持的 JSON Schema 子集。
  - 命名空间内函数的可选参数。省略时，上游在 schema 兼容时尝试严格校验，否则使用非严格校验。

- `tools[].tools[].allowed_callers` — **可选**; `string[] | null`. 限制工具的调用方式。
  - 约束: direct; programmatic

- `tools[].tools[].defer_loading` — **可选**; `boolean`. 通过工具搜索加载此工具。

- `tools[].tools[].output_schema` — **可选**; `object | null`. 函数结果字符串中编码的 JSON 值所遵循的 JSON Schema。
  - 用于函数工具。


- `tools[].vector_store_ids` — **条件必填**; `string[]`. 要搜索的已有上游向量库。
  - type 为 file_search 时必填。

- `tools[].server_label` — **条件必填**; `string`. MCP 服务标签。
  - type 为 mcp 时必填。

- `tools[].container` — **条件必填**; `string | object`. 已有容器 ID 或自动创建的代码解释器容器。
  - type 为 code_interpreter 时必填。

### tools[].container 中的字段

仅在提供 tools[].container 时适用；子字段必填不代表可选的父字段也必填。

- `tools[].container.type` — **必填**; `string`. 自动容器类型。
  - 约束: auto

- `tools[].container.file_ids` — **可选**; `string[]`. 容器内可用的已有上游文件。

- `tools[].container.memory_limit` — **可选**; `string | null`. 容器内存限制。
  - 约束: 1g; 4g; 16g; 64g

- `tools[].container.network_policy` — **可选**; `object`. 配置容器外部网络访问。

### tools[].container.network_policy 中的字段

仅在提供 tools[].container.network_policy 时适用；子字段必填不代表可选的父字段也必填。

- `tools[].container.network_policy.type` — **必填**; `string`. 网络策略类型。
  - 约束: 已禁用; allowlist

- `tools[].container.network_policy.allowed_domains` — **条件必填**; `string[]`. 容器可以访问的域名。
  - type 为 allowlist 时必填。

- `tools[].container.network_policy.domain_secrets` — **可选**; `object[]`. 仅用于允许域名的可选密钥。
  - 用于 allowlist 策略。

### tools[].container.network_policy.domain_secrets 中的字段

仅在提供 tools[].container.network_policy.domain_secrets 时适用；子字段必填不代表可选的父字段也必填。

- `tools[].container.network_policy.domain_secrets[].domain` — **必填**; `string`. 接收此密钥的域名。

- `tools[].container.network_policy.domain_secrets[].name` — **必填**; `string`. 密钥名称。

- `tools[].container.network_policy.domain_secrets[].value` — **必填**; `string`. 密钥值。




- `tools[].strict` — **可选**; `boolean | null`. 启用严格模式，使结果符合受支持的 JSON Schema 子集。
  - 用于函数工具。省略时，Responses 尝试将 schema 规范为严格模式，必要时回退为非严格调用。

- `tools[].allowed_callers` — **可选**; `string[] | null`. 限制工具的调用方式。
  - 用于 function、mcp、code_interpreter、shell 或 apply_patch。程序化调用还需要 programmatic_tool_calling 工具。
  - 约束: direct; programmatic

- `tools[].defer_loading` — **可选**; `boolean`. 通过工具搜索加载函数或 MCP 工具。
  - 用于 function 或 mcp 工具；命名空间应在子工具上设置，不能设在命名空间本身。

- `tools[].output_schema` — **可选**; `object | null`. 函数结果字符串中编码的 JSON 值所遵循的 JSON Schema。
  - 用于函数工具。

- `tools[].max_num_results` — **可选**; `number`. 文件搜索返回的最大结果数。
  - 用于 file_search。
  - 约束: 最小值: 1; 最大值: 50

- `tools[].filters` — **可选**; `object | null`. 筛选文件属性或限制网络搜索域名。
  - 用于 file_search 或 web_search。

### tools[].filters 中的字段

仅在提供 tools[].filters 时适用；子字段必填不代表可选的父字段也必填。

- `tools[].filters.type` — **条件必填**; `string`. 文件搜索的比较或组合运算符。
  - 文件搜索筛选条件必填。
  - 约束: eq; ne; gt; gte; lt; lte; in; nin; 和; or

- `tools[].filters.key` — **条件必填**; `string`. 要比较的文件属性。
  - 比较筛选条件必填。

- `tools[].filters.value` — **条件必填**; `string | number | boolean | string[] | number[]`. 比较筛选条件使用的值或值列表。
  - 比较筛选条件必填。

- `tools[].filters.filters` — **条件必填**; `object[]`. 使用相同筛选结构的嵌套比较或组合条件。
  - and 或 or 运算符必填。

- `tools[].filters.allowed_domains` — **可选**; `string[] | null`. 允许的网络搜索域名，同时允许其子域名。
  - 用于 web_search；请省略 URL 协议前缀。
  - 约束: 最多项数: 100

- `tools[].filters.blocked_domains` — **可选**; `string[]`. 排除网页搜索域名及其子域名。
  - 用于 web_search；请省略 URL 协议前缀。
  - 约束: 最多项数: 100


- `tools[].ranking_options` — **可选**; `object`. 配置文件搜索排序。
  - 用于 file_search。

### tools[].ranking_options 中的字段

仅在提供 tools[].ranking_options 时适用；子字段必填不代表可选的父字段也必填。

- `tools[].ranking_options.ranker` — **可选**; `string`. 文件搜索排序器。
  - 约束: auto; default-2024-11-15

- `tools[].ranking_options.score_threshold` — **可选**; `number`. 最低相关性分数。
  - 约束: 最小值: 0; 最大值: 1

- `tools[].ranking_options.hybrid_search` — **可选**; `object`. 平衡语义匹配与关键词匹配。

### tools[].ranking_options.hybrid_search 中的字段

仅在提供 tools[].ranking_options.hybrid_search 时适用；子字段必填不代表可选的父字段也必填。

- `tools[].ranking_options.hybrid_search.embedding_weight` — **必填**; `number`. 语义匹配权重。

- `tools[].ranking_options.hybrid_search.text_weight` — **必填**; `number`. 关键词匹配权重。



- `tools[].external_web_access` — **可选**; `boolean`. 允许实时网络访问，而非仅使用缓存结果。
  - 用于 web_search。
  - 默认: `true`

- `tools[].return_token_budget` — **可选**; `string`. 限制网页搜索返回的内容量。
  - 仅用于启用推理的 web_search；reasoning.effort 为 none 时省略。web_search_preview 不支持此参数。
  - 默认: `"default"`
  - 约束: 默认; unlimited

- `tools[].search_context_size` — **可选**; `string`. 网络搜索使用的上下文量。
  - 用于 web_search。
  - 默认: `"medium"`
  - 约束: low; medium; high

- `tools[].user_location` — **可选**; `object | null`. 用于网络搜索的大致位置；省略或为 null 时默认为美国。
  - 用于 web_search。如需避免默认位置，请仅提供 type approximate，不填写位置字段。

### tools[].user_location 中的字段

仅在提供 tools[].user_location 时适用；子字段必填不代表可选的父字段也必填。

- `tools[].user_location.type` — **可选**; `string`. 位置估算类型。
  - 约束: approximate

- `tools[].user_location.country` — **可选**; `string | null`. 两位 ISO 国家代码。

- `tools[].user_location.city` — **可选**; `string | null`. 城市名称。

- `tools[].user_location.region` — **可选**; `string | null`. 地区名称。

- `tools[].user_location.timezone` — **可选**; `string | null`. IANA 时区。


- `tools[].server_url` — **可选**; `string`. 远程 MCP 服务 URL。
  - 用于 mcp；请提供 server_url、connector_id 或 tunnel_id。

- `tools[].connector_id` — **可选**; `string`. 已弃用的上游连接器 ID；较新模型建议使用 server_url 或 tunnel_id。
  - 用于 mcp；请提供 server_url、connector_id 或 tunnel_id。
  - 约束: connector_dropbox; connector_gmail; connector_googlecalendar; connector_googledrive; connector_microsoftteams; connector_outlookcalendar; connector_outlookemail; connector_sharepoint

- `tools[].server_description` — **可选**; `string`. 描述 MCP 服务。
  - 用于 mcp。

- `tools[].authorization` — **可选**; `string`. MCP 服务或连接器所需的授权令牌。
  - 用于 mcp；请使用已获该服务授权的凭据。

- `tools[].headers` — **可选**; `object | null`. 发给 MCP 服务的字符串值 HTTP 请求头。
  - 用于 mcp。

- `tools[].tunnel_id` — **可选**; `string`. 已有的安全 MCP 隧道 ID。
  - 用于具备上游隧道权限的 mcp。

- `tools[].allowed_tools` — **可选**; `string[] | object | null`. 限制 MCP 服务公开的工具。
  - 用于 mcp。

### tools[].allowed_tools 中的字段

仅在提供 tools[].allowed_tools 时适用；子字段必填不代表可选的父字段也必填。

- `tools[].allowed_tools[].read_only` — **可选**; `boolean`. 选择只读工具。

- `tools[].allowed_tools[].tool_names` — **可选**; `string[]`. 按名称选择工具。


- `tools[].require_approval` — **可选**; `string | object | null`. 要求对远程 MCP 调用进行审批。
  - 用于 mcp。
  - 约束: always; never

### tools[].require_approval 中的字段

仅在提供 tools[].require_approval 时适用；子字段必填不代表可选的父字段也必填。

- `tools[].require_approval.always` — **可选**; `object`. 始终需要审批的工具。

### tools[].require_approval.always 中的字段

仅在提供 tools[].require_approval.always 时适用；子字段必填不代表可选的父字段也必填。

- `tools[].require_approval.always.read_only` — **可选**; `boolean`. 选择只读工具。

- `tools[].require_approval.always.tool_names` — **可选**; `string[]`. 按名称选择工具。


- `tools[].require_approval.never` — **可选**; `object`. 无需审批的工具。

### tools[].require_approval.never 中的字段

仅在提供 tools[].require_approval.never 时适用；子字段必填不代表可选的父字段也必填。

- `tools[].require_approval.never.read_only` — **可选**; `boolean`. 选择只读工具。

- `tools[].require_approval.never.tool_names` — **可选**; `string[]`. 按名称选择工具。



- `tools[].environment` — **可选**; `object | null`. 配置 shell 执行环境。
  - 用于 shell。

### tools[].environment 中的字段

仅在提供 tools[].environment 时适用；子字段必填不代表可选的父字段也必填。

- `tools[].environment.type` — **必填**; `string`. shell 环境类型。
  - 约束: container_auto; container_reference; local

- `tools[].environment.container_id` — **条件必填**; `string`. 已有上游容器 ID。
  - container_reference 必填。

- `tools[].environment.file_ids` — **可选**; `string[]`. 容器内可用的已有上游文件。
  - 用于 container_auto。

- `tools[].environment.memory_limit` — **可选**; `string | null`. 容器内存限制。
  - 用于 container_auto。
  - 约束: 1g; 4g; 16g; 64g

- `tools[].environment.network_policy` — **可选**; `object`. 配置容器外部网络访问。
  - 用于 container_auto；local 或 container_reference 请省略。

### tools[].environment.network_policy 中的字段

仅在提供 tools[].environment.network_policy 时适用；子字段必填不代表可选的父字段也必填。

- `tools[].environment.network_policy.type` — **必填**; `string`. 网络策略类型。
  - 约束: 已禁用; allowlist

- `tools[].environment.network_policy.allowed_domains` — **条件必填**; `string[]`. 容器可以访问的域名。
  - type 为 allowlist 时必填。

- `tools[].environment.network_policy.domain_secrets` — **可选**; `object[]`. 仅用于允许域名的可选密钥。
  - 用于 allowlist 策略。

### tools[].environment.network_policy.domain_secrets 中的字段

仅在提供 tools[].environment.network_policy.domain_secrets 时适用；子字段必填不代表可选的父字段也必填。

- `tools[].environment.network_policy.domain_secrets[].domain` — **必填**; `string`. 接收此密钥的域名。

- `tools[].environment.network_policy.domain_secrets[].name` — **必填**; `string`. 密钥名称。

- `tools[].environment.network_policy.domain_secrets[].value` — **必填**; `string`. 密钥值。



- `tools[].environment.skills` — **可选**; `object[]`. shell 环境可用的技能。
  - 用于 container_auto 或 local；container_reference 请省略。

### tools[].environment.skills 中的字段

仅在提供 tools[].environment.skills 时适用；子字段必填不代表可选的父字段也必填。

- `tools[].environment.skills[].type` — **条件必填**; `string`. 托管技能来源类型。
  - 本地技能请省略此项。
  - container_auto 技能必填。
  - 约束: skill_reference; inline

- `tools[].environment.skills[].skill_id` — **条件必填**; `string`. 已有上游技能 ID。
  - skill_reference 必填。

- `tools[].environment.skills[].name` — **条件必填**; `string`. 技能名称。
  - 内嵌和本地技能必填。

- `tools[].environment.skills[].description` — **条件必填**; `string`. 技能说明。
  - 内嵌和本地技能必填。

- `tools[].environment.skills[].path` — **条件必填**; `string`. 包含技能的本地目录。
  - 本地技能必填。

- `tools[].environment.skills[].source` — **条件必填**; `object`. 内嵌技能包。
  - 内嵌技能必填。

### tools[].environment.skills[].source 中的字段

仅在提供 tools[].environment.skills[].source 时适用；子字段必填不代表可选的父字段也必填。

- `tools[].environment.skills[].source.type` — **必填**; `string`. 内嵌来源编码。
  - 约束: base64

- `tools[].environment.skills[].source.media_type` — **必填**; `string`. 内嵌技能媒体类型。
  - 约束: application/zip

- `tools[].environment.skills[].source.data` — **必填**; `string`. Base64 编码的 ZIP 技能包。


- `tools[].environment.skills[].version` — **可选**; `string`. 技能版本，使用正整数或 latest。
  - 用于 skill_reference。



- `tools[].execution` — **可选**; `string`. 工具搜索的执行位置。
  - 用于 tool_search。
  - 约束: server; client

- `tools[].action` — **可选**; `string`. 图像生成或编辑操作。
  - 用于 image_generation。
  - 默认: `"auto"`
  - 约束: auto; generate; edit

- `tools[].background` — **可选**; `string`. 生成图片的背景。
  - 用于 image_generation；透明背景需要 png 或 webp 格式以及兼容的图像模型。
  - 默认: `"auto"`
  - 约束: auto; opaque; transparent

- `tools[].model` — **可选**; `string`. image_generation 工具使用的图像模型。
  - 用于 image_generation；可用性和选项取决于所选上游图像模型。
  - 默认: `"gpt-image-1"`

- `tools[].input_fidelity` — **可选**; `string | null`. 编辑时保留输入图片的特征。
  - 用于 image_generation 的 gpt-image-1 或 gpt-image-1.5；gpt-image-1-mini 仅支持 low。gpt-image-2 请省略。
  - 约束: low; high

- `tools[].input_image_mask` — **可选**; `object`. 可选的局部重绘蒙版。
  - 用于 image_generation。

### tools[].input_image_mask 中的字段

仅在提供 tools[].input_image_mask 时适用；子字段必填不代表可选的父字段也必填。

- `tools[].input_image_mask.file_id` — **可选**; `string`. 已有的上游蒙版文件 ID。

- `tools[].input_image_mask.image_url` — **可选**; `string`. Base64 编码的蒙版图片数据 URL。


- `tools[].moderation` — **可选**; `string`. 图像生成审核级别。
  - 用于 image_generation。
  - 默认: `"auto"`
  - 约束: auto; low

- `tools[].output_compression` — **可选**; `number`. 生成图片的压缩级别。
  - 用于 image_generation。
  - 默认: `100`
  - 约束: 最小值: 0; 最大值: 100

- `tools[].output_format` — **可选**; `string`. 生成图片的文件格式。
  - 用于 image_generation。
  - 默认: `"png"`
  - 约束: png; webp; jpeg

- `tools[].partial_images` — **可选**; `number`. 流式返回的中间图片数量。
  - 用于 image_generation。
  - 默认: `0`
  - 约束: 最小值: 0; 最大值: 3

- `tools[].quality` — **可选**; `string`. 生成图片的质量。
  - 用于 image_generation；xhigh 和 max 需要 gpt-image-2.5-sunburst 或 gpt-image-2.5-flare。
  - 默认: `"auto"`
  - 约束: auto; low; medium; high; xhigh; max

- `tools[].size` — **可选**; `string`. 生成图片的尺寸。
  - 用于 image_generation；自定义尺寸取决于所选图像模型。
  - 约束: 尺寸遵循所选图像模型；标准尺寸包括 1024x1024、1536x1024 和 1024x1536。


- `tool_choice` — **可选**; `string | object`. 选择自动调用、必须调用、禁用调用，或指定函数。
  - 约束: none; auto; 必填

### tool_choice 中的字段

仅在提供 tool_choice 时适用；子字段必填不代表可选的父字段也必填。

- `tool_choice.type` — **必填**; `string`. 工具选择对象类型。
  - 约束: function; allowed_tools; mcp; file_search; web_search_preview; computer; code_interpreter; image_generation; shell; apply_patch; programmatic_tool_calling

- `tool_choice.name` — **条件必填**; `string | null`. 函数或远程工具名称。
  - type 为 mcp 时可选。
  - type 为 function 时必填。

- `tool_choice.server_label` — **条件必填**; `string`. MCP 服务标签。
  - type 为 mcp 时必填。

- `tool_choice.mode` — **条件必填**; `string`. 选择如何使用允许的工具子集。
  - type 为 allowed_tools 时必填。
  - 约束: auto; 必填

- `tool_choice.tools` — **条件必填**; `object[]`. 允许使用的工具引用，函数名称结构需与当前协议一致。
  - type 为 allowed_tools 时必填。

### tool_choice.tools 中的字段

仅在提供 tool_choice.tools 时适用；子字段必填不代表可选的父字段也必填。

- `tool_choice.tools[].type` — **必填**; `string`. 允许调用的工具引用类型。
  - 使用请求中已声明的工具类型。

- `tool_choice.tools[].name` — **条件必填**; `string`. 允许调用的函数或自定义工具名称。
  - 引用函数工具时必填。

- `tool_choice.tools[].server_label` — **条件必填**; `string`. MCP 服务标签。
  - 引用 mcp 工具时必填。



- `parallel_tool_calls` — **可选**; `boolean | null`. 允许在一轮中发起多个函数调用。

- `max_tool_calls` — **可选**; `integer | null`. 限制本次响应调用内置工具的总次数。

- `truncation` — **可选**; `string | null`. 选择是否截断超出上下文窗口的输入。
  - 默认: `"disabled"`
  - 约束: auto; 已禁用

- `include` — **可选**; `string[] | null`. 请求返回额外的响应数据。
  - 只有显式将 reasoning.effort 设为 none 时，才能包含 message.output_text.logprobs。
  - 约束: file_search_call.results; web_search_call.results; web_search_call.action.sources; message.input_image.image_url; computer_call_output.output.image_url; code_interpreter_call.outputs; reasoning.encrypted_content; message.output_text.logprobs

- `temperature` — **可选**; `number | null`. 调整采样的随机性。
  - 仅在显式将 reasoning.effort 设为 none 时支持。
  - 约束: 最小值: 0; 最大值: 2

- `top_p` — **可选**; `number | null`. 调整核采样参数；通常与 temperature 二选一。
  - 仅在显式将 reasoning.effort 设为 none 时支持。
  - 约束: 最小值: 0; 最大值: 1

- `top_logprobs` — **可选**; `integer | null`. 返回各输出位置最可能出现的 Token。
  - 仅在显式将 reasoning.effort 设为 none 时支持。
  - 约束: 最小值: 0; 最大值: 20

<details>
<summary>兼容参数</summary>

- `prompt_cache_retention` — **可选**; `string | null`. 已弃用的缓存保留策略；最低缓存有效期请使用 prompt_cache_options.ttl。
  - 约束: 24h

- `user` — **可选**; `string | null`. 已弃用的用户标识；缓存分组请使用 prompt_cache_key。当前渠道尚未开放 safety_identifier。

</details>

### 最小调用

#### cURL

```bash
curl --fail-with-body -X POST "https://open.scenepond.ai/v1/responses" \
  -H "Authorization: Bearer $SCENEPOND_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @- <<'JSON'
{
  "model": "gpt-6-luna",
  "input": "Hello!",
  "reasoning": {
    "effort": "medium"
  },
  "stream": false
}
JSON
```

#### Python

```python
import os
import json
from urllib.parse import quote
from urllib.request import Request, urlopen

payload = json.loads("{\n  \"model\": \"gpt-6-luna\",\n  \"input\": \"Hello!\",\n  \"reasoning\": {\n    \"effort\": \"medium\"\n  },\n  \"stream\": false\n}")

request = Request(
    "https://open.scenepond.ai/v1/responses",
    headers={
        "Authorization": "Bearer " + os.environ["SCENEPOND_API_KEY"],
        "Content-Type": "application/json",
    },
    data=json.dumps(payload).encode("utf-8"),
    method="POST",
)
with urlopen(request) as response:
    result = json.load(response)
print(json.dumps(result, indent=2))
```

#### JavaScript

```javascript
const response = await fetch("https://open.scenepond.ai/v1/responses", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.SCENEPOND_API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
  "model": "gpt-6-luna",
  "input": "Hello!",
  "reasoning": {
    "effort": "medium"
  },
  "stream": false
})
});
if (!response.ok) throw new Error(`API error: ${response.status} ${await response.text()}`);
const result = await response.json();
console.log(result);
```

### 可选参数示例

#### 包含可选参数的流式请求 1

##### cURL

```bash
curl --fail-with-body --no-buffer -X POST "https://open.scenepond.ai/v1/responses" \
  -H "Authorization: Bearer $SCENEPOND_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @- <<'JSON'
{
  "model": "gpt-6-luna",
  "input": [
    {
      "type": "message",
      "role": "user",
      "content": "Explain why leaves are green."
    }
  ],
  "instructions": "Answer briefly as JSON with an answer field.",
  "reasoning": {
    "effort": "medium",
    "mode": "standard",
    "summary": "auto",
    "context": "auto"
  },
  "max_output_tokens": 1024,
  "text": {
    "verbosity": "low",
    "format": {
      "type": "json_schema",
      "name": "answer",
      "description": "A short answer.",
      "strict": true,
      "schema": {
        "type": "object",
        "properties": {
          "answer": {
            "type": "string"
          }
        },
        "required": [
          "answer"
        ],
        "additionalProperties": false
      }
    }
  },
  "stream": true,
  "store": false,
  "metadata": {
    "example": "structured-output"
  },
  "prompt_cache_key": "science-answer-v1",
  "prompt_cache_options": {
    "ttl": "30m",
    "mode": "implicit"
  },
  "truncation": "disabled",
  "context_management": [
    {
      "type": "compaction",
      "compact_threshold": 100000
    }
  ]
}
JSON
```

##### Python

```python
import os
import json
import sys
from urllib.parse import quote
from urllib.request import Request, urlopen

payload = json.loads("{\n  \"model\": \"gpt-6-luna\",\n  \"input\": [\n    {\n      \"type\": \"message\",\n      \"role\": \"user\",\n      \"content\": \"Explain why leaves are green.\"\n    }\n  ],\n  \"instructions\": \"Answer briefly as JSON with an answer field.\",\n  \"reasoning\": {\n    \"effort\": \"medium\",\n    \"mode\": \"standard\",\n    \"summary\": \"auto\",\n    \"context\": \"auto\"\n  },\n  \"max_output_tokens\": 1024,\n  \"text\": {\n    \"verbosity\": \"low\",\n    \"format\": {\n      \"type\": \"json_schema\",\n      \"name\": \"answer\",\n      \"description\": \"A short answer.\",\n      \"strict\": true,\n      \"schema\": {\n        \"type\": \"object\",\n        \"properties\": {\n          \"answer\": {\n            \"type\": \"string\"\n          }\n        },\n        \"required\": [\n          \"answer\"\n        ],\n        \"additionalProperties\": false\n      }\n    }\n  },\n  \"stream\": true,\n  \"store\": false,\n  \"metadata\": {\n    \"example\": \"structured-output\"\n  },\n  \"prompt_cache_key\": \"science-answer-v1\",\n  \"prompt_cache_options\": {\n    \"ttl\": \"30m\",\n    \"mode\": \"implicit\"\n  },\n  \"truncation\": \"disabled\",\n  \"context_management\": [\n    {\n      \"type\": \"compaction\",\n      \"compact_threshold\": 100000\n    }\n  ]\n}")

request = Request(
    "https://open.scenepond.ai/v1/responses",
    headers={
        "Authorization": "Bearer " + os.environ["SCENEPOND_API_KEY"],
        "Content-Type": "application/json",
    },
    data=json.dumps(payload).encode("utf-8"),
    method="POST",
)
with urlopen(request) as response:
    for line in response:
        sys.stdout.buffer.write(line)
        sys.stdout.buffer.flush()
```

##### JavaScript

```javascript
const response = await fetch("https://open.scenepond.ai/v1/responses", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.SCENEPOND_API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
  "model": "gpt-6-luna",
  "input": [
    {
      "type": "message",
      "role": "user",
      "content": "Explain why leaves are green."
    }
  ],
  "instructions": "Answer briefly as JSON with an answer field.",
  "reasoning": {
    "effort": "medium",
    "mode": "standard",
    "summary": "auto",
    "context": "auto"
  },
  "max_output_tokens": 1024,
  "text": {
    "verbosity": "low",
    "format": {
      "type": "json_schema",
      "name": "answer",
      "description": "A short answer.",
      "strict": true,
      "schema": {
        "type": "object",
        "properties": {
          "answer": {
            "type": "string"
          }
        },
        "required": [
          "answer"
        ],
        "additionalProperties": false
      }
    }
  },
  "stream": true,
  "store": false,
  "metadata": {
    "example": "structured-output"
  },
  "prompt_cache_key": "science-answer-v1",
  "prompt_cache_options": {
    "ttl": "30m",
    "mode": "implicit"
  },
  "truncation": "disabled",
  "context_management": [
    {
      "type": "compaction",
      "compact_threshold": 100000
    }
  ]
})
});
if (!response.ok) throw new Error(`API error: ${response.status} ${await response.text()}`);
if (!response.body) throw new Error("Missing response stream");
const reader = response.body.getReader();
const decoder = new TextDecoder();
try {
  while (true) {
    const { value, done } = await reader.read();
    if (done) break;
    process.stdout.write(decoder.decode(value, { stream: true }));
  }
  process.stdout.write(decoder.decode());
} finally {
  await reader.cancel();
  reader.releaseLock();
}
```

#### 包含可选参数的函数调用 2

##### cURL

```bash
curl --fail-with-body -X POST "https://open.scenepond.ai/v1/responses" \
  -H "Authorization: Bearer $SCENEPOND_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @- <<'JSON'
{
  "model": "gpt-6-luna",
  "input": "What is the weather in Singapore?",
  "reasoning": {
    "effort": "medium"
  },
  "max_output_tokens": 1024,
  "tools": [
    {
      "type": "function",
      "name": "get_weather",
      "description": "Get the weather for a city.",
      "strict": true,
      "parameters": {
        "type": "object",
        "properties": {
          "city": {
            "type": "string"
          }
        },
        "required": [
          "city"
        ],
        "additionalProperties": false
      },
      "allowed_callers": [
        "direct"
      ]
    }
  ],
  "tool_choice": {
    "type": "function",
    "name": "get_weather"
  },
  "parallel_tool_calls": false,
  "stream": false
}
JSON
```

##### Python

```python
import os
import json
from urllib.parse import quote
from urllib.request import Request, urlopen

payload = json.loads("{\n  \"model\": \"gpt-6-luna\",\n  \"input\": \"What is the weather in Singapore?\",\n  \"reasoning\": {\n    \"effort\": \"medium\"\n  },\n  \"max_output_tokens\": 1024,\n  \"tools\": [\n    {\n      \"type\": \"function\",\n      \"name\": \"get_weather\",\n      \"description\": \"Get the weather for a city.\",\n      \"strict\": true,\n      \"parameters\": {\n        \"type\": \"object\",\n        \"properties\": {\n          \"city\": {\n            \"type\": \"string\"\n          }\n        },\n        \"required\": [\n          \"city\"\n        ],\n        \"additionalProperties\": false\n      },\n      \"allowed_callers\": [\n        \"direct\"\n      ]\n    }\n  ],\n  \"tool_choice\": {\n    \"type\": \"function\",\n    \"name\": \"get_weather\"\n  },\n  \"parallel_tool_calls\": false,\n  \"stream\": false\n}")

request = Request(
    "https://open.scenepond.ai/v1/responses",
    headers={
        "Authorization": "Bearer " + os.environ["SCENEPOND_API_KEY"],
        "Content-Type": "application/json",
    },
    data=json.dumps(payload).encode("utf-8"),
    method="POST",
)
with urlopen(request) as response:
    result = json.load(response)
print(json.dumps(result, indent=2))
```

##### JavaScript

```javascript
const response = await fetch("https://open.scenepond.ai/v1/responses", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.SCENEPOND_API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
  "model": "gpt-6-luna",
  "input": "What is the weather in Singapore?",
  "reasoning": {
    "effort": "medium"
  },
  "max_output_tokens": 1024,
  "tools": [
    {
      "type": "function",
      "name": "get_weather",
      "description": "Get the weather for a city.",
      "strict": true,
      "parameters": {
        "type": "object",
        "properties": {
          "city": {
            "type": "string"
          }
        },
        "required": [
          "city"
        ],
        "additionalProperties": false
      },
      "allowed_callers": [
        "direct"
      ]
    }
  ],
  "tool_choice": {
    "type": "function",
    "name": "get_weather"
  },
  "parallel_tool_calls": false,
  "stream": false
})
});
if (!response.ok) throw new Error(`API error: ${response.status} ${await response.text()}`);
const result = await response.json();
console.log(result);
```

#### 使用自动严格模式的函数 3

省略 strict，让 Responses 尝试将 schema 规范为严格模式，必要时回退为非严格调用。

##### cURL

```bash
curl --fail-with-body -X POST "https://open.scenepond.ai/v1/responses" \
  -H "Authorization: Bearer $SCENEPOND_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @- <<'JSON'
{
  "model": "gpt-6-luna",
  "input": "What is the weather in Singapore?",
  "max_output_tokens": 1024,
  "tools": [
    {
      "type": "function",
      "name": "get_weather",
      "description": "Get the weather for a city.",
      "parameters": {
        "type": "object",
        "properties": {
          "city": {
            "type": "string"
          }
        },
        "required": [
          "city"
        ],
        "additionalProperties": false
      }
    }
  ]
}
JSON
```

##### Python

```python
import os
import json
from urllib.parse import quote
from urllib.request import Request, urlopen

payload = json.loads("{\n  \"model\": \"gpt-6-luna\",\n  \"input\": \"What is the weather in Singapore?\",\n  \"max_output_tokens\": 1024,\n  \"tools\": [\n    {\n      \"type\": \"function\",\n      \"name\": \"get_weather\",\n      \"description\": \"Get the weather for a city.\",\n      \"parameters\": {\n        \"type\": \"object\",\n        \"properties\": {\n          \"city\": {\n            \"type\": \"string\"\n          }\n        },\n        \"required\": [\n          \"city\"\n        ],\n        \"additionalProperties\": false\n      }\n    }\n  ]\n}")

request = Request(
    "https://open.scenepond.ai/v1/responses",
    headers={
        "Authorization": "Bearer " + os.environ["SCENEPOND_API_KEY"],
        "Content-Type": "application/json",
    },
    data=json.dumps(payload).encode("utf-8"),
    method="POST",
)
with urlopen(request) as response:
    result = json.load(response)
print(json.dumps(result, indent=2))
```

##### JavaScript

```javascript
const response = await fetch("https://open.scenepond.ai/v1/responses", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.SCENEPOND_API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
  "model": "gpt-6-luna",
  "input": "What is the weather in Singapore?",
  "max_output_tokens": 1024,
  "tools": [
    {
      "type": "function",
      "name": "get_weather",
      "description": "Get the weather for a city.",
      "parameters": {
        "type": "object",
        "properties": {
          "city": {
            "type": "string"
          }
        },
        "required": [
          "city"
        ],
        "additionalProperties": false
      }
    }
  ]
})
});
if (!response.ok) throw new Error(`API error: ${response.status} ${await response.text()}`);
const result = await response.json();
console.log(result);
```

#### 使用函数结果继续响应 4

将 previous_response_id 和 call_id 替换为此前函数调用响应返回的真实 ID。

##### cURL

```bash
curl --fail-with-body -X POST "https://open.scenepond.ai/v1/responses" \
  -H "Authorization: Bearer $SCENEPOND_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @- <<'JSON'
{
  "model": "gpt-6-luna",
  "previous_response_id": "resp_REPLACE_WITH_PREVIOUS_RESPONSE_ID",
  "input": [
    {
      "type": "function_call_output",
      "call_id": "call_REPLACE_WITH_FUNCTION_CALL_ID",
      "output": "{\"temperature_c\":30,\"condition\":\"sunny\"}"
    }
  ],
  "reasoning": {
    "effort": "medium"
  },
  "max_output_tokens": 1024
}
JSON
```

##### Python

```python
import os
import json
from urllib.parse import quote
from urllib.request import Request, urlopen

payload = json.loads("{\n  \"model\": \"gpt-6-luna\",\n  \"previous_response_id\": \"resp_REPLACE_WITH_PREVIOUS_RESPONSE_ID\",\n  \"input\": [\n    {\n      \"type\": \"function_call_output\",\n      \"call_id\": \"call_REPLACE_WITH_FUNCTION_CALL_ID\",\n      \"output\": \"{\\\"temperature_c\\\":30,\\\"condition\\\":\\\"sunny\\\"}\"\n    }\n  ],\n  \"reasoning\": {\n    \"effort\": \"medium\"\n  },\n  \"max_output_tokens\": 1024\n}")

request = Request(
    "https://open.scenepond.ai/v1/responses",
    headers={
        "Authorization": "Bearer " + os.environ["SCENEPOND_API_KEY"],
        "Content-Type": "application/json",
    },
    data=json.dumps(payload).encode("utf-8"),
    method="POST",
)
with urlopen(request) as response:
    result = json.load(response)
print(json.dumps(result, indent=2))
```

##### JavaScript

```javascript
const response = await fetch("https://open.scenepond.ai/v1/responses", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.SCENEPOND_API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
  "model": "gpt-6-luna",
  "previous_response_id": "resp_REPLACE_WITH_PREVIOUS_RESPONSE_ID",
  "input": [
    {
      "type": "function_call_output",
      "call_id": "call_REPLACE_WITH_FUNCTION_CALL_ID",
      "output": "{\"temperature_c\":30,\"condition\":\"sunny\"}"
    }
  ],
  "reasoning": {
    "effort": "medium"
  },
  "max_output_tokens": 1024
})
});
if (!response.ok) throw new Error(`API error: ${response.status} ${await response.text()}`);
const result = await response.json();
console.log(result);
```

#### 包含可选参数的内置工具调用 5

##### cURL

```bash
curl --fail-with-body -X POST "https://open.scenepond.ai/v1/responses" \
  -H "Authorization: Bearer $SCENEPOND_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @- <<'JSON'
{
  "model": "gpt-6-luna",
  "input": "Find one recent astronomy discovery and cite its source.",
  "reasoning": {
    "effort": "medium"
  },
  "max_output_tokens": 1024,
  "tools": [
    {
      "type": "web_search",
      "external_web_access": true,
      "search_context_size": "medium",
      "return_token_budget": "default",
      "filters": {
        "allowed_domains": [
          "science.nasa.gov"
        ],
        "blocked_domains": [
          "example.org"
        ]
      },
      "user_location": {
        "type": "approximate",
        "country": "SG",
        "timezone": "Asia/Singapore"
      }
    }
  ],
  "tool_choice": "auto",
  "max_tool_calls": 2,
  "include": [
    "web_search_call.action.sources"
  ]
}
JSON
```

##### Python

```python
import os
import json
from urllib.parse import quote
from urllib.request import Request, urlopen

payload = json.loads("{\n  \"model\": \"gpt-6-luna\",\n  \"input\": \"Find one recent astronomy discovery and cite its source.\",\n  \"reasoning\": {\n    \"effort\": \"medium\"\n  },\n  \"max_output_tokens\": 1024,\n  \"tools\": [\n    {\n      \"type\": \"web_search\",\n      \"external_web_access\": true,\n      \"search_context_size\": \"medium\",\n      \"return_token_budget\": \"default\",\n      \"filters\": {\n        \"allowed_domains\": [\n          \"science.nasa.gov\"\n        ],\n        \"blocked_domains\": [\n          \"example.org\"\n        ]\n      },\n      \"user_location\": {\n        \"type\": \"approximate\",\n        \"country\": \"SG\",\n        \"timezone\": \"Asia/Singapore\"\n      }\n    }\n  ],\n  \"tool_choice\": \"auto\",\n  \"max_tool_calls\": 2,\n  \"include\": [\n    \"web_search_call.action.sources\"\n  ]\n}")

request = Request(
    "https://open.scenepond.ai/v1/responses",
    headers={
        "Authorization": "Bearer " + os.environ["SCENEPOND_API_KEY"],
        "Content-Type": "application/json",
    },
    data=json.dumps(payload).encode("utf-8"),
    method="POST",
)
with urlopen(request) as response:
    result = json.load(response)
print(json.dumps(result, indent=2))
```

##### JavaScript

```javascript
const response = await fetch("https://open.scenepond.ai/v1/responses", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.SCENEPOND_API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
  "model": "gpt-6-luna",
  "input": "Find one recent astronomy discovery and cite its source.",
  "reasoning": {
    "effort": "medium"
  },
  "max_output_tokens": 1024,
  "tools": [
    {
      "type": "web_search",
      "external_web_access": true,
      "search_context_size": "medium",
      "return_token_budget": "default",
      "filters": {
        "allowed_domains": [
          "science.nasa.gov"
        ],
        "blocked_domains": [
          "example.org"
        ]
      },
      "user_location": {
        "type": "approximate",
        "country": "SG",
        "timezone": "Asia/Singapore"
      }
    }
  ],
  "tool_choice": "auto",
  "max_tool_calls": 2,
  "include": [
    "web_search_call.action.sources"
  ]
})
});
if (!response.ok) throw new Error(`API error: ${response.status} ${await response.text()}`);
const result = await response.json();
console.log(result);
```

#### 已保存提示词与会话选项 6

将提示词和会话 ID 替换为账户中已有资源的真实 ID；使用 conversation 时请省略 previous_response_id。

##### cURL

```bash
curl --fail-with-body -X POST "https://open.scenepond.ai/v1/responses" \
  -H "Authorization: Bearer $SCENEPOND_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @- <<'JSON'
{
  "model": "gpt-6-luna",
  "input": "Explain why leaves are green.",
  "conversation": {
    "id": "conv_REPLACE_WITH_CONVERSATION_ID"
  },
  "prompt": {
    "id": "pmpt_REPLACE_WITH_PROMPT_ID",
    "version": "1",
    "variables": {
      "topic": "green leaves"
    }
  },
  "max_output_tokens": 1024
}
JSON
```

##### Python

```python
import os
import json
from urllib.parse import quote
from urllib.request import Request, urlopen

payload = json.loads("{\n  \"model\": \"gpt-6-luna\",\n  \"input\": \"Explain why leaves are green.\",\n  \"conversation\": {\n    \"id\": \"conv_REPLACE_WITH_CONVERSATION_ID\"\n  },\n  \"prompt\": {\n    \"id\": \"pmpt_REPLACE_WITH_PROMPT_ID\",\n    \"version\": \"1\",\n    \"variables\": {\n      \"topic\": \"green leaves\"\n    }\n  },\n  \"max_output_tokens\": 1024\n}")

request = Request(
    "https://open.scenepond.ai/v1/responses",
    headers={
        "Authorization": "Bearer " + os.environ["SCENEPOND_API_KEY"],
        "Content-Type": "application/json",
    },
    data=json.dumps(payload).encode("utf-8"),
    method="POST",
)
with urlopen(request) as response:
    result = json.load(response)
print(json.dumps(result, indent=2))
```

##### JavaScript

```javascript
const response = await fetch("https://open.scenepond.ai/v1/responses", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.SCENEPOND_API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
  "model": "gpt-6-luna",
  "input": "Explain why leaves are green.",
  "conversation": {
    "id": "conv_REPLACE_WITH_CONVERSATION_ID"
  },
  "prompt": {
    "id": "pmpt_REPLACE_WITH_PROMPT_ID",
    "version": "1",
    "variables": {
      "topic": "green leaves"
    }
  },
  "max_output_tokens": 1024
})
});
if (!response.ok) throw new Error(`API error: ${response.status} ${await response.text()}`);
const result = await response.json();
console.log(result);
```

#### 提示词缓存诊断选项 7

将 comparison_response_id 替换为账户中此前的真实响应 ID；诊断功能需要相应权限。

##### cURL

```bash
curl --fail-with-body -X POST "https://open.scenepond.ai/v1/responses" \
  -H "Authorization: Bearer $SCENEPOND_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @- <<'JSON'
{
  "model": "gpt-6-luna",
  "input": "Explain why leaves are green.",
  "max_output_tokens": 1024,
  "prompt_cache_options": {
    "ttl": "30m",
    "mode": "implicit",
    "comparison_response_id": "resp_REPLACE_WITH_COMPARISON_ID",
    "prewarm": false
  }
}
JSON
```

##### Python

```python
import os
import json
from urllib.parse import quote
from urllib.request import Request, urlopen

payload = json.loads("{\n  \"model\": \"gpt-6-luna\",\n  \"input\": \"Explain why leaves are green.\",\n  \"max_output_tokens\": 1024,\n  \"prompt_cache_options\": {\n    \"ttl\": \"30m\",\n    \"mode\": \"implicit\",\n    \"comparison_response_id\": \"resp_REPLACE_WITH_COMPARISON_ID\",\n    \"prewarm\": false\n  }\n}")

request = Request(
    "https://open.scenepond.ai/v1/responses",
    headers={
        "Authorization": "Bearer " + os.environ["SCENEPOND_API_KEY"],
        "Content-Type": "application/json",
    },
    data=json.dumps(payload).encode("utf-8"),
    method="POST",
)
with urlopen(request) as response:
    result = json.load(response)
print(json.dumps(result, indent=2))
```

##### JavaScript

```javascript
const response = await fetch("https://open.scenepond.ai/v1/responses", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.SCENEPOND_API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
  "model": "gpt-6-luna",
  "input": "Explain why leaves are green.",
  "max_output_tokens": 1024,
  "prompt_cache_options": {
    "ttl": "30m",
    "mode": "implicit",
    "comparison_response_id": "resp_REPLACE_WITH_COMPARISON_ID",
    "prewarm": false
  }
})
});
if (!response.ok) throw new Error(`API error: ${response.status} ${await response.text()}`);
const result = await response.json();
console.log(result);
```

#### 随生成请求返回内容审核结果 8

请求随生成响应返回输入和输出的内容审核结果。展示输出前请检查结果；流式评分在完整输出结束后返回。

##### cURL

```bash
curl --fail-with-body -X POST "https://open.scenepond.ai/v1/responses" \
  -H "Authorization: Bearer $SCENEPOND_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @- <<'JSON'
{
  "model": "gpt-6-luna",
  "input": "Write one harmless sentence about a garden.",
  "max_output_tokens": 1024,
  "moderation": {
    "model": "omni-moderation-latest",
    "policy": {
      "input": {
        "mode": "score"
      },
      "output": {
        "mode": "score"
      }
    }
  }
}
JSON
```

##### Python

```python
import os
import json
from urllib.parse import quote
from urllib.request import Request, urlopen

payload = json.loads("{\n  \"model\": \"gpt-6-luna\",\n  \"input\": \"Write one harmless sentence about a garden.\",\n  \"max_output_tokens\": 1024,\n  \"moderation\": {\n    \"model\": \"omni-moderation-latest\",\n    \"policy\": {\n      \"input\": {\n        \"mode\": \"score\"\n      },\n      \"output\": {\n        \"mode\": \"score\"\n      }\n    }\n  }\n}")

request = Request(
    "https://open.scenepond.ai/v1/responses",
    headers={
        "Authorization": "Bearer " + os.environ["SCENEPOND_API_KEY"],
        "Content-Type": "application/json",
    },
    data=json.dumps(payload).encode("utf-8"),
    method="POST",
)
with urlopen(request) as response:
    result = json.load(response)
print(json.dumps(result, indent=2))
```

##### JavaScript

```javascript
const response = await fetch("https://open.scenepond.ai/v1/responses", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.SCENEPOND_API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
  "model": "gpt-6-luna",
  "input": "Write one harmless sentence about a garden.",
  "max_output_tokens": 1024,
  "moderation": {
    "model": "omni-moderation-latest",
    "policy": {
      "input": {
        "mode": "score"
      },
      "output": {
        "mode": "score"
      }
    }
  }
})
});
if (!response.ok) throw new Error(`API error: ${response.status} ${await response.text()}`);
const result = await response.json();
console.log(result);
```

#### 在轮次之间调整推理力度 9

请替换为之前响应的 ID。在 standard 单智能体模式下，更新仅改变 effort，保留请求级推理设置和缓存前缀。不要启用自动压缩或自动截断。

##### cURL

```bash
curl --fail-with-body -X POST "https://open.scenepond.ai/v1/responses" \
  -H "Authorization: Bearer $SCENEPOND_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @- <<'JSON'
{
  "model": "gpt-6-luna",
  "previous_response_id": "resp_REPLACE_WITH_PREVIOUS_RESPONSE_ID",
  "reasoning": {
    "effort": "medium",
    "mode": "standard"
  },
  "input": [
    {
      "type": "configuration_update",
      "reasoning": {
        "effort": "high"
      }
    },
    {
      "role": "user",
      "content": "Now examine the difficult cases."
    }
  ],
  "max_output_tokens": 1024,
  "truncation": "disabled"
}
JSON
```

##### Python

```python
import os
import json
from urllib.parse import quote
from urllib.request import Request, urlopen

payload = json.loads("{\n  \"model\": \"gpt-6-luna\",\n  \"previous_response_id\": \"resp_REPLACE_WITH_PREVIOUS_RESPONSE_ID\",\n  \"reasoning\": {\n    \"effort\": \"medium\",\n    \"mode\": \"standard\"\n  },\n  \"input\": [\n    {\n      \"type\": \"configuration_update\",\n      \"reasoning\": {\n        \"effort\": \"high\"\n      }\n    },\n    {\n      \"role\": \"user\",\n      \"content\": \"Now examine the difficult cases.\"\n    }\n  ],\n  \"max_output_tokens\": 1024,\n  \"truncation\": \"disabled\"\n}")

request = Request(
    "https://open.scenepond.ai/v1/responses",
    headers={
        "Authorization": "Bearer " + os.environ["SCENEPOND_API_KEY"],
        "Content-Type": "application/json",
    },
    data=json.dumps(payload).encode("utf-8"),
    method="POST",
)
with urlopen(request) as response:
    result = json.load(response)
print(json.dumps(result, indent=2))
```

##### JavaScript

```javascript
const response = await fetch("https://open.scenepond.ai/v1/responses", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.SCENEPOND_API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
  "model": "gpt-6-luna",
  "previous_response_id": "resp_REPLACE_WITH_PREVIOUS_RESPONSE_ID",
  "reasoning": {
    "effort": "medium",
    "mode": "standard"
  },
  "input": [
    {
      "type": "configuration_update",
      "reasoning": {
        "effort": "high"
      }
    },
    {
      "role": "user",
      "content": "Now examine the difficult cases."
    }
  ],
  "max_output_tokens": 1024,
  "truncation": "disabled"
})
});
if (!response.ok) throw new Error(`API error: ${response.status} ${await response.text()}`);
const result = await response.json();
console.log(result);
```

#### 显式压缩上下文 10

请替换为之前响应的 ID。显式压缩后，如需恢复调整后的推理力度，请在下一条用户消息之前重新添加 configuration_update。

##### cURL

```bash
curl --fail-with-body -X POST "https://open.scenepond.ai/v1/responses" \
  -H "Authorization: Bearer $SCENEPOND_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @- <<'JSON'
{
  "model": "gpt-6-luna",
  "previous_response_id": "resp_REPLACE_WITH_PREVIOUS_RESPONSE_ID",
  "reasoning": {
    "effort": "medium",
    "mode": "standard"
  },
  "input": [
    {
      "type": "compaction_trigger"
    },
    {
      "role": "user",
      "content": "Continue with the remaining work."
    }
  ],
  "max_output_tokens": 1024
}
JSON
```

##### Python

```python
import os
import json
from urllib.parse import quote
from urllib.request import Request, urlopen

payload = json.loads("{\n  \"model\": \"gpt-6-luna\",\n  \"previous_response_id\": \"resp_REPLACE_WITH_PREVIOUS_RESPONSE_ID\",\n  \"reasoning\": {\n    \"effort\": \"medium\",\n    \"mode\": \"standard\"\n  },\n  \"input\": [\n    {\n      \"type\": \"compaction_trigger\"\n    },\n    {\n      \"role\": \"user\",\n      \"content\": \"Continue with the remaining work.\"\n    }\n  ],\n  \"max_output_tokens\": 1024\n}")

request = Request(
    "https://open.scenepond.ai/v1/responses",
    headers={
        "Authorization": "Bearer " + os.environ["SCENEPOND_API_KEY"],
        "Content-Type": "application/json",
    },
    data=json.dumps(payload).encode("utf-8"),
    method="POST",
)
with urlopen(request) as response:
    result = json.load(response)
print(json.dumps(result, indent=2))
```

##### JavaScript

```javascript
const response = await fetch("https://open.scenepond.ai/v1/responses", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.SCENEPOND_API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
  "model": "gpt-6-luna",
  "previous_response_id": "resp_REPLACE_WITH_PREVIOUS_RESPONSE_ID",
  "reasoning": {
    "effort": "medium",
    "mode": "standard"
  },
  "input": [
    {
      "type": "compaction_trigger"
    },
    {
      "role": "user",
      "content": "Continue with the remaining work."
    }
  ],
  "max_output_tokens": 1024
})
});
if (!response.ok) throw new Error(`API error: ${response.status} ${await response.text()}`);
const result = await response.json();
console.log(result);
```

#### 命名空间工具与工具搜索 11

##### cURL

```bash
curl --fail-with-body -X POST "https://open.scenepond.ai/v1/responses" \
  -H "Authorization: Bearer $SCENEPOND_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @- <<'JSON'
{
  "model": "gpt-6-luna",
  "input": "What is the weather in Singapore?",
  "max_output_tokens": 1024,
  "tools": [
    {
      "type": "namespace",
      "name": "weather",
      "description": "Public weather utilities.",
      "tools": [
        {
          "type": "function",
          "name": "get_weather",
          "description": "Get the weather for a city.",
          "strict": true,
          "parameters": {
            "type": "object",
            "properties": {
              "city": {
                "type": "string"
              }
            },
            "required": [
              "city"
            ],
            "additionalProperties": false
          },
          "defer_loading": true
        },
        {
          "type": "function",
          "name": "get_time"
        }
      ]
    },
    {
      "type": "tool_search",
      "execution": "server"
    }
  ]
}
JSON
```

##### Python

```python
import os
import json
from urllib.parse import quote
from urllib.request import Request, urlopen

payload = json.loads("{\n  \"model\": \"gpt-6-luna\",\n  \"input\": \"What is the weather in Singapore?\",\n  \"max_output_tokens\": 1024,\n  \"tools\": [\n    {\n      \"type\": \"namespace\",\n      \"name\": \"weather\",\n      \"description\": \"Public weather utilities.\",\n      \"tools\": [\n        {\n          \"type\": \"function\",\n          \"name\": \"get_weather\",\n          \"description\": \"Get the weather for a city.\",\n          \"strict\": true,\n          \"parameters\": {\n            \"type\": \"object\",\n            \"properties\": {\n              \"city\": {\n                \"type\": \"string\"\n              }\n            },\n            \"required\": [\n              \"city\"\n            ],\n            \"additionalProperties\": false\n          },\n          \"defer_loading\": true\n        },\n        {\n          \"type\": \"function\",\n          \"name\": \"get_time\"\n        }\n      ]\n    },\n    {\n      \"type\": \"tool_search\",\n      \"execution\": \"server\"\n    }\n  ]\n}")

request = Request(
    "https://open.scenepond.ai/v1/responses",
    headers={
        "Authorization": "Bearer " + os.environ["SCENEPOND_API_KEY"],
        "Content-Type": "application/json",
    },
    data=json.dumps(payload).encode("utf-8"),
    method="POST",
)
with urlopen(request) as response:
    result = json.load(response)
print(json.dumps(result, indent=2))
```

##### JavaScript

```javascript
const response = await fetch("https://open.scenepond.ai/v1/responses", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.SCENEPOND_API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
  "model": "gpt-6-luna",
  "input": "What is the weather in Singapore?",
  "max_output_tokens": 1024,
  "tools": [
    {
      "type": "namespace",
      "name": "weather",
      "description": "Public weather utilities.",
      "tools": [
        {
          "type": "function",
          "name": "get_weather",
          "description": "Get the weather for a city.",
          "strict": true,
          "parameters": {
            "type": "object",
            "properties": {
              "city": {
                "type": "string"
              }
            },
            "required": [
              "city"
            ],
            "additionalProperties": false
          },
          "defer_loading": true
        },
        {
          "type": "function",
          "name": "get_time"
        }
      ]
    },
    {
      "type": "tool_search",
      "execution": "server"
    }
  ]
})
});
if (!response.ok) throw new Error(`API error: ${response.status} ${await response.text()}`);
const result = await response.json();
console.log(result);
```

#### 程序化函数调用 12

托管程序可协调调用符合条件的工具。由客户端负责的函数仍由你的应用执行，并使用原始 call_id 和 caller 上下文返回结果。

##### cURL

```bash
curl --fail-with-body -X POST "https://open.scenepond.ai/v1/responses" \
  -H "Authorization: Bearer $SCENEPOND_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @- <<'JSON'
{
  "model": "gpt-6-luna",
  "input": "Compare the weather in Singapore and Paris.",
  "reasoning": {
    "effort": "medium"
  },
  "max_output_tokens": 1024,
  "tools": [
    {
      "type": "function",
      "name": "get_weather",
      "description": "Get the weather for a city.",
      "strict": true,
      "parameters": {
        "type": "object",
        "properties": {
          "city": {
            "type": "string"
          }
        },
        "required": [
          "city"
        ],
        "additionalProperties": false
      },
      "allowed_callers": [
        "programmatic"
      ],
      "output_schema": {
        "type": "object",
        "properties": {
          "temperature_c": {
            "type": "number"
          }
        },
        "required": [
          "temperature_c"
        ],
        "additionalProperties": false
      }
    },
    {
      "type": "programmatic_tool_calling"
    }
  ],
  "tool_choice": {
    "type": "programmatic_tool_calling"
  }
}
JSON
```

##### Python

```python
import os
import json
from urllib.parse import quote
from urllib.request import Request, urlopen

payload = json.loads("{\n  \"model\": \"gpt-6-luna\",\n  \"input\": \"Compare the weather in Singapore and Paris.\",\n  \"reasoning\": {\n    \"effort\": \"medium\"\n  },\n  \"max_output_tokens\": 1024,\n  \"tools\": [\n    {\n      \"type\": \"function\",\n      \"name\": \"get_weather\",\n      \"description\": \"Get the weather for a city.\",\n      \"strict\": true,\n      \"parameters\": {\n        \"type\": \"object\",\n        \"properties\": {\n          \"city\": {\n            \"type\": \"string\"\n          }\n        },\n        \"required\": [\n          \"city\"\n        ],\n        \"additionalProperties\": false\n      },\n      \"allowed_callers\": [\n        \"programmatic\"\n      ],\n      \"output_schema\": {\n        \"type\": \"object\",\n        \"properties\": {\n          \"temperature_c\": {\n            \"type\": \"number\"\n          }\n        },\n        \"required\": [\n          \"temperature_c\"\n        ],\n        \"additionalProperties\": false\n      }\n    },\n    {\n      \"type\": \"programmatic_tool_calling\"\n    }\n  ],\n  \"tool_choice\": {\n    \"type\": \"programmatic_tool_calling\"\n  }\n}")

request = Request(
    "https://open.scenepond.ai/v1/responses",
    headers={
        "Authorization": "Bearer " + os.environ["SCENEPOND_API_KEY"],
        "Content-Type": "application/json",
    },
    data=json.dumps(payload).encode("utf-8"),
    method="POST",
)
with urlopen(request) as response:
    result = json.load(response)
print(json.dumps(result, indent=2))
```

##### JavaScript

```javascript
const response = await fetch("https://open.scenepond.ai/v1/responses", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.SCENEPOND_API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
  "model": "gpt-6-luna",
  "input": "Compare the weather in Singapore and Paris.",
  "reasoning": {
    "effort": "medium"
  },
  "max_output_tokens": 1024,
  "tools": [
    {
      "type": "function",
      "name": "get_weather",
      "description": "Get the weather for a city.",
      "strict": true,
      "parameters": {
        "type": "object",
        "properties": {
          "city": {
            "type": "string"
          }
        },
        "required": [
          "city"
        ],
        "additionalProperties": false
      },
      "allowed_callers": [
        "programmatic"
      ],
      "output_schema": {
        "type": "object",
        "properties": {
          "temperature_c": {
            "type": "number"
          }
        },
        "required": [
          "temperature_c"
        ],
        "additionalProperties": false
      }
    },
    {
      "type": "programmatic_tool_calling"
    }
  ],
  "tool_choice": {
    "type": "programmatic_tool_calling"
  }
})
});
if (!response.ok) throw new Error(`API error: ${response.status} ${await response.text()}`);
const result = await response.json();
console.log(result);
```

#### 内嵌 PDF 和图片输入 13

此示例内嵌一份完整的 PDF。Responses 也支持 file_url；file_id 必须引用执行请求的上游账户中已有的文件。

##### cURL

```bash
curl --fail-with-body -X POST "https://open.scenepond.ai/v1/responses" \
  -H "Authorization: Bearer $SCENEPOND_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @- <<'JSON'
{
  "model": "gpt-6-luna",
  "reasoning": {
    "effort": "medium"
  },
  "max_output_tokens": 1024,
  "input": [
    {
      "type": "message",
      "role": "user",
      "content": [
        {
          "type": "input_text",
          "text": "Read the PDF and describe the image.",
          "prompt_cache_breakpoint": {
            "mode": "explicit"
          }
        },
        {
          "type": "input_file",
          "filename": "sample.pdf",
          "file_data": "data:application/pdf;base64,JVBERi0xLjQKMSAwIG9iago8PCAvVHlwZSAvQ2F0YWxvZyAvUGFnZXMgMiAwIFIgPj4KZW5kb2JqCjIgMCBvYmoKPDwgL1R5cGUgL1BhZ2VzIC9LaWRzIFszIDAgUl0gL0NvdW50IDEgPj4KZW5kb2JqCjMgMCBvYmoKPDwgL1R5cGUgL1BhZ2UgL1BhcmVudCAyIDAgUiAvTWVkaWFCb3ggWzAgMCAzMDAgMTQ0XSAvUmVzb3VyY2VzIDw8IC9Gb250IDw8IC9GMSA0IDAgUiA+PiA+PiAvQ29udGVudHMgNSAwIFIgPj4KZW5kb2JqCjQgMCBvYmoKPDwgL1R5cGUgL0ZvbnQgL1N1YnR5cGUgL1R5cGUxIC9CYXNlRm9udCAvSGVsdmV0aWNhID4+CmVuZG9iago1IDAgb2JqCjw8IC9MZW5ndGggNTcgPj4Kc3RyZWFtCkJUIC9GMSAxMiBUZiAyMCAxMDAgVGQgKFNjZW5lcG9uZCBzYW1wbGUgZG9jdW1lbnQuKSBUaiBFVAplbmRzdHJlYW0KZW5kb2JqCnhyZWYKMCA2CjAwMDAwMDAwMDAgNjU1MzUgZiAKMDAwMDAwMDAwOSAwMDAwMCBuIAowMDAwMDAwMDU4IDAwMDAwIG4gCjAwMDAwMDAxMTUgMDAwMDAgbiAKMDAwMDAwMDI0MSAwMDAwMCBuIAowMDAwMDAwMzExIDAwMDAwIG4gCnRyYWlsZXIKPDwgL1NpemUgNiAvUm9vdCAxIDAgUiA+PgpzdGFydHhyZWYKNDE4CiUlRU9GCg==",
          "detail": "low"
        },
        {
          "type": "input_image",
          "image_url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg",
          "detail": "auto"
        }
      ]
    }
  ],
  "prompt_cache_options": {
    "ttl": "30m",
    "mode": "explicit"
  }
}
JSON
```

##### Python

```python
import os
import json
from urllib.parse import quote
from urllib.request import Request, urlopen

payload = json.loads("{\n  \"model\": \"gpt-6-luna\",\n  \"reasoning\": {\n    \"effort\": \"medium\"\n  },\n  \"max_output_tokens\": 1024,\n  \"input\": [\n    {\n      \"type\": \"message\",\n      \"role\": \"user\",\n      \"content\": [\n        {\n          \"type\": \"input_text\",\n          \"text\": \"Read the PDF and describe the image.\",\n          \"prompt_cache_breakpoint\": {\n            \"mode\": \"explicit\"\n          }\n        },\n        {\n          \"type\": \"input_file\",\n          \"filename\": \"sample.pdf\",\n          \"file_data\": \"data:application/pdf;base64,JVBERi0xLjQKMSAwIG9iago8PCAvVHlwZSAvQ2F0YWxvZyAvUGFnZXMgMiAwIFIgPj4KZW5kb2JqCjIgMCBvYmoKPDwgL1R5cGUgL1BhZ2VzIC9LaWRzIFszIDAgUl0gL0NvdW50IDEgPj4KZW5kb2JqCjMgMCBvYmoKPDwgL1R5cGUgL1BhZ2UgL1BhcmVudCAyIDAgUiAvTWVkaWFCb3ggWzAgMCAzMDAgMTQ0XSAvUmVzb3VyY2VzIDw8IC9Gb250IDw8IC9GMSA0IDAgUiA+PiA+PiAvQ29udGVudHMgNSAwIFIgPj4KZW5kb2JqCjQgMCBvYmoKPDwgL1R5cGUgL0ZvbnQgL1N1YnR5cGUgL1R5cGUxIC9CYXNlRm9udCAvSGVsdmV0aWNhID4+CmVuZG9iago1IDAgb2JqCjw8IC9MZW5ndGggNTcgPj4Kc3RyZWFtCkJUIC9GMSAxMiBUZiAyMCAxMDAgVGQgKFNjZW5lcG9uZCBzYW1wbGUgZG9jdW1lbnQuKSBUaiBFVAplbmRzdHJlYW0KZW5kb2JqCnhyZWYKMCA2CjAwMDAwMDAwMDAgNjU1MzUgZiAKMDAwMDAwMDAwOSAwMDAwMCBuIAowMDAwMDAwMDU4IDAwMDAwIG4gCjAwMDAwMDAxMTUgMDAwMDAgbiAKMDAwMDAwMDI0MSAwMDAwMCBuIAowMDAwMDAwMzExIDAwMDAwIG4gCnRyYWlsZXIKPDwgL1NpemUgNiAvUm9vdCAxIDAgUiA+PgpzdGFydHhyZWYKNDE4CiUlRU9GCg==\",\n          \"detail\": \"low\"\n        },\n        {\n          \"type\": \"input_image\",\n          \"image_url\": \"https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg\",\n          \"detail\": \"auto\"\n        }\n      ]\n    }\n  ],\n  \"prompt_cache_options\": {\n    \"ttl\": \"30m\",\n    \"mode\": \"explicit\"\n  }\n}")

request = Request(
    "https://open.scenepond.ai/v1/responses",
    headers={
        "Authorization": "Bearer " + os.environ["SCENEPOND_API_KEY"],
        "Content-Type": "application/json",
    },
    data=json.dumps(payload).encode("utf-8"),
    method="POST",
)
with urlopen(request) as response:
    result = json.load(response)
print(json.dumps(result, indent=2))
```

##### JavaScript

```javascript
const response = await fetch("https://open.scenepond.ai/v1/responses", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.SCENEPOND_API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
  "model": "gpt-6-luna",
  "reasoning": {
    "effort": "medium"
  },
  "max_output_tokens": 1024,
  "input": [
    {
      "type": "message",
      "role": "user",
      "content": [
        {
          "type": "input_text",
          "text": "Read the PDF and describe the image.",
          "prompt_cache_breakpoint": {
            "mode": "explicit"
          }
        },
        {
          "type": "input_file",
          "filename": "sample.pdf",
          "file_data": "data:application/pdf;base64,JVBERi0xLjQKMSAwIG9iago8PCAvVHlwZSAvQ2F0YWxvZyAvUGFnZXMgMiAwIFIgPj4KZW5kb2JqCjIgMCBvYmoKPDwgL1R5cGUgL1BhZ2VzIC9LaWRzIFszIDAgUl0gL0NvdW50IDEgPj4KZW5kb2JqCjMgMCBvYmoKPDwgL1R5cGUgL1BhZ2UgL1BhcmVudCAyIDAgUiAvTWVkaWFCb3ggWzAgMCAzMDAgMTQ0XSAvUmVzb3VyY2VzIDw8IC9Gb250IDw8IC9GMSA0IDAgUiA+PiA+PiAvQ29udGVudHMgNSAwIFIgPj4KZW5kb2JqCjQgMCBvYmoKPDwgL1R5cGUgL0ZvbnQgL1N1YnR5cGUgL1R5cGUxIC9CYXNlRm9udCAvSGVsdmV0aWNhID4+CmVuZG9iago1IDAgb2JqCjw8IC9MZW5ndGggNTcgPj4Kc3RyZWFtCkJUIC9GMSAxMiBUZiAyMCAxMDAgVGQgKFNjZW5lcG9uZCBzYW1wbGUgZG9jdW1lbnQuKSBUaiBFVAplbmRzdHJlYW0KZW5kb2JqCnhyZWYKMCA2CjAwMDAwMDAwMDAgNjU1MzUgZiAKMDAwMDAwMDAwOSAwMDAwMCBuIAowMDAwMDAwMDU4IDAwMDAwIG4gCjAwMDAwMDAxMTUgMDAwMDAgbiAKMDAwMDAwMDI0MSAwMDAwMCBuIAowMDAwMDAwMzExIDAwMDAwIG4gCnRyYWlsZXIKPDwgL1NpemUgNiAvUm9vdCAxIDAgUiA+PgpzdGFydHhyZWYKNDE4CiUlRU9GCg==",
          "detail": "low"
        },
        {
          "type": "input_image",
          "image_url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg",
          "detail": "auto"
        }
      ]
    }
  ],
  "prompt_cache_options": {
    "ttl": "30m",
    "mode": "explicit"
  }
})
});
if (!response.ok) throw new Error(`API error: ${response.status} ${await response.text()}`);
const result = await response.json();
console.log(result);
```

#### 代码解释器容器选项 14

内置工具需要上游工具权限，可能产生工具费用。此示例创建一个禁用外部网络的独立容器。

##### cURL

```bash
curl --fail-with-body -X POST "https://open.scenepond.ai/v1/responses" \
  -H "Authorization: Bearer $SCENEPOND_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @- <<'JSON'
{
  "model": "gpt-6-luna",
  "input": "Use Python to calculate 17 times 23.",
  "max_output_tokens": 1024,
  "tools": [
    {
      "type": "code_interpreter",
      "container": {
        "type": "auto",
        "memory_limit": "1g",
        "network_policy": {
          "type": "disabled"
        }
      }
    }
  ]
}
JSON
```

##### Python

```python
import os
import json
from urllib.parse import quote
from urllib.request import Request, urlopen

payload = json.loads("{\n  \"model\": \"gpt-6-luna\",\n  \"input\": \"Use Python to calculate 17 times 23.\",\n  \"max_output_tokens\": 1024,\n  \"tools\": [\n    {\n      \"type\": \"code_interpreter\",\n      \"container\": {\n        \"type\": \"auto\",\n        \"memory_limit\": \"1g\",\n        \"network_policy\": {\n          \"type\": \"disabled\"\n        }\n      }\n    }\n  ]\n}")

request = Request(
    "https://open.scenepond.ai/v1/responses",
    headers={
        "Authorization": "Bearer " + os.environ["SCENEPOND_API_KEY"],
        "Content-Type": "application/json",
    },
    data=json.dumps(payload).encode("utf-8"),
    method="POST",
)
with urlopen(request) as response:
    result = json.load(response)
print(json.dumps(result, indent=2))
```

##### JavaScript

```javascript
const response = await fetch("https://open.scenepond.ai/v1/responses", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.SCENEPOND_API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
  "model": "gpt-6-luna",
  "input": "Use Python to calculate 17 times 23.",
  "max_output_tokens": 1024,
  "tools": [
    {
      "type": "code_interpreter",
      "container": {
        "type": "auto",
        "memory_limit": "1g",
        "network_policy": {
          "type": "disabled"
        }
      }
    }
  ]
})
});
if (!response.ok) throw new Error(`API error: ${response.status} ${await response.text()}`);
const result = await response.json();
console.log(result);
```

#### 文件搜索筛选和排序 15

请将 vector_store_ids 替换为执行请求的上游账户中已有的向量库 ID。

##### cURL

```bash
curl --fail-with-body -X POST "https://open.scenepond.ai/v1/responses" \
  -H "Authorization: Bearer $SCENEPOND_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @- <<'JSON'
{
  "model": "gpt-6-luna",
  "input": "Find the most relevant public onboarding note.",
  "max_output_tokens": 1024,
  "tools": [
    {
      "type": "file_search",
      "vector_store_ids": [
        "vs_REPLACE_WITH_VECTOR_STORE_ID"
      ],
      "max_num_results": 5,
      "filters": {
        "type": "and",
        "filters": [
          {
            "type": "eq",
            "key": "category",
            "value": "onboarding"
          }
        ]
      },
      "ranking_options": {
        "ranker": "auto",
        "score_threshold": 0.5,
        "hybrid_search": {
          "embedding_weight": 1,
          "text_weight": 1
        }
      }
    }
  ],
  "include": [
    "file_search_call.results"
  ]
}
JSON
```

##### Python

```python
import os
import json
from urllib.parse import quote
from urllib.request import Request, urlopen

payload = json.loads("{\n  \"model\": \"gpt-6-luna\",\n  \"input\": \"Find the most relevant public onboarding note.\",\n  \"max_output_tokens\": 1024,\n  \"tools\": [\n    {\n      \"type\": \"file_search\",\n      \"vector_store_ids\": [\n        \"vs_REPLACE_WITH_VECTOR_STORE_ID\"\n      ],\n      \"max_num_results\": 5,\n      \"filters\": {\n        \"type\": \"and\",\n        \"filters\": [\n          {\n            \"type\": \"eq\",\n            \"key\": \"category\",\n            \"value\": \"onboarding\"\n          }\n        ]\n      },\n      \"ranking_options\": {\n        \"ranker\": \"auto\",\n        \"score_threshold\": 0.5,\n        \"hybrid_search\": {\n          \"embedding_weight\": 1,\n          \"text_weight\": 1\n        }\n      }\n    }\n  ],\n  \"include\": [\n    \"file_search_call.results\"\n  ]\n}")

request = Request(
    "https://open.scenepond.ai/v1/responses",
    headers={
        "Authorization": "Bearer " + os.environ["SCENEPOND_API_KEY"],
        "Content-Type": "application/json",
    },
    data=json.dumps(payload).encode("utf-8"),
    method="POST",
)
with urlopen(request) as response:
    result = json.load(response)
print(json.dumps(result, indent=2))
```

##### JavaScript

```javascript
const response = await fetch("https://open.scenepond.ai/v1/responses", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.SCENEPOND_API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
  "model": "gpt-6-luna",
  "input": "Find the most relevant public onboarding note.",
  "max_output_tokens": 1024,
  "tools": [
    {
      "type": "file_search",
      "vector_store_ids": [
        "vs_REPLACE_WITH_VECTOR_STORE_ID"
      ],
      "max_num_results": 5,
      "filters": {
        "type": "and",
        "filters": [
          {
            "type": "eq",
            "key": "category",
            "value": "onboarding"
          }
        ]
      },
      "ranking_options": {
        "ranker": "auto",
        "score_threshold": 0.5,
        "hybrid_search": {
          "embedding_weight": 1,
          "text_weight": 1
        }
      }
    }
  ],
  "include": [
    "file_search_call.results"
  ]
})
});
if (!response.ok) throw new Error(`API error: ${response.status} ${await response.text()}`);
const result = await response.json();
console.log(result);
```

#### 图像生成工具选项 16

此工具通过上游图像模型生成图片，可能产生工具费用；聊天模型仍返回文本和工具结果。

##### cURL

```bash
curl --fail-with-body -X POST "https://open.scenepond.ai/v1/responses" \
  -H "Authorization: Bearer $SCENEPOND_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @- <<'JSON'
{
  "model": "gpt-6-luna",
  "input": "Generate a small illustration of a leaf on a white background.",
  "max_output_tokens": 1024,
  "tools": [
    {
      "type": "image_generation",
      "model": "gpt-image-1.5",
      "action": "generate",
      "background": "opaque",
      "output_format": "webp",
      "output_compression": 80,
      "size": "1024x1024",
      "quality": "low",
      "moderation": "auto",
      "partial_images": 0
    }
  ],
  "tool_choice": {
    "type": "image_generation"
  }
}
JSON
```

##### Python

```python
import os
import json
from urllib.parse import quote
from urllib.request import Request, urlopen

payload = json.loads("{\n  \"model\": \"gpt-6-luna\",\n  \"input\": \"Generate a small illustration of a leaf on a white background.\",\n  \"max_output_tokens\": 1024,\n  \"tools\": [\n    {\n      \"type\": \"image_generation\",\n      \"model\": \"gpt-image-1.5\",\n      \"action\": \"generate\",\n      \"background\": \"opaque\",\n      \"output_format\": \"webp\",\n      \"output_compression\": 80,\n      \"size\": \"1024x1024\",\n      \"quality\": \"low\",\n      \"moderation\": \"auto\",\n      \"partial_images\": 0\n    }\n  ],\n  \"tool_choice\": {\n    \"type\": \"image_generation\"\n  }\n}")

request = Request(
    "https://open.scenepond.ai/v1/responses",
    headers={
        "Authorization": "Bearer " + os.environ["SCENEPOND_API_KEY"],
        "Content-Type": "application/json",
    },
    data=json.dumps(payload).encode("utf-8"),
    method="POST",
)
with urlopen(request) as response:
    result = json.load(response)
print(json.dumps(result, indent=2))
```

##### JavaScript

```javascript
const response = await fetch("https://open.scenepond.ai/v1/responses", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.SCENEPOND_API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
  "model": "gpt-6-luna",
  "input": "Generate a small illustration of a leaf on a white background.",
  "max_output_tokens": 1024,
  "tools": [
    {
      "type": "image_generation",
      "model": "gpt-image-1.5",
      "action": "generate",
      "background": "opaque",
      "output_format": "webp",
      "output_compression": 80,
      "size": "1024x1024",
      "quality": "low",
      "moderation": "auto",
      "partial_images": 0
    }
  ],
  "tool_choice": {
    "type": "image_generation"
  }
})
});
if (!response.ok) throw new Error(`API error: ${response.status} ${await response.text()}`);
const result = await response.json();
console.log(result);
```

#### MCP 服务与审批选项 17

请将服务 URL 替换为已获授权的 MCP 端点，将 tool_names 替换为其提供的工具。审批回复必须使用原始 approval_request_id。

##### cURL

```bash
curl --fail-with-body -X POST "https://open.scenepond.ai/v1/responses" \
  -H "Authorization: Bearer $SCENEPOND_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @- <<'JSON'
{
  "model": "gpt-6-luna",
  "input": "Find the public help page for this product.",
  "max_output_tokens": 1024,
  "tools": [
    {
      "type": "mcp",
      "server_label": "product_docs",
      "server_url": "https://REPLACE_WITH_AUTHORIZED_MCP_HOST/mcp",
      "server_description": "Public product documentation",
      "allowed_tools": {
        "read_only": true,
        "tool_names": [
          "search_docs"
        ]
      },
      "require_approval": {
        "always": {
          "tool_names": [
            "search_docs"
          ]
        }
      },
      "defer_loading": false
    }
  ],
  "tool_choice": {
    "type": "mcp",
    "server_label": "product_docs",
    "name": "search_docs"
  }
}
JSON
```

##### Python

```python
import os
import json
from urllib.parse import quote
from urllib.request import Request, urlopen

payload = json.loads("{\n  \"model\": \"gpt-6-luna\",\n  \"input\": \"Find the public help page for this product.\",\n  \"max_output_tokens\": 1024,\n  \"tools\": [\n    {\n      \"type\": \"mcp\",\n      \"server_label\": \"product_docs\",\n      \"server_url\": \"https://REPLACE_WITH_AUTHORIZED_MCP_HOST/mcp\",\n      \"server_description\": \"Public product documentation\",\n      \"allowed_tools\": {\n        \"read_only\": true,\n        \"tool_names\": [\n          \"search_docs\"\n        ]\n      },\n      \"require_approval\": {\n        \"always\": {\n          \"tool_names\": [\n            \"search_docs\"\n          ]\n        }\n      },\n      \"defer_loading\": false\n    }\n  ],\n  \"tool_choice\": {\n    \"type\": \"mcp\",\n    \"server_label\": \"product_docs\",\n    \"name\": \"search_docs\"\n  }\n}")

request = Request(
    "https://open.scenepond.ai/v1/responses",
    headers={
        "Authorization": "Bearer " + os.environ["SCENEPOND_API_KEY"],
        "Content-Type": "application/json",
    },
    data=json.dumps(payload).encode("utf-8"),
    method="POST",
)
with urlopen(request) as response:
    result = json.load(response)
print(json.dumps(result, indent=2))
```

##### JavaScript

```javascript
const response = await fetch("https://open.scenepond.ai/v1/responses", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.SCENEPOND_API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
  "model": "gpt-6-luna",
  "input": "Find the public help page for this product.",
  "max_output_tokens": 1024,
  "tools": [
    {
      "type": "mcp",
      "server_label": "product_docs",
      "server_url": "https://REPLACE_WITH_AUTHORIZED_MCP_HOST/mcp",
      "server_description": "Public product documentation",
      "allowed_tools": {
        "read_only": true,
        "tool_names": [
          "search_docs"
        ]
      },
      "require_approval": {
        "always": {
          "tool_names": [
            "search_docs"
          ]
        }
      },
      "defer_loading": false
    }
  ],
  "tool_choice": {
    "type": "mcp",
    "server_label": "product_docs",
    "name": "search_docs"
  }
})
});
if (!response.ok) throw new Error(`API error: ${response.status} ${await response.text()}`);
const result = await response.json();
console.log(result);
```

#### 托管 shell 环境选项 18

托管 shell 需要上游工具权限。此示例为自动创建的容器禁用外部网络。

##### cURL

```bash
curl --fail-with-body -X POST "https://open.scenepond.ai/v1/responses" \
  -H "Authorization: Bearer $SCENEPOND_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @- <<'JSON'
{
  "model": "gpt-6-luna",
  "input": "Print a hello-world sentence in the shell.",
  "max_output_tokens": 1024,
  "tools": [
    {
      "type": "shell",
      "environment": {
        "type": "container_auto",
        "memory_limit": "1g",
        "network_policy": {
          "type": "disabled"
        }
      }
    }
  ],
  "tool_choice": {
    "type": "shell"
  }
}
JSON
```

##### Python

```python
import os
import json
from urllib.parse import quote
from urllib.request import Request, urlopen

payload = json.loads("{\n  \"model\": \"gpt-6-luna\",\n  \"input\": \"Print a hello-world sentence in the shell.\",\n  \"max_output_tokens\": 1024,\n  \"tools\": [\n    {\n      \"type\": \"shell\",\n      \"environment\": {\n        \"type\": \"container_auto\",\n        \"memory_limit\": \"1g\",\n        \"network_policy\": {\n          \"type\": \"disabled\"\n        }\n      }\n    }\n  ],\n  \"tool_choice\": {\n    \"type\": \"shell\"\n  }\n}")

request = Request(
    "https://open.scenepond.ai/v1/responses",
    headers={
        "Authorization": "Bearer " + os.environ["SCENEPOND_API_KEY"],
        "Content-Type": "application/json",
    },
    data=json.dumps(payload).encode("utf-8"),
    method="POST",
)
with urlopen(request) as response:
    result = json.load(response)
print(json.dumps(result, indent=2))
```

##### JavaScript

```javascript
const response = await fetch("https://open.scenepond.ai/v1/responses", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.SCENEPOND_API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
  "model": "gpt-6-luna",
  "input": "Print a hello-world sentence in the shell.",
  "max_output_tokens": 1024,
  "tools": [
    {
      "type": "shell",
      "environment": {
        "type": "container_auto",
        "memory_limit": "1g",
        "network_policy": {
          "type": "disabled"
        }
      }
    }
  ],
  "tool_choice": {
    "type": "shell"
  }
})
});
if (!response.ok) throw new Error(`API error: ${response.status} ${await response.text()}`);
const result = await response.json();
console.log(result);
```

#### 延迟加载函数与工具搜索选项 19

##### cURL

```bash
curl --fail-with-body -X POST "https://open.scenepond.ai/v1/responses" \
  -H "Authorization: Bearer $SCENEPOND_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @- <<'JSON'
{
  "model": "gpt-6-luna",
  "input": "What is the weather in Singapore?",
  "max_output_tokens": 1024,
  "tools": [
    {
      "type": "tool_search",
      "execution": "server"
    },
    {
      "type": "function",
      "name": "get_weather",
      "description": "Get the weather for a city.",
      "strict": true,
      "parameters": {
        "type": "object",
        "properties": {
          "city": {
            "type": "string"
          }
        },
        "required": [
          "city"
        ],
        "additionalProperties": false
      },
      "defer_loading": true,
      "output_schema": {
        "type": "object",
        "properties": {
          "temperature_c": {
            "type": "number"
          }
        },
        "required": [
          "temperature_c"
        ],
        "additionalProperties": false
      }
    }
  ],
  "tool_choice": "auto"
}
JSON
```

##### Python

```python
import os
import json
from urllib.parse import quote
from urllib.request import Request, urlopen

payload = json.loads("{\n  \"model\": \"gpt-6-luna\",\n  \"input\": \"What is the weather in Singapore?\",\n  \"max_output_tokens\": 1024,\n  \"tools\": [\n    {\n      \"type\": \"tool_search\",\n      \"execution\": \"server\"\n    },\n    {\n      \"type\": \"function\",\n      \"name\": \"get_weather\",\n      \"description\": \"Get the weather for a city.\",\n      \"strict\": true,\n      \"parameters\": {\n        \"type\": \"object\",\n        \"properties\": {\n          \"city\": {\n            \"type\": \"string\"\n          }\n        },\n        \"required\": [\n          \"city\"\n        ],\n        \"additionalProperties\": false\n      },\n      \"defer_loading\": true,\n      \"output_schema\": {\n        \"type\": \"object\",\n        \"properties\": {\n          \"temperature_c\": {\n            \"type\": \"number\"\n          }\n        },\n        \"required\": [\n          \"temperature_c\"\n        ],\n        \"additionalProperties\": false\n      }\n    }\n  ],\n  \"tool_choice\": \"auto\"\n}")

request = Request(
    "https://open.scenepond.ai/v1/responses",
    headers={
        "Authorization": "Bearer " + os.environ["SCENEPOND_API_KEY"],
        "Content-Type": "application/json",
    },
    data=json.dumps(payload).encode("utf-8"),
    method="POST",
)
with urlopen(request) as response:
    result = json.load(response)
print(json.dumps(result, indent=2))
```

##### JavaScript

```javascript
const response = await fetch("https://open.scenepond.ai/v1/responses", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.SCENEPOND_API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
  "model": "gpt-6-luna",
  "input": "What is the weather in Singapore?",
  "max_output_tokens": 1024,
  "tools": [
    {
      "type": "tool_search",
      "execution": "server"
    },
    {
      "type": "function",
      "name": "get_weather",
      "description": "Get the weather for a city.",
      "strict": true,
      "parameters": {
        "type": "object",
        "properties": {
          "city": {
            "type": "string"
          }
        },
        "required": [
          "city"
        ],
        "additionalProperties": false
      },
      "defer_loading": true,
      "output_schema": {
        "type": "object",
        "properties": {
          "temperature_c": {
            "type": "number"
          }
        },
        "required": [
          "temperature_c"
        ],
        "additionalProperties": false
      }
    }
  ],
  "tool_choice": "auto"
})
});
if (!response.ok) throw new Error(`API error: ${response.status} ${await response.text()}`);
const result = await response.json();
console.log(result);
```

#### 使用 temperature 采样 20

##### cURL

```bash
curl --fail-with-body -X POST "https://open.scenepond.ai/v1/responses" \
  -H "Authorization: Bearer $SCENEPOND_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @- <<'JSON'
{
  "model": "gpt-6-luna",
  "input": "Suggest a short title for a garden photo.",
  "reasoning": {
    "effort": "none"
  },
  "max_output_tokens": 128,
  "temperature": 0.2,
  "top_logprobs": 3,
  "include": [
    "message.output_text.logprobs"
  ]
}
JSON
```

##### Python

```python
import os
import json
from urllib.parse import quote
from urllib.request import Request, urlopen

payload = json.loads("{\n  \"model\": \"gpt-6-luna\",\n  \"input\": \"Suggest a short title for a garden photo.\",\n  \"reasoning\": {\n    \"effort\": \"none\"\n  },\n  \"max_output_tokens\": 128,\n  \"temperature\": 0.2,\n  \"top_logprobs\": 3,\n  \"include\": [\n    \"message.output_text.logprobs\"\n  ]\n}")

request = Request(
    "https://open.scenepond.ai/v1/responses",
    headers={
        "Authorization": "Bearer " + os.environ["SCENEPOND_API_KEY"],
        "Content-Type": "application/json",
    },
    data=json.dumps(payload).encode("utf-8"),
    method="POST",
)
with urlopen(request) as response:
    result = json.load(response)
print(json.dumps(result, indent=2))
```

##### JavaScript

```javascript
const response = await fetch("https://open.scenepond.ai/v1/responses", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.SCENEPOND_API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
  "model": "gpt-6-luna",
  "input": "Suggest a short title for a garden photo.",
  "reasoning": {
    "effort": "none"
  },
  "max_output_tokens": 128,
  "temperature": 0.2,
  "top_logprobs": 3,
  "include": [
    "message.output_text.logprobs"
  ]
})
});
if (!response.ok) throw new Error(`API error: ${response.status} ${await response.text()}`);
const result = await response.json();
console.log(result);
```

#### 使用 top_p 采样 21

##### cURL

```bash
curl --fail-with-body -X POST "https://open.scenepond.ai/v1/responses" \
  -H "Authorization: Bearer $SCENEPOND_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @- <<'JSON'
{
  "model": "gpt-6-luna",
  "input": "Suggest a short title for a garden photo.",
  "reasoning": {
    "effort": "none"
  },
  "max_output_tokens": 128,
  "top_p": 0.8
}
JSON
```

##### Python

```python
import os
import json
from urllib.parse import quote
from urllib.request import Request, urlopen

payload = json.loads("{\n  \"model\": \"gpt-6-luna\",\n  \"input\": \"Suggest a short title for a garden photo.\",\n  \"reasoning\": {\n    \"effort\": \"none\"\n  },\n  \"max_output_tokens\": 128,\n  \"top_p\": 0.8\n}")

request = Request(
    "https://open.scenepond.ai/v1/responses",
    headers={
        "Authorization": "Bearer " + os.environ["SCENEPOND_API_KEY"],
        "Content-Type": "application/json",
    },
    data=json.dumps(payload).encode("utf-8"),
    method="POST",
)
with urlopen(request) as response:
    result = json.load(response)
print(json.dumps(result, indent=2))
```

##### JavaScript

```javascript
const response = await fetch("https://open.scenepond.ai/v1/responses", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.SCENEPOND_API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
  "model": "gpt-6-luna",
  "input": "Suggest a short title for a garden photo.",
  "reasoning": {
    "effort": "none"
  },
  "max_output_tokens": 128,
  "top_p": 0.8
})
});
if (!response.ok) throw new Error(`API error: ${response.status} ${await response.text()}`);
const result = await response.json();
console.log(result);
```

<details>
<summary>兼容参数示例</summary>

#### 已弃用的用户标识与缓存保留选项 1

这些旧选项仍会转发。缓存分组请使用 prompt_cache_key。当前渠道尚未开放 safety_identifier。缓存最长保留策略与最短缓存有效期相互独立。

##### cURL

```bash
curl --fail-with-body -X POST "https://open.scenepond.ai/v1/responses" \
  -H "Authorization: Bearer $SCENEPOND_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @- <<'JSON'
{
  "model": "gpt-6-luna",
  "input": "Hello!",
  "max_output_tokens": 128,
  "user": "user_example",
  "prompt_cache_retention": "24h"
}
JSON
```

##### Python

```python
import os
import json
from urllib.parse import quote
from urllib.request import Request, urlopen

payload = json.loads("{\n  \"model\": \"gpt-6-luna\",\n  \"input\": \"Hello!\",\n  \"max_output_tokens\": 128,\n  \"user\": \"user_example\",\n  \"prompt_cache_retention\": \"24h\"\n}")

request = Request(
    "https://open.scenepond.ai/v1/responses",
    headers={
        "Authorization": "Bearer " + os.environ["SCENEPOND_API_KEY"],
        "Content-Type": "application/json",
    },
    data=json.dumps(payload).encode("utf-8"),
    method="POST",
)
with urlopen(request) as response:
    result = json.load(response)
print(json.dumps(result, indent=2))
```

##### JavaScript

```javascript
const response = await fetch("https://open.scenepond.ai/v1/responses", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.SCENEPOND_API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
  "model": "gpt-6-luna",
  "input": "Hello!",
  "max_output_tokens": 128,
  "user": "user_example",
  "prompt_cache_retention": "24h"
})
});
if (!response.ok) throw new Error(`API error: ${response.status} ${await response.text()}`);
const result = await response.json();
console.log(result);
```

</details>

### 响应示例

响应示例仅展示结构；ID、URL 和数值为占位内容。

#### 完成响应

```json
{
  "id": "resp_EXAMPLE",
  "object": "response",
  "model": "gpt-6-luna",
  "status": "completed",
  "output": [
    {
      "type": "message",
      "role": "assistant",
      "status": "completed",
      "content": [
        {
          "type": "output_text",
          "text": "Hello!",
          "annotations": []
        }
      ]
    }
  ]
}
```

### 调用注意事项

- Responses 使用 reasoning.effort 和 max_output_tokens；reasoning_effort 和 max_completion_tokens 用于 Chat Completions。
- Responses 的函数定义将 name、parameters 和 strict 与 type 放在同一层级；Chat Completions 将这些字段放在 function 对象内。
- 将函数执行结果作为 function_call_output 输入项返回，并填入对应的 call_id。
- 使用采样参数时，必须显式将 reasoning.effort 设为 none；省略此参数不等于选择 none。
- 当前渠道尚未开放 service_tier、safety_identifier 和 stream_options.include_obfuscation。这是网关的开放范围限制，并非模型不支持；参数表和示例中均不展示这些选项。
- 内置工具需要上游访问权限，可能产生单独的工具费用。已有文件、向量库、会话和容器 ID 必须属于执行请求的上游账户。
- 网关未实现文件上传、列表和下载接口。文件输入建议使用内嵌 file_data 或公开的 file_url。
- 请原样回放先前的完整输出项。嵌套参数表说明常用输入类型；专用电脑和 shell 结果载荷请遵循链接中的官方工具参考。
- 网关不转发已弃用的 reasoning.generate_summary，请使用 reasoning.summary。程序化调用需要 programmatic_tool_calling 工具，以及可用工具的 allowed_callers 设置。
- 配置更新仅支持 standard 单智能体模式。更新不能相邻出现，不能与自动压缩或自动截断组合，也不能发送到独立的压缩接口。
- 内容审核评分覆盖完整输入和输出。流式请求的评分在输出完成后返回；展示内容或执行后续操作前请先检查评分。
- 本网关不支持普通 Responses 的后台生成和 GET 查询；续接请使用已完成请求返回的响应 ID。

## 资料来源

- [官方模型参考](https://developers.openai.com/api/docs/models/gpt-6-luna)
- [官方 Chat Completions 参数参考](https://developers.openai.com/api/reference/resources/chat/subresources/completions/methods/create)
- [官方文件输入指南](https://developers.openai.com/api/docs/guides/file-inputs)
- [官方图片输入指南](https://developers.openai.com/api/docs/guides/images-vision)
- [官方 Responses 参数参考](https://developers.openai.com/api/reference/resources/responses/methods/create)
- [官方推理指南](https://developers.openai.com/api/docs/guides/reasoning)
- [官方协议迁移指南](https://developers.openai.com/api/docs/guides/migrate-to-responses)
- [官方网页搜索指南](https://developers.openai.com/api/docs/guides/tools-web-search)
- [官方工具搜索指南](https://developers.openai.com/api/docs/guides/tools-tool-search)
- [官方程序化工具调用指南](https://developers.openai.com/api/docs/guides/tools-programmatic-tool-calling)
- [官方函数调用指南](https://developers.openai.com/api/docs/guides/function-calling)
- [官方异步工具调用指南](https://developers.openai.com/api/docs/guides/async-tool-calling)
- [官方内容审核指南](https://developers.openai.com/api/docs/guides/moderation)
