OpenAI Evals 接口参考

2026-11-11 14:18 更新

Evals 评测资源

创建评测

post /evals

创建用于测试模型表现的评测结构。 评测包含一组测试标准以及数据源配置,后者规定评测数据的模式。创建评测后,可使用不同模型和模型参数运行评测。支持多种评分器和数据源。 更多信息请参阅评测指南。

请求体参数

内容类型:application/json

  • data_source_config: CustomDataSourceConfig { item_schema, type, include_sample_schema } or LogsDataSourceConfig { type, metadata } or StoredCompletionsDataSourceConfig { type, metadata }

评测运行使用的数据源配置,规定评测数据的模式。

  • CustomDataSourceConfig object { item_schema, type, include_sample_schema }

CustomDataSourceConfig 对象,定义评测运行所用数据源的模式。 此模式定义以下数据的结构:

  • 用于定义测试标准的数据,以及
  • 创建运行时需要提供的数据。

  • item_schema: map[unknown]

数据源中每行数据的 JSON Schema。

  • type: "custom" (default: "custom")

数据源类型,固定为 custom。

  • "custom"

  • include_sample_schema: optional boolean (default: false)

评测是否预期你填充 sample 命名空间,例如根据数据源生成响应。

  • LogsDataSourceConfig object { type, metadata }

指定日志查询元数据属性的数据源配置。 通常是 usecase=chatbot 或 prompt-version=v2 等元数据。

  • type: "logs" (default: "logs")

数据源类型,固定为 logs。

  • "logs"

  • metadata: optional map[unknown]

日志数据源的元数据筛选条件。

  • StoredCompletionsDataSourceConfig object { type, metadata }

已弃用,改用 LogsDataSourceConfig。

  • type: "stored_completions" (default: "stored_completions")

数据源类型,固定为 stored_completions。

  • "stored_completions"

  • metadata: optional map[unknown]

已存储补全数据源的元数据筛选条件。

  • testing_criteria: array of LabelModelGrader { input, labels, model, 3 more } or StringCheckGrader or TextSimilarityGrader or 2 more

用于此组中所有评测运行的评分器列表。评分器可用双花括号引用数据源中的变量,例如 {{item.variable_name}}。引用模型输出时,使用 sample 命名空间,例如 {{sample.output_text}}。

  • LabelModelGrader object { input, labels, model, 3 more }

LabelModelGrader 对象,使用模型为评测中的每个条目 分配标签。

  • input: array of SimpleInputMessage { content, role } or EvalMessageObject { content, role, type }

构成提示词或上下文的聊天消息列表,可以包含对 item 命名空间的变量引用,例如 {{item.name}}。

  • SimpleInputMessage object { content, role }

  • content: string

消息内容。

  • role: string

消息角色,例如 "system"、"assistant"、"user"。

  • EvalMessageObject object { content, role, type }

输入模型的消息,其角色表示指令遵循的 优先级。以 developer 或 system 角色给出的指令 优先于 user 角色给出的指令。 assistant 角色的消息被视为模型在此前 交互中生成的内容。

  • content: string or ResponseInputText or OutputText { text, type } or 3 more

模型输入,可以包含模板字符串。支持输入文本、输出文本、输入图像和输入音频,可提供单个条目或条目数组。

  • TextInput = string

输入模型的文本。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • text: string

输入模型的文本。

  • type: "input_text" (default: "input_text")

输入条目类型,固定为 input_text。

  • "input_text"

  • prompt_cache_breakpoint: optional object { mode, ttl }

标记可复用提示词前缀的精确结束位置。省略 ttl 时,断点继承请求中的 prompt_cache_options.ttl;该边界不会按词元块取整。

  • mode: "explicit" (default: "explicit")

断点模式,固定为 explicit。

  • "explicit"

  • ttl: optional "30m" or "12h"

此缓存断点的最短存续时间,默认为请求的 TTL。

  • "30m"

  • "12h"

  • OutputText object { text, type }

模型输出的文本。

  • text: string

模型输出的文本内容。

  • type: "output_text"

输出文本类型,固定为 output_text。

  • "output_text"

  • InputImage object { image_url, type, detail }

用于 EvalItem 内容数组中的图像输入块。

  • image_url: string

输入图像的 URL。

format: uri

  • type: "input_image"

输入图像类型,固定为 input_image。

  • "input_image"

  • detail: optional string

发送给模型的图像细节级别,可选 high、low 或 auto,默认为 auto。

  • ResponseInputAudio object { input_audio, type }

输入模型的音频。

  • input_audio: object { data, format }

  • data: string

采用 Base64 编码的音频数据。

  • format: "mp3" or "wav"

音频数据格式,当前支持 mp3 和 wav.

  • "mp3"

  • "wav"

  • type: "input_audio"

输入条目类型,固定为 input_audio。

  • "input_audio"

  • GraderInputs = array of string or ResponseInputText or OutputText { text, type } or 2 more

输入列表,每项可以是输入文本、输出文本、输入 图像或输入音频对象。

  • TextInput = string

输入模型的文本。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • OutputText object { text, type }

模型输出的文本。

  • text: string

模型输出的文本内容。

  • type: "output_text"

输出文本类型,固定为 output_text。

  • "output_text"

  • InputImage object { image_url, type, detail }

用于 EvalItem 内容数组中的图像输入块。

  • image_url: string

输入图像的 URL。

format: uri

  • type: "input_image"

输入图像类型,固定为 input_image。

  • "input_image"

  • detail: optional string

发送给模型的图像细节级别,可选 high、low 或 auto,默认为 auto。

  • ResponseInputAudio object { input_audio, type }

输入模型的音频。

  • role: "user" or "assistant" or "system" or "developer"

输入消息的角色,可选 user、assistant、system 或 developer.

  • "user"

  • "assistant"

  • "system"

  • "developer"

  • type: optional "message"

输入消息类型,固定为 message。

  • "message"

  • labels: array of string

为评测中每个条目分类时使用的标签。

  • model: string

评测使用的模型,须支持结构化输出。

  • name: string

评分器名称。

  • passing_labels: array of string

表示通过评测的标签,须为 labels 的子集。

  • type: "label_model"

对象类型,固定为 label_model。

  • "label_model"

  • StringCheckGrader object { input, name, operation, 2 more }

StringCheckGrader 对象,使用指定操作对输入文本与参考文本进行字符串比较。

  • input: string

输入文本,可以包含模板字符串。

  • name: string

评分器名称。

  • operation: "eq" or "ne" or "like" or "ilike"

要执行的字符串检查操作,可选 eq、ne、like 或 ilike。

  • "eq"

  • "ne"

  • "like"

  • "ilike"

  • reference: string

参考文本,可以包含模板字符串。

  • type: "string_check"

对象类型,固定为 string_check。

  • "string_check"

  • TextSimilarity = TextSimilarityGrader

TextSimilarityGrader 对象,根据文本相似度指标评分。

  • pass_threshold: number

分数阈值。

  • Python = PythonGrader

PythonGrader 对象,对输入运行 Python 脚本。

  • pass_threshold: optional number

分数阈值。

  • ScoreModel = ScoreModelGrader

ScoreModelGrader 对象,使用模型为输入评分。

  • pass_threshold: optional number

分数阈值。

  • metadata: optional Metadata or null

可附加到对象的元数据,最多包含 16 组键值对,可 以结构化方式存储对象的额外信息, 并通过 API 或控制台查询对象。

键为最多 64 个字符的字符串,值为 最多 512 个字符的字符串。

  • name: optional string

评测名称。

返回值

  • id: string

评测的唯一标识。

  • created_at: integer

评测创建时的 Unix 时间戳,单位为秒。

format: unixtime

  • data_source_config: EvalCustomDataSourceConfig or LogsDataSourceConfig { schema, type, metadata } or EvalStoredCompletionsDataSourceConfig

评测运行使用的数据源配置。

  • EvalCustomDataSourceConfig object { schema, type }

CustomDataSourceConfig,指定 item 命名空间的模式,并可选择指定 sample 命名空间的模式。 响应模式定义以下数据的结构:

  • 用于定义测试标准的数据,以及
  • 创建运行时需要提供的数据。

  • schema: map[unknown]

运行数据源条目的 JSON Schema。 JSON Schema 的构建方法参阅此处。

  • type: "custom" (default: "custom")

数据源类型,固定为 custom。

  • "custom"

  • LogsDataSourceConfig object { schema, type, metadata }

LogsDataSourceConfig,指定日志查询的元数据属性。 通常是 usecase=chatbot 或 prompt-version=v2 等元数据。 此数据源配置返回的模式定义评测中可用的变量。 使用此数据源配置时,item 和 sample 均有定义。

  • schema: map[unknown]

运行数据源条目的 JSON Schema。 JSON Schema 的构建方法参阅此处。

  • type: "logs" (default: "logs")

数据源类型,固定为 logs。

  • "logs"

  • metadata: optional Metadata or null

可附加到对象的元数据,最多包含 16 组键值对,可 以结构化方式存储对象的额外信息, 并通过 API 或控制台查询对象。

键为最多 64 个字符的字符串,值为 最多 512 个字符的字符串。

  • EvalStoredCompletionsDataSourceConfig object { schema, type, metadata }

已弃用,改用 LogsDataSourceConfig。

  • schema: map[unknown]

运行数据源条目的 JSON Schema。 JSON Schema 的构建方法参阅此处。

  • type: "stored_completions" (default: "stored_completions")

数据源类型,固定为 stored_completions。

  • "stored_completions"

  • metadata: optional Metadata or null

可附加到对象的元数据,最多包含 16 组键值对,可 以结构化方式存储对象的额外信息, 并通过 API 或控制台查询对象。

键为最多 64 个字符的字符串,值为 最多 512 个字符的字符串。

  • metadata: Metadata or null

可附加到对象的元数据,最多包含 16 组键值对,可 以结构化方式存储对象的额外信息, 并通过 API 或控制台查询对象。

键为最多 64 个字符的字符串,值为 最多 512 个字符的字符串。

  • name: string

评测名称。

  • object: "eval" (default: "eval")

对象类型。

  • "eval"

  • testing_criteria: array of LabelModelGrader or StringCheckGrader or TextSimilarityGrader or 2 more

测试标准列表。

  • LabelModelGrader object { input, labels, model, 3 more }

LabelModelGrader 对象,使用模型为评测中的每个条目 分配标签。

  • input: array of object { content, role, type }

  • content: string or ResponseInputText or OutputText { text, type } or 3 more

模型输入,可以包含模板字符串。支持输入文本、输出文本、输入图像和输入音频,可提供单个条目或条目数组。

  • TextInput = string

输入模型的文本。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • text: string

输入模型的文本。

  • type: "input_text" (default: "input_text")

输入条目类型,固定为 input_text。

  • "input_text"

  • prompt_cache_breakpoint: optional object { mode, ttl }

标记可复用提示词前缀的精确结束位置。省略 ttl 时,断点继承请求中的 prompt_cache_options.ttl;该边界不会按词元块取整。

  • mode: "explicit" (default: "explicit")

断点模式,固定为 explicit。

  • "explicit"

  • ttl: optional "30m" or "12h"

此缓存断点的最短存续时间,默认为请求的 TTL。

  • "30m"

  • "12h"

  • OutputText object { text, type }

模型输出的文本。

  • text: string

模型输出的文本内容。

  • type: "output_text"

输出文本类型,固定为 output_text。

  • "output_text"

  • InputImage object { image_url, type, detail }

用于 EvalItem 内容数组中的图像输入块。

  • image_url: string

输入图像的 URL。

format: uri

  • type: "input_image"

输入图像类型,固定为 input_image。

  • "input_image"

  • detail: optional string

发送给模型的图像细节级别,可选 high、low 或 auto,默认为 auto。

  • ResponseInputAudio object { input_audio, type }

输入模型的音频。

  • input_audio: object { data, format }

  • data: string

采用 Base64 编码的音频数据。

  • format: "mp3" or "wav"

音频数据格式,当前支持 mp3 和 wav.

  • "mp3"

  • "wav"

  • type: "input_audio"

输入条目类型,固定为 input_audio。

  • "input_audio"

  • GraderInputs = array of string or ResponseInputText or OutputText { text, type } or 2 more

输入列表,每项可以是输入文本、输出文本、输入 图像或输入音频对象。

  • TextInput = string

输入模型的文本。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • OutputText object { text, type }

模型输出的文本。

  • text: string

模型输出的文本内容。

  • type: "output_text"

输出文本类型,固定为 output_text。

  • "output_text"

  • InputImage object { image_url, type, detail }

用于 EvalItem 内容数组中的图像输入块。

  • image_url: string

输入图像的 URL。

format: uri

  • type: "input_image"

输入图像类型,固定为 input_image。

  • "input_image"

  • detail: optional string

发送给模型的图像细节级别,可选 high、low 或 auto,默认为 auto。

  • ResponseInputAudio object { input_audio, type }

输入模型的音频。

  • role: "user" or "assistant" or "system" or "developer"

输入消息的角色,可选 user、assistant、system 或 developer.

  • "user"

  • "assistant"

  • "system"

  • "developer"

  • type: optional "message"

输入消息类型,固定为 message。

  • "message"

  • labels: array of string

要为评测中每个条目分配的标签。

  • model: string

评测使用的模型,须支持结构化输出。

  • name: string

评分器名称。

  • passing_labels: array of string

表示通过评测的标签,须为 labels 的子集。

  • type: "label_model"

对象类型,固定为 label_model。

  • "label_model"

  • StringCheckGrader object { input, name, operation, 2 more }

StringCheckGrader 对象,使用指定操作对输入文本与参考文本进行字符串比较。

  • input: string

输入文本,可以包含模板字符串。

  • name: string

评分器名称。

  • operation: "eq" or "ne" or "like" or "ilike"

要执行的字符串检查操作,可选 eq、ne、like 或 ilike。

  • "eq"

  • "ne"

  • "like"

  • "ilike"

  • reference: string

参考文本,可以包含模板字符串。

  • type: "string_check"

对象类型,固定为 string_check。

  • "string_check"

  • TextSimilarityGrader = TextSimilarityGrader

TextSimilarityGrader 对象,根据文本相似度指标评分。

  • pass_threshold: number

分数阈值。

  • PythonGrader = PythonGrader

PythonGrader 对象,对输入运行 Python 脚本。

  • pass_threshold: optional number

分数阈值。

  • ScoreModelGrader = ScoreModelGrader

ScoreModelGrader 对象,使用模型为输入评分。

  • pass_threshold: optional number

分数阈值。

示例

## 设置 OPENAI_API_KEY,并将评测 ID 和运行 ID 替换为实际值。
curl https://api.openai.com/v1/evals \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $OPENAI_API_KEY" \
    -d '{
          "data_source_config": {
            "item_schema": {
              "foo": "bar"
            },
            "type": "custom"
          },
          "testing_criteria": [
            {
              "input": [
                {
                  "content": "content",
                  "role": "role"
                }
              ],
              "labels": [
                "string"
              ],
              "model": "model",
              "name": "name",
              "passing_labels": [
                "string"
              ],
              "type": "label_model"
            }
          ]
        }'

201:示例

{
  "id": "id",
  "created_at": 0,
  "data_source_config": {
    "schema": {
      "type": "object",
      "properties": {
        "item": {
          "type": "object",
          "properties": {
            "label": {
              "type": "string"
            }
          },
          "required": [
            "label"
          ]
        }
      },
      "required": [
        "item"
      ]
    },
    "type": "custom"
  },
  "metadata": {
    "foo": "string"
  },
  "name": "聊天机器人效果评测",
  "object": "eval",
  "testing_criteria": [
    {
      "input": [
        {
          "content": "string",
          "role": "user",
          "type": "message"
        }
      ],
      "labels": [
        "string"
      ],
      "model": "model",
      "name": "name",
      "passing_labels": [
        "string"
      ],
      "type": "label_model"
    }
  ]
}

示例

## 设置 OPENAI_API_KEY,并将评测 ID 和运行 ID 替换为实际值。
curl https://api.openai.com/v1/evals \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
        "name": "情感分析",
        "data_source_config": {
          "type": "stored_completions",
          "metadata": {
              "usecase": "chatbot"
          }
        },
        "testing_criteria": [
          {
            "type": "label_model",
            "model": "o3-mini",
            "input": [
              {
                "role": "developer",
                "content": "将以下陈述的情感分类为 positive(积极)、neutral(中性)或 negative(消极)之一。"
              },
              {
                "role": "user",
                "content": "陈述:{{item.input}}"
              }
            ],
            "passing_labels": [
              "positive"
            ],
            "labels": [
              "positive",
              "neutral",
              "negative"
            ],
            "name": "示例标签评分器"
          }
        ]
      }'

响应示例

{
  "object": "eval",
  "id": "eval_67b7fa9a81a88190ab4aa417e397ea21",
  "data_source_config": {
    "type": "stored_completions",
    "metadata": {
      "usecase": "chatbot"
    },
    "schema": {
      "type": "object",
      "properties": {
        "item": {
          "type": "object"
        },
        "sample": {
          "type": "object"
        }
      },
      "required": [
        "item",
        "sample"
      ]
    }
  },
  "testing_criteria": [
    {
      "name": "示例标签评分器",
      "type": "label_model",
      "model": "o3-mini",
      "input": [
        {
          "type": "message",
          "role": "developer",
          "content": {
            "type": "input_text",
            "text": "将以下陈述的情感分类为 positive(积极)、neutral(中性)或 negative(消极)之一。"
          }
        },
        {
          "type": "message",
          "role": "user",
          "content": {
            "type": "input_text",
            "text": "陈述:{{item.input}}"
          }
        }
      ],
      "passing_labels": [
        "positive"
      ],
      "labels": [
        "positive",
        "neutral",
        "negative"
      ]
    }
  ],
  "name": "情感分析",
  "created_at": 1740110490,
  "metadata": {
    "description": "情感分析评测"
  }
}

删除评测

delete /evals/{eval_id}

删除评测。

路径参数

  • eval_id: string

要删除的评测的 ID。

返回值

  • deleted: boolean

  • eval_id: string

  • object: string

示例

## 设置 OPENAI_API_KEY,并将评测 ID 和运行 ID 替换为实际值。
curl https://api.openai.com/v1/evals/$EVAL_ID \
    -X DELETE \
    -H "Authorization: Bearer $OPENAI_API_KEY"

200 响应示例

{
  "deleted": true,
  "eval_id": "eval_abc123",
  "object": "eval.deleted"
}

示例

## 设置 OPENAI_API_KEY,并将评测 ID 和运行 ID 替换为实际值。
curl https://api.openai.com/v1/evals/eval_abc123 \
  -X DELETE \
  -H "Authorization: Bearer $OPENAI_API_KEY"

响应示例

{
  "object": "eval.deleted",
  "deleted": true,
  "eval_id": "eval_abc123"
}

列出评测

get /evals

列出项目的评测。

查询参数

  • after: optional string

上一次分页请求中最后一个评测的标识。

  • limit: optional integer (default: 20)

要获取的评测数量。

  • order: optional "asc" or "desc" (default: "asc")

按时间戳对评测排序,使用 asc 升序或 desc 降序。

  • "asc"

  • "desc"

  • order_by: optional "created_at" or "updated_at" (default: "created_at")

可按创建时间或最后更新时间排序。 使用 created_at 按创建时间排序,使用 updated_at 按最后更新时间排序。

  • "created_at"

  • "updated_at"

返回值

  • data: array of object { id, created_at, data_source_config, 4 more }

评测对象数组。

  • id: string

评测的唯一标识。

  • created_at: integer

评测创建时的 Unix 时间戳,单位为秒。

format: unixtime

  • data_source_config: EvalCustomDataSourceConfig or LogsDataSourceConfig { schema, type, metadata } or EvalStoredCompletionsDataSourceConfig

评测运行使用的数据源配置。

  • EvalCustomDataSourceConfig object { schema, type }

CustomDataSourceConfig,指定 item 命名空间的模式,并可选择指定 sample 命名空间的模式。 响应模式定义以下数据的结构:

  • 用于定义测试标准的数据,以及
  • 创建运行时需要提供的数据。

  • schema: map[unknown]

运行数据源条目的 JSON Schema。 JSON Schema 的构建方法参阅此处。

  • type: "custom" (default: "custom")

数据源类型,固定为 custom。

  • "custom"

  • LogsDataSourceConfig object { schema, type, metadata }

LogsDataSourceConfig,指定日志查询的元数据属性。 通常是 usecase=chatbot 或 prompt-version=v2 等元数据。 此数据源配置返回的模式定义评测中可用的变量。 使用此数据源配置时,item 和 sample 均有定义。

  • schema: map[unknown]

运行数据源条目的 JSON Schema。 JSON Schema 的构建方法参阅此处。

  • type: "logs" (default: "logs")

数据源类型,固定为 logs。

  • "logs"

  • metadata: optional Metadata or null

可附加到对象的元数据,最多包含 16 组键值对,可 以结构化方式存储对象的额外信息, 并通过 API 或控制台查询对象。

键为最多 64 个字符的字符串,值为 最多 512 个字符的字符串。

  • EvalStoredCompletionsDataSourceConfig object { schema, type, metadata }

已弃用,改用 LogsDataSourceConfig。

  • schema: map[unknown]

运行数据源条目的 JSON Schema。 JSON Schema 的构建方法参阅此处。

  • type: "stored_completions" (default: "stored_completions")

数据源类型,固定为 stored_completions。

  • "stored_completions"

  • metadata: optional Metadata or null

可附加到对象的元数据,最多包含 16 组键值对,可 以结构化方式存储对象的额外信息, 并通过 API 或控制台查询对象。

键为最多 64 个字符的字符串,值为 最多 512 个字符的字符串。

  • metadata: Metadata or null

可附加到对象的元数据,最多包含 16 组键值对,可 以结构化方式存储对象的额外信息, 并通过 API 或控制台查询对象。

键为最多 64 个字符的字符串,值为 最多 512 个字符的字符串。

  • name: string

评测名称。

  • object: "eval" (default: "eval")

对象类型。

  • "eval"

  • testing_criteria: array of LabelModelGrader or StringCheckGrader or TextSimilarityGrader or 2 more

测试标准列表。

  • LabelModelGrader object { input, labels, model, 3 more }

LabelModelGrader 对象,使用模型为评测中的每个条目 分配标签。

  • input: array of object { content, role, type }

  • content: string or ResponseInputText or OutputText { text, type } or 3 more

模型输入,可以包含模板字符串。支持输入文本、输出文本、输入图像和输入音频,可提供单个条目或条目数组。

  • TextInput = string

输入模型的文本。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • text: string

输入模型的文本。

  • type: "input_text" (default: "input_text")

输入条目类型,固定为 input_text。

  • "input_text"

  • prompt_cache_breakpoint: optional object { mode, ttl }

标记可复用提示词前缀的精确结束位置。省略 ttl 时,断点继承请求中的 prompt_cache_options.ttl;该边界不会按词元块取整。

  • mode: "explicit" (default: "explicit")

断点模式,固定为 explicit。

  • "explicit"

  • ttl: optional "30m" or "12h"

此缓存断点的最短存续时间,默认为请求的 TTL。

  • "30m"

  • "12h"

  • OutputText object { text, type }

模型输出的文本。

  • text: string

模型输出的文本内容。

  • type: "output_text"

输出文本类型,固定为 output_text。

  • "output_text"

  • InputImage object { image_url, type, detail }

用于 EvalItem 内容数组中的图像输入块。

  • image_url: string

输入图像的 URL。

format: uri

  • type: "input_image"

输入图像类型,固定为 input_image。

  • "input_image"

  • detail: optional string

发送给模型的图像细节级别,可选 high、low 或 auto,默认为 auto。

  • ResponseInputAudio object { input_audio, type }

输入模型的音频。

  • input_audio: object { data, format }

  • data: string

采用 Base64 编码的音频数据。

  • format: "mp3" or "wav"

音频数据格式,当前支持 mp3 和 wav.

  • "mp3"

  • "wav"

  • type: "input_audio"

输入条目类型,固定为 input_audio。

  • "input_audio"

  • GraderInputs = array of string or ResponseInputText or OutputText { text, type } or 2 more

输入列表,每项可以是输入文本、输出文本、输入 图像或输入音频对象。

  • TextInput = string

输入模型的文本。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • OutputText object { text, type }

模型输出的文本。

  • text: string

模型输出的文本内容。

  • type: "output_text"

输出文本类型,固定为 output_text。

  • "output_text"

  • InputImage object { image_url, type, detail }

用于 EvalItem 内容数组中的图像输入块。

  • image_url: string

输入图像的 URL。

format: uri

  • type: "input_image"

输入图像类型,固定为 input_image。

  • "input_image"

  • detail: optional string

发送给模型的图像细节级别,可选 high、low 或 auto,默认为 auto。

  • ResponseInputAudio object { input_audio, type }

输入模型的音频。

  • role: "user" or "assistant" or "system" or "developer"

输入消息的角色,可选 user、assistant、system 或 developer.

  • "user"

  • "assistant"

  • "system"

  • "developer"

  • type: optional "message"

输入消息类型,固定为 message。

  • "message"

  • labels: array of string

要为评测中每个条目分配的标签。

  • model: string

评测使用的模型,须支持结构化输出。

  • name: string

评分器名称。

  • passing_labels: array of string

表示通过评测的标签,须为 labels 的子集。

  • type: "label_model"

对象类型,固定为 label_model。

  • "label_model"

  • StringCheckGrader object { input, name, operation, 2 more }

StringCheckGrader 对象,使用指定操作对输入文本与参考文本进行字符串比较。

  • input: string

输入文本,可以包含模板字符串。

  • name: string

评分器名称。

  • operation: "eq" or "ne" or "like" or "ilike"

要执行的字符串检查操作,可选 eq、ne、like 或 ilike。

  • "eq"

  • "ne"

  • "like"

  • "ilike"

  • reference: string

参考文本,可以包含模板字符串。

  • type: "string_check"

对象类型,固定为 string_check。

  • "string_check"

  • TextSimilarityGrader = TextSimilarityGrader

TextSimilarityGrader 对象,根据文本相似度指标评分。

  • pass_threshold: number

分数阈值。

  • PythonGrader = PythonGrader

PythonGrader 对象,对输入运行 Python 脚本。

  • pass_threshold: optional number

分数阈值。

  • ScoreModelGrader = ScoreModelGrader

ScoreModelGrader 对象,使用模型为输入评分。

  • pass_threshold: optional number

分数阈值。

  • first_id: string

data 数组中第一个评测的标识。

  • has_more: boolean

是否还有更多可用评测。

  • last_id: string

data 数组中最后一个评测的标识。

  • object: "list" (default: "list")

对象类型,固定为 "list"。

  • "list"

示例

## 设置 OPENAI_API_KEY,并将评测 ID 和运行 ID 替换为实际值。
curl https://api.openai.com/v1/evals \
    -H "Authorization: Bearer $OPENAI_API_KEY"

200 响应示例

{
  "data": [
    {
      "id": "id",
      "created_at": 0,
      "data_source_config": {
        "schema": {
          "type": "object",
          "properties": {
            "item": {
              "type": "object",
              "properties": {
                "label": {
                  "type": "string"
                }
              },
              "required": [
                "label"
              ]
            }
          },
          "required": [
            "item"
          ]
        },
        "type": "custom"
      },
      "metadata": {
        "foo": "string"
      },
      "name": "聊天机器人效果评测",
      "object": "eval",
      "testing_criteria": [
        {
          "input": [
            {
              "content": "string",
              "role": "user",
              "type": "message"
            }
          ],
          "labels": [
            "string"
          ],
          "model": "model",
          "name": "name",
          "passing_labels": [
            "string"
          ],
          "type": "label_model"
        }
      ]
    }
  ],
  "first_id": "first_id",
  "has_more": true,
  "last_id": "last_id",
  "object": "list"
}

示例

## 设置 OPENAI_API_KEY,并将评测 ID 和运行 ID 替换为实际值。
curl https://api.openai.com/v1/evals?limit=1 \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json"

响应示例

{
  "object": "list",
  "data": [
    {
      "id": "eval_67abd54d9b0081909a86353f6fb9317a",
      "object": "eval",
      "data_source_config": {
        "type": "stored_completions",
        "metadata": {
          "usecase": "push_notifications_summarizer"
        },
        "schema": {
          "type": "object",
          "properties": {
            "item": {
              "type": "object"
            },
            "sample": {
              "type": "object"
            }
          },
          "required": [
            "item",
            "sample"
          ]
        }
      },
      "testing_criteria": [
        {
          "name": "推送通知摘要评分器",
          "id": "Push Notification Summary Grader-9b876f24-4762-4be9-aff4-db7a9b31c673",
          "type": "label_model",
          "model": "o3-mini",
          "input": [
            {
              "type": "message",
              "role": "developer",
              "content": {
                "type": "input_text",
                "text": "\n将以下推送通知摘要标记为 correct(正确)或 incorrect(不正确)。\n下方会提供推送通知和摘要。\n好的推送通知摘要应简洁明快。\n如果摘要符合要求,标记为 correct;否则标记为 incorrect。\n"
              }
            },
            {
              "type": "message",
              "role": "user",
              "content": {
                "type": "input_text",
                "text": "\n推送通知:{{item.input}}\n摘要:{{sample.output_text}}\n"
              }
            }
          ],
          "passing_labels": [
            "correct"
          ],
          "labels": [
            "correct",
            "incorrect"
          ],
          "sampling_params": null
        }
      ],
      "name": "推送通知摘要评分器",
      "created_at": 1739314509,
      "metadata": {
        "description": "用于推送通知摘要的已存储补全评测"
      }
    }
  ],
  "first_id": "eval_67abd54d9b0081909a86353f6fb9317a",
  "last_id": "eval_67aa884cf6688190b58f657d4441c8b7",
  "has_more": true
}

获取评测

get /evals/{eval_id}

按 ID 获取评测。

路径参数

  • eval_id: string

要获取的评测的 ID。

返回值

  • id: string

评测的唯一标识。

  • created_at: integer

评测创建时的 Unix 时间戳,单位为秒。

format: unixtime

  • data_source_config: EvalCustomDataSourceConfig or LogsDataSourceConfig { schema, type, metadata } or EvalStoredCompletionsDataSourceConfig

评测运行使用的数据源配置。

  • EvalCustomDataSourceConfig object { schema, type }

CustomDataSourceConfig,指定 item 命名空间的模式,并可选择指定 sample 命名空间的模式。 响应模式定义以下数据的结构:

  • 用于定义测试标准的数据,以及
  • 创建运行时需要提供的数据。

  • schema: map[unknown]

运行数据源条目的 JSON Schema。 JSON Schema 的构建方法参阅此处。

  • type: "custom" (default: "custom")

数据源类型,固定为 custom。

  • "custom"

  • LogsDataSourceConfig object { schema, type, metadata }

LogsDataSourceConfig,指定日志查询的元数据属性。 通常是 usecase=chatbot 或 prompt-version=v2 等元数据。 此数据源配置返回的模式定义评测中可用的变量。 使用此数据源配置时,item 和 sample 均有定义。

  • schema: map[unknown]

运行数据源条目的 JSON Schema。 JSON Schema 的构建方法参阅此处。

  • type: "logs" (default: "logs")

数据源类型,固定为 logs。

  • "logs"

  • metadata: optional Metadata or null

可附加到对象的元数据,最多包含 16 组键值对,可 以结构化方式存储对象的额外信息, 并通过 API 或控制台查询对象。

键为最多 64 个字符的字符串,值为 最多 512 个字符的字符串。

  • EvalStoredCompletionsDataSourceConfig object { schema, type, metadata }

已弃用,改用 LogsDataSourceConfig。

  • schema: map[unknown]

运行数据源条目的 JSON Schema。 JSON Schema 的构建方法参阅此处。

  • type: "stored_completions" (default: "stored_completions")

数据源类型,固定为 stored_completions。

  • "stored_completions"

  • metadata: optional Metadata or null

可附加到对象的元数据,最多包含 16 组键值对,可 以结构化方式存储对象的额外信息, 并通过 API 或控制台查询对象。

键为最多 64 个字符的字符串,值为 最多 512 个字符的字符串。

  • metadata: Metadata or null

可附加到对象的元数据,最多包含 16 组键值对,可 以结构化方式存储对象的额外信息, 并通过 API 或控制台查询对象。

键为最多 64 个字符的字符串,值为 最多 512 个字符的字符串。

  • name: string

评测名称。

  • object: "eval" (default: "eval")

对象类型。

  • "eval"

  • testing_criteria: array of LabelModelGrader or StringCheckGrader or TextSimilarityGrader or 2 more

测试标准列表。

  • LabelModelGrader object { input, labels, model, 3 more }

LabelModelGrader 对象,使用模型为评测中的每个条目 分配标签。

  • input: array of object { content, role, type }

  • content: string or ResponseInputText or OutputText { text, type } or 3 more

模型输入,可以包含模板字符串。支持输入文本、输出文本、输入图像和输入音频,可提供单个条目或条目数组。

  • TextInput = string

输入模型的文本。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • text: string

输入模型的文本。

  • type: "input_text" (default: "input_text")

输入条目类型,固定为 input_text。

  • "input_text"

  • prompt_cache_breakpoint: optional object { mode, ttl }

标记可复用提示词前缀的精确结束位置。省略 ttl 时,断点继承请求中的 prompt_cache_options.ttl;该边界不会按词元块取整。

  • mode: "explicit" (default: "explicit")

断点模式,固定为 explicit。

  • "explicit"

  • ttl: optional "30m" or "12h"

此缓存断点的最短存续时间,默认为请求的 TTL。

  • "30m"

  • "12h"

  • OutputText object { text, type }

模型输出的文本。

  • text: string

模型输出的文本内容。

  • type: "output_text"

输出文本类型,固定为 output_text。

  • "output_text"

  • InputImage object { image_url, type, detail }

用于 EvalItem 内容数组中的图像输入块。

  • image_url: string

输入图像的 URL。

format: uri

  • type: "input_image"

输入图像类型,固定为 input_image。

  • "input_image"

  • detail: optional string

发送给模型的图像细节级别,可选 high、low 或 auto,默认为 auto。

  • ResponseInputAudio object { input_audio, type }

输入模型的音频。

  • input_audio: object { data, format }

  • data: string

采用 Base64 编码的音频数据。

  • format: "mp3" or "wav"

音频数据格式,当前支持 mp3 和 wav.

  • "mp3"

  • "wav"

  • type: "input_audio"

输入条目类型,固定为 input_audio。

  • "input_audio"

  • GraderInputs = array of string or ResponseInputText or OutputText { text, type } or 2 more

输入列表,每项可以是输入文本、输出文本、输入 图像或输入音频对象。

  • TextInput = string

输入模型的文本。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • OutputText object { text, type }

模型输出的文本。

  • text: string

模型输出的文本内容。

  • type: "output_text"

输出文本类型,固定为 output_text。

  • "output_text"

  • InputImage object { image_url, type, detail }

用于 EvalItem 内容数组中的图像输入块。

  • image_url: string

输入图像的 URL。

format: uri

  • type: "input_image"

输入图像类型,固定为 input_image。

  • "input_image"

  • detail: optional string

发送给模型的图像细节级别,可选 high、low 或 auto,默认为 auto。

  • ResponseInputAudio object { input_audio, type }

输入模型的音频。

  • role: "user" or "assistant" or "system" or "developer"

输入消息的角色,可选 user、assistant、system 或 developer.

  • "user"

  • "assistant"

  • "system"

  • "developer"

  • type: optional "message"

输入消息类型,固定为 message。

  • "message"

  • labels: array of string

要为评测中每个条目分配的标签。

  • model: string

评测使用的模型,须支持结构化输出。

  • name: string

评分器名称。

  • passing_labels: array of string

表示通过评测的标签,须为 labels 的子集。

  • type: "label_model"

对象类型,固定为 label_model。

  • "label_model"

  • StringCheckGrader object { input, name, operation, 2 more }

StringCheckGrader 对象,使用指定操作对输入文本与参考文本进行字符串比较。

  • input: string

输入文本,可以包含模板字符串。

  • name: string

评分器名称。

  • operation: "eq" or "ne" or "like" or "ilike"

要执行的字符串检查操作,可选 eq、ne、like 或 ilike。

  • "eq"

  • "ne"

  • "like"

  • "ilike"

  • reference: string

参考文本,可以包含模板字符串。

  • type: "string_check"

对象类型,固定为 string_check。

  • "string_check"

  • TextSimilarityGrader = TextSimilarityGrader

TextSimilarityGrader 对象,根据文本相似度指标评分。

  • pass_threshold: number

分数阈值。

  • PythonGrader = PythonGrader

PythonGrader 对象,对输入运行 Python 脚本。

  • pass_threshold: optional number

分数阈值。

  • ScoreModelGrader = ScoreModelGrader

ScoreModelGrader 对象,使用模型为输入评分。

  • pass_threshold: optional number

分数阈值。

示例

## 设置 OPENAI_API_KEY,并将评测 ID 和运行 ID 替换为实际值。
curl https://api.openai.com/v1/evals/$EVAL_ID \
    -H "Authorization: Bearer $OPENAI_API_KEY"

200 响应示例

{
  "id": "id",
  "created_at": 0,
  "data_source_config": {
    "schema": {
      "type": "object",
      "properties": {
        "item": {
          "type": "object",
          "properties": {
            "label": {
              "type": "string"
            }
          },
          "required": [
            "label"
          ]
        }
      },
      "required": [
        "item"
      ]
    },
    "type": "custom"
  },
  "metadata": {
    "foo": "string"
  },
  "name": "聊天机器人效果评测",
  "object": "eval",
  "testing_criteria": [
    {
      "input": [
        {
          "content": "string",
          "role": "user",
          "type": "message"
        }
      ],
      "labels": [
        "string"
      ],
      "model": "model",
      "name": "name",
      "passing_labels": [
        "string"
      ],
      "type": "label_model"
    }
  ]
}

示例

## 设置 OPENAI_API_KEY,并将评测 ID 和运行 ID 替换为实际值。
curl https://api.openai.com/v1/evals/eval_67abd54d9b0081909a86353f6fb9317a \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json"

响应示例

{
  "object": "eval",
  "id": "eval_67abd54d9b0081909a86353f6fb9317a",
  "data_source_config": {
    "type": "custom",
    "schema": {
      "type": "object",
      "properties": {
        "item": {
          "type": "object",
          "properties": {
            "input": {
              "type": "string"
            },
            "ground_truth": {
              "type": "string"
            }
          },
          "required": [
            "input",
            "ground_truth"
          ]
        }
      },
      "required": [
        "item"
      ]
    }
  },
  "testing_criteria": [
    {
      "name": "字符串检查",
      "id": "String check-2eaf2d8d-d649-4335-8148-9535a7ca73c2",
      "type": "string_check",
      "input": "{{item.input}}",
      "reference": "{{item.ground_truth}}",
      "operation": "eq"
    }
  ],
  "name": "外部数据评测",
  "created_at": 1739314509,
  "metadata": {}
}

更新评测

post /evals/{eval_id}

更新评测的指定属性。

路径参数

  • eval_id: string

要更新的评测的 ID。

请求体参数

内容类型:application/json

  • metadata: optional Metadata or null

可附加到对象的元数据,最多包含 16 组键值对,可 以结构化方式存储对象的额外信息, 并通过 API 或控制台查询对象。

键为最多 64 个字符的字符串,值为 最多 512 个字符的字符串。

  • name: optional string

重命名评测。

返回值

  • id: string

评测的唯一标识。

  • created_at: integer

评测创建时的 Unix 时间戳,单位为秒。

format: unixtime

  • data_source_config: EvalCustomDataSourceConfig or LogsDataSourceConfig { schema, type, metadata } or EvalStoredCompletionsDataSourceConfig

评测运行使用的数据源配置。

  • EvalCustomDataSourceConfig object { schema, type }

CustomDataSourceConfig,指定 item 命名空间的模式,并可选择指定 sample 命名空间的模式。 响应模式定义以下数据的结构:

  • 用于定义测试标准的数据,以及
  • 创建运行时需要提供的数据。

  • schema: map[unknown]

运行数据源条目的 JSON Schema。 JSON Schema 的构建方法参阅此处。

  • type: "custom" (default: "custom")

数据源类型,固定为 custom。

  • "custom"

  • LogsDataSourceConfig object { schema, type, metadata }

LogsDataSourceConfig,指定日志查询的元数据属性。 通常是 usecase=chatbot 或 prompt-version=v2 等元数据。 此数据源配置返回的模式定义评测中可用的变量。 使用此数据源配置时,item 和 sample 均有定义。

  • schema: map[unknown]

运行数据源条目的 JSON Schema。 JSON Schema 的构建方法参阅此处。

  • type: "logs" (default: "logs")

数据源类型,固定为 logs。

  • "logs"

  • metadata: optional Metadata or null

可附加到对象的元数据,最多包含 16 组键值对,可 以结构化方式存储对象的额外信息, 并通过 API 或控制台查询对象。

键为最多 64 个字符的字符串,值为 最多 512 个字符的字符串。

  • EvalStoredCompletionsDataSourceConfig object { schema, type, metadata }

已弃用,改用 LogsDataSourceConfig。

  • schema: map[unknown]

运行数据源条目的 JSON Schema。 JSON Schema 的构建方法参阅此处。

  • type: "stored_completions" (default: "stored_completions")

数据源类型,固定为 stored_completions。

  • "stored_completions"

  • metadata: optional Metadata or null

可附加到对象的元数据,最多包含 16 组键值对,可 以结构化方式存储对象的额外信息, 并通过 API 或控制台查询对象。

键为最多 64 个字符的字符串,值为 最多 512 个字符的字符串。

  • metadata: Metadata or null

可附加到对象的元数据,最多包含 16 组键值对,可 以结构化方式存储对象的额外信息, 并通过 API 或控制台查询对象。

键为最多 64 个字符的字符串,值为 最多 512 个字符的字符串。

  • name: string

评测名称。

  • object: "eval" (default: "eval")

对象类型。

  • "eval"

  • testing_criteria: array of LabelModelGrader or StringCheckGrader or TextSimilarityGrader or 2 more

测试标准列表。

  • LabelModelGrader object { input, labels, model, 3 more }

LabelModelGrader 对象,使用模型为评测中的每个条目 分配标签。

  • input: array of object { content, role, type }

  • content: string or ResponseInputText or OutputText { text, type } or 3 more

模型输入,可以包含模板字符串。支持输入文本、输出文本、输入图像和输入音频,可提供单个条目或条目数组。

  • TextInput = string

输入模型的文本。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • text: string

输入模型的文本。

  • type: "input_text" (default: "input_text")

输入条目类型,固定为 input_text。

  • "input_text"

  • prompt_cache_breakpoint: optional object { mode, ttl }

标记可复用提示词前缀的精确结束位置。省略 ttl 时,断点继承请求中的 prompt_cache_options.ttl;该边界不会按词元块取整。

  • mode: "explicit" (default: "explicit")

断点模式,固定为 explicit。

  • "explicit"

  • ttl: optional "30m" or "12h"

此缓存断点的最短存续时间,默认为请求的 TTL。

  • "30m"

  • "12h"

  • OutputText object { text, type }

模型输出的文本。

  • text: string

模型输出的文本内容。

  • type: "output_text"

输出文本类型,固定为 output_text。

  • "output_text"

  • InputImage object { image_url, type, detail }

用于 EvalItem 内容数组中的图像输入块。

  • image_url: string

输入图像的 URL。

format: uri

  • type: "input_image"

输入图像类型,固定为 input_image。

  • "input_image"

  • detail: optional string

发送给模型的图像细节级别,可选 high、low 或 auto,默认为 auto。

  • ResponseInputAudio object { input_audio, type }

输入模型的音频。

  • input_audio: object { data, format }

  • data: string

采用 Base64 编码的音频数据。

  • format: "mp3" or "wav"

音频数据格式,当前支持 mp3 和 wav.

  • "mp3"

  • "wav"

  • type: "input_audio"

输入条目类型,固定为 input_audio。

  • "input_audio"

  • GraderInputs = array of string or ResponseInputText or OutputText { text, type } or 2 more

输入列表,每项可以是输入文本、输出文本、输入 图像或输入音频对象。

  • TextInput = string

输入模型的文本。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • OutputText object { text, type }

模型输出的文本。

  • text: string

模型输出的文本内容。

  • type: "output_text"

输出文本类型,固定为 output_text。

  • "output_text"

  • InputImage object { image_url, type, detail }

用于 EvalItem 内容数组中的图像输入块。

  • image_url: string

输入图像的 URL。

format: uri

  • type: "input_image"

输入图像类型,固定为 input_image。

  • "input_image"

  • detail: optional string

发送给模型的图像细节级别,可选 high、low 或 auto,默认为 auto。

  • ResponseInputAudio object { input_audio, type }

输入模型的音频。

  • role: "user" or "assistant" or "system" or "developer"

输入消息的角色,可选 user、assistant、system 或 developer.

  • "user"

  • "assistant"

  • "system"

  • "developer"

  • type: optional "message"

输入消息类型,固定为 message。

  • "message"

  • labels: array of string

要为评测中每个条目分配的标签。

  • model: string

评测使用的模型,须支持结构化输出。

  • name: string

评分器名称。

  • passing_labels: array of string

表示通过评测的标签,须为 labels 的子集。

  • type: "label_model"

对象类型,固定为 label_model。

  • "label_model"

  • StringCheckGrader object { input, name, operation, 2 more }

StringCheckGrader 对象,使用指定操作对输入文本与参考文本进行字符串比较。

  • input: string

输入文本,可以包含模板字符串。

  • name: string

评分器名称。

  • operation: "eq" or "ne" or "like" or "ilike"

要执行的字符串检查操作,可选 eq、ne、like 或 ilike。

  • "eq"

  • "ne"

  • "like"

  • "ilike"

  • reference: string

参考文本,可以包含模板字符串。

  • type: "string_check"

对象类型,固定为 string_check。

  • "string_check"

  • TextSimilarityGrader = TextSimilarityGrader

TextSimilarityGrader 对象,根据文本相似度指标评分。

  • pass_threshold: number

分数阈值。

  • PythonGrader = PythonGrader

PythonGrader 对象,对输入运行 Python 脚本。

  • pass_threshold: optional number

分数阈值。

  • ScoreModelGrader = ScoreModelGrader

ScoreModelGrader 对象,使用模型为输入评分。

  • pass_threshold: optional number

分数阈值。

示例

## 设置 OPENAI_API_KEY,并将评测 ID 和运行 ID 替换为实际值。
curl https://api.openai.com/v1/evals/$EVAL_ID \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $OPENAI_API_KEY" \
    -d '{}'

200 响应示例

{
  "id": "id",
  "created_at": 0,
  "data_source_config": {
    "schema": {
      "type": "object",
      "properties": {
        "item": {
          "type": "object",
          "properties": {
            "label": {
              "type": "string"
            }
          },
          "required": [
            "label"
          ]
        }
      },
      "required": [
        "item"
      ]
    },
    "type": "custom"
  },
  "metadata": {
    "foo": "string"
  },
  "name": "聊天机器人效果评测",
  "object": "eval",
  "testing_criteria": [
    {
      "input": [
        {
          "content": "string",
          "role": "user",
          "type": "message"
        }
      ],
      "labels": [
        "string"
      ],
      "model": "model",
      "name": "name",
      "passing_labels": [
        "string"
      ],
      "type": "label_model"
    }
  ]
}

示例

## 设置 OPENAI_API_KEY,并将评测 ID 和运行 ID 替换为实际值。
curl https://api.openai.com/v1/evals/eval_67abd54d9b0081909a86353f6fb9317a \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "更新后的评测", "metadata": {"description": "更新后的描述"}}'

响应示例

{
  "object": "eval",
  "id": "eval_67abd54d9b0081909a86353f6fb9317a",
  "data_source_config": {
    "type": "custom",
    "schema": {
      "type": "object",
      "properties": {
        "item": {
          "type": "object",
          "properties": {
            "input": {
              "type": "string"
            },
            "ground_truth": {
              "type": "string"
            }
          },
          "required": [
            "input",
            "ground_truth"
          ]
        }
      },
      "required": [
        "item"
      ]
    }
  },
  "testing_criteria": [
    {
      "name": "字符串检查",
      "id": "String check-2eaf2d8d-d649-4335-8148-9535a7ca73c2",
      "type": "string_check",
      "input": "{{item.input}}",
      "reference": "{{item.ground_truth}}",
      "operation": "eq"
    }
  ],
  "name": "更新后的评测",
  "created_at": 1739314509,
  "metadata": {"description": "更新后的描述"}
}

资源类型

评测创建响应

  • EvalCreateResponse object { id, created_at, data_source_config, 4 more }

包含数据源配置和测试标准的 Eval 对象。 Eval 表示你的大语言模型集成需要完成的一项任务。 例如:

  • 提升聊天机器人的质量。
  • 了解聊天机器人处理客户支持的能力。
  • 检查 o4-mini 是否比 gpt-6-astra 更适合自己的用例。

  • id: string

评测的唯一标识。

  • created_at: integer

评测创建时的 Unix 时间戳,单位为秒。

format: unixtime

  • data_source_config: EvalCustomDataSourceConfig or LogsDataSourceConfig { schema, type, metadata } or EvalStoredCompletionsDataSourceConfig

评测运行使用的数据源配置。

  • EvalCustomDataSourceConfig object { schema, type }

CustomDataSourceConfig,指定 item 命名空间的模式,并可选择指定 sample 命名空间的模式。 响应模式定义以下数据的结构:

  • 用于定义测试标准的数据,以及
  • 创建运行时需要提供的数据。

  • schema: map[unknown]

运行数据源条目的 JSON Schema。 JSON Schema 的构建方法参阅此处。

  • type: "custom" (default: "custom")

数据源类型,固定为 custom。

  • "custom"

  • LogsDataSourceConfig object { schema, type, metadata }

LogsDataSourceConfig,指定日志查询的元数据属性。 通常是 usecase=chatbot 或 prompt-version=v2 等元数据。 此数据源配置返回的模式定义评测中可用的变量。 使用此数据源配置时,item 和 sample 均有定义。

  • schema: map[unknown]

运行数据源条目的 JSON Schema。 JSON Schema 的构建方法参阅此处。

  • type: "logs" (default: "logs")

数据源类型,固定为 logs。

  • "logs"

  • metadata: optional Metadata or null

可附加到对象的元数据,最多包含 16 组键值对,可 以结构化方式存储对象的额外信息, 并通过 API 或控制台查询对象。

键为最多 64 个字符的字符串,值为 最多 512 个字符的字符串。

  • EvalStoredCompletionsDataSourceConfig object { schema, type, metadata }

已弃用,改用 LogsDataSourceConfig。

  • schema: map[unknown]

运行数据源条目的 JSON Schema。 JSON Schema 的构建方法参阅此处。

  • type: "stored_completions" (default: "stored_completions")

数据源类型,固定为 stored_completions。

  • "stored_completions"

  • metadata: optional Metadata or null

可附加到对象的元数据,最多包含 16 组键值对,可 以结构化方式存储对象的额外信息, 并通过 API 或控制台查询对象。

键为最多 64 个字符的字符串,值为 最多 512 个字符的字符串。

  • metadata: Metadata or null

可附加到对象的元数据,最多包含 16 组键值对,可 以结构化方式存储对象的额外信息, 并通过 API 或控制台查询对象。

键为最多 64 个字符的字符串,值为 最多 512 个字符的字符串。

  • name: string

评测名称。

  • object: "eval" (default: "eval")

对象类型。

  • "eval"

  • testing_criteria: array of LabelModelGrader or StringCheckGrader or TextSimilarityGrader or 2 more

测试标准列表。

  • LabelModelGrader object { input, labels, model, 3 more }

LabelModelGrader 对象,使用模型为评测中的每个条目 分配标签。

  • input: array of object { content, role, type }

  • content: string or ResponseInputText or OutputText { text, type } or 3 more

模型输入,可以包含模板字符串。支持输入文本、输出文本、输入图像和输入音频,可提供单个条目或条目数组。

  • TextInput = string

输入模型的文本。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • text: string

输入模型的文本。

  • type: "input_text" (default: "input_text")

输入条目类型,固定为 input_text。

  • "input_text"

  • prompt_cache_breakpoint: optional object { mode, ttl }

标记可复用提示词前缀的精确结束位置。省略 ttl 时,断点继承请求中的 prompt_cache_options.ttl;该边界不会按词元块取整。

  • mode: "explicit" (default: "explicit")

断点模式,固定为 explicit。

  • "explicit"

  • ttl: optional "30m" or "12h"

此缓存断点的最短存续时间,默认为请求的 TTL。

  • "30m"

  • "12h"

  • OutputText object { text, type }

模型输出的文本。

  • text: string

模型输出的文本内容。

  • type: "output_text"

输出文本类型,固定为 output_text。

  • "output_text"

  • InputImage object { image_url, type, detail }

用于 EvalItem 内容数组中的图像输入块。

  • image_url: string

输入图像的 URL。

format: uri

  • type: "input_image"

输入图像类型,固定为 input_image。

  • "input_image"

  • detail: optional string

发送给模型的图像细节级别,可选 high、low 或 auto,默认为 auto。

  • ResponseInputAudio object { input_audio, type }

输入模型的音频。

  • input_audio: object { data, format }

  • data: string

采用 Base64 编码的音频数据。

  • format: "mp3" or "wav"

音频数据格式,当前支持 mp3 和 wav.

  • "mp3"

  • "wav"

  • type: "input_audio"

输入条目类型,固定为 input_audio。

  • "input_audio"

  • GraderInputs = array of string or ResponseInputText or OutputText { text, type } or 2 more

输入列表,每项可以是输入文本、输出文本、输入 图像或输入音频对象。

  • TextInput = string

输入模型的文本。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • OutputText object { text, type }

模型输出的文本。

  • text: string

模型输出的文本内容。

  • type: "output_text"

输出文本类型,固定为 output_text。

  • "output_text"

  • InputImage object { image_url, type, detail }

用于 EvalItem 内容数组中的图像输入块。

  • image_url: string

输入图像的 URL。

format: uri

  • type: "input_image"

输入图像类型,固定为 input_image。

  • "input_image"

  • detail: optional string

发送给模型的图像细节级别,可选 high、low 或 auto,默认为 auto。

  • ResponseInputAudio object { input_audio, type }

输入模型的音频。

  • role: "user" or "assistant" or "system" or "developer"

输入消息的角色,可选 user、assistant、system 或 developer.

  • "user"

  • "assistant"

  • "system"

  • "developer"

  • type: optional "message"

输入消息类型,固定为 message。

  • "message"

  • labels: array of string

要为评测中每个条目分配的标签。

  • model: string

评测使用的模型,须支持结构化输出。

  • name: string

评分器名称。

  • passing_labels: array of string

表示通过评测的标签,须为 labels 的子集。

  • type: "label_model"

对象类型,固定为 label_model。

  • "label_model"

  • StringCheckGrader object { input, name, operation, 2 more }

StringCheckGrader 对象,使用指定操作对输入文本与参考文本进行字符串比较。

  • input: string

输入文本,可以包含模板字符串。

  • name: string

评分器名称。

  • operation: "eq" or "ne" or "like" or "ilike"

要执行的字符串检查操作,可选 eq、ne、like 或 ilike。

  • "eq"

  • "ne"

  • "like"

  • "ilike"

  • reference: string

参考文本,可以包含模板字符串。

  • type: "string_check"

对象类型,固定为 string_check。

  • "string_check"

  • TextSimilarityGrader = TextSimilarityGrader

TextSimilarityGrader 对象,根据文本相似度指标评分。

  • pass_threshold: number

分数阈值。

  • PythonGrader = PythonGrader

PythonGrader 对象,对输入运行 Python 脚本。

  • pass_threshold: optional number

分数阈值。

  • ScoreModelGrader = ScoreModelGrader

ScoreModelGrader 对象,使用模型为输入评分。

  • pass_threshold: optional number

分数阈值。

评测自定义数据源配置

  • EvalCustomDataSourceConfig object { schema, type }

CustomDataSourceConfig,指定 item 命名空间的模式,并可选择指定 sample 命名空间的模式。 响应模式定义以下数据的结构:

  • 用于定义测试标准的数据,以及
  • 创建运行时需要提供的数据。

  • schema: map[unknown]

运行数据源条目的 JSON Schema。 JSON Schema 的构建方法参阅此处。

  • type: "custom" (default: "custom")

数据源类型,固定为 custom。

  • "custom"

评测删除响应

  • EvalDeleteResponse object { deleted, eval_id, object }

  • deleted: boolean

  • eval_id: string

  • object: string

评测列表响应

  • EvalListResponse object { id, created_at, data_source_config, 4 more }

包含数据源配置和测试标准的 Eval 对象。 Eval 表示你的大语言模型集成需要完成的一项任务。 例如:

  • 提升聊天机器人的质量。
  • 了解聊天机器人处理客户支持的能力。
  • 检查 o4-mini 是否比 gpt-6-astra 更适合自己的用例。

  • id: string

评测的唯一标识。

  • created_at: integer

评测创建时的 Unix 时间戳,单位为秒。

format: unixtime

  • data_source_config: EvalCustomDataSourceConfig or LogsDataSourceConfig { schema, type, metadata } or EvalStoredCompletionsDataSourceConfig

评测运行使用的数据源配置。

  • EvalCustomDataSourceConfig object { schema, type }

CustomDataSourceConfig,指定 item 命名空间的模式,并可选择指定 sample 命名空间的模式。 响应模式定义以下数据的结构:

  • 用于定义测试标准的数据,以及
  • 创建运行时需要提供的数据。

  • schema: map[unknown]

运行数据源条目的 JSON Schema。 JSON Schema 的构建方法参阅此处。

  • type: "custom" (default: "custom")

数据源类型,固定为 custom。

  • "custom"

  • LogsDataSourceConfig object { schema, type, metadata }

LogsDataSourceConfig,指定日志查询的元数据属性。 通常是 usecase=chatbot 或 prompt-version=v2 等元数据。 此数据源配置返回的模式定义评测中可用的变量。 使用此数据源配置时,item 和 sample 均有定义。

  • schema: map[unknown]

运行数据源条目的 JSON Schema。 JSON Schema 的构建方法参阅此处。

  • type: "logs" (default: "logs")

数据源类型,固定为 logs。

  • "logs"

  • metadata: optional Metadata or null

可附加到对象的元数据,最多包含 16 组键值对,可 以结构化方式存储对象的额外信息, 并通过 API 或控制台查询对象。

键为最多 64 个字符的字符串,值为 最多 512 个字符的字符串。

  • EvalStoredCompletionsDataSourceConfig object { schema, type, metadata }

已弃用,改用 LogsDataSourceConfig。

  • schema: map[unknown]

运行数据源条目的 JSON Schema。 JSON Schema 的构建方法参阅此处。

  • type: "stored_completions" (default: "stored_completions")

数据源类型,固定为 stored_completions。

  • "stored_completions"

  • metadata: optional Metadata or null

可附加到对象的元数据,最多包含 16 组键值对,可 以结构化方式存储对象的额外信息, 并通过 API 或控制台查询对象。

键为最多 64 个字符的字符串,值为 最多 512 个字符的字符串。

  • metadata: Metadata or null

可附加到对象的元数据,最多包含 16 组键值对,可 以结构化方式存储对象的额外信息, 并通过 API 或控制台查询对象。

键为最多 64 个字符的字符串,值为 最多 512 个字符的字符串。

  • name: string

评测名称。

  • object: "eval" (default: "eval")

对象类型。

  • "eval"

  • testing_criteria: array of LabelModelGrader or StringCheckGrader or TextSimilarityGrader or 2 more

测试标准列表。

  • LabelModelGrader object { input, labels, model, 3 more }

LabelModelGrader 对象,使用模型为评测中的每个条目 分配标签。

  • input: array of object { content, role, type }

  • content: string or ResponseInputText or OutputText { text, type } or 3 more

模型输入,可以包含模板字符串。支持输入文本、输出文本、输入图像和输入音频,可提供单个条目或条目数组。

  • TextInput = string

输入模型的文本。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • text: string

输入模型的文本。

  • type: "input_text" (default: "input_text")

输入条目类型,固定为 input_text。

  • "input_text"

  • prompt_cache_breakpoint: optional object { mode, ttl }

标记可复用提示词前缀的精确结束位置。省略 ttl 时,断点继承请求中的 prompt_cache_options.ttl;该边界不会按词元块取整。

  • mode: "explicit" (default: "explicit")

断点模式,固定为 explicit。

  • "explicit"

  • ttl: optional "30m" or "12h"

此缓存断点的最短存续时间,默认为请求的 TTL。

  • "30m"

  • "12h"

  • OutputText object { text, type }

模型输出的文本。

  • text: string

模型输出的文本内容。

  • type: "output_text"

输出文本类型,固定为 output_text。

  • "output_text"

  • InputImage object { image_url, type, detail }

用于 EvalItem 内容数组中的图像输入块。

  • image_url: string

输入图像的 URL。

format: uri

  • type: "input_image"

输入图像类型,固定为 input_image。

  • "input_image"

  • detail: optional string

发送给模型的图像细节级别,可选 high、low 或 auto,默认为 auto。

  • ResponseInputAudio object { input_audio, type }

输入模型的音频。

  • input_audio: object { data, format }

  • data: string

采用 Base64 编码的音频数据。

  • format: "mp3" or "wav"

音频数据格式,当前支持 mp3 和 wav.

  • "mp3"

  • "wav"

  • type: "input_audio"

输入条目类型,固定为 input_audio。

  • "input_audio"

  • GraderInputs = array of string or ResponseInputText or OutputText { text, type } or 2 more

输入列表,每项可以是输入文本、输出文本、输入 图像或输入音频对象。

  • TextInput = string

输入模型的文本。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • OutputText object { text, type }

模型输出的文本。

  • text: string

模型输出的文本内容。

  • type: "output_text"

输出文本类型,固定为 output_text。

  • "output_text"

  • InputImage object { image_url, type, detail }

用于 EvalItem 内容数组中的图像输入块。

  • image_url: string

输入图像的 URL。

format: uri

  • type: "input_image"

输入图像类型,固定为 input_image。

  • "input_image"

  • detail: optional string

发送给模型的图像细节级别,可选 high、low 或 auto,默认为 auto。

  • ResponseInputAudio object { input_audio, type }

输入模型的音频。

  • role: "user" or "assistant" or "system" or "developer"

输入消息的角色,可选 user、assistant、system 或 developer.

  • "user"

  • "assistant"

  • "system"

  • "developer"

  • type: optional "message"

输入消息类型,固定为 message。

  • "message"

  • labels: array of string

要为评测中每个条目分配的标签。

  • model: string

评测使用的模型,须支持结构化输出。

  • name: string

评分器名称。

  • passing_labels: array of string

表示通过评测的标签,须为 labels 的子集。

  • type: "label_model"

对象类型,固定为 label_model。

  • "label_model"

  • StringCheckGrader object { input, name, operation, 2 more }

StringCheckGrader 对象,使用指定操作对输入文本与参考文本进行字符串比较。

  • input: string

输入文本,可以包含模板字符串。

  • name: string

评分器名称。

  • operation: "eq" or "ne" or "like" or "ilike"

要执行的字符串检查操作,可选 eq、ne、like 或 ilike。

  • "eq"

  • "ne"

  • "like"

  • "ilike"

  • reference: string

参考文本,可以包含模板字符串。

  • type: "string_check"

对象类型,固定为 string_check。

  • "string_check"

  • TextSimilarityGrader = TextSimilarityGrader

TextSimilarityGrader 对象,根据文本相似度指标评分。

  • pass_threshold: number

分数阈值。

  • PythonGrader = PythonGrader

PythonGrader 对象,对输入运行 Python 脚本。

  • pass_threshold: optional number

分数阈值。

  • ScoreModelGrader = ScoreModelGrader

ScoreModelGrader 对象,使用模型为输入评分。

  • pass_threshold: optional number

分数阈值。

评测获取响应

  • EvalRetrieveResponse object { id, created_at, data_source_config, 4 more }

包含数据源配置和测试标准的 Eval 对象。 Eval 表示你的大语言模型集成需要完成的一项任务。 例如:

  • 提升聊天机器人的质量。
  • 了解聊天机器人处理客户支持的能力。
  • 检查 o4-mini 是否比 gpt-6-astra 更适合自己的用例。

  • id: string

评测的唯一标识。

  • created_at: integer

评测创建时的 Unix 时间戳,单位为秒。

format: unixtime

  • data_source_config: EvalCustomDataSourceConfig or LogsDataSourceConfig { schema, type, metadata } or EvalStoredCompletionsDataSourceConfig

评测运行使用的数据源配置。

  • EvalCustomDataSourceConfig object { schema, type }

CustomDataSourceConfig,指定 item 命名空间的模式,并可选择指定 sample 命名空间的模式。 响应模式定义以下数据的结构:

  • 用于定义测试标准的数据,以及
  • 创建运行时需要提供的数据。

  • schema: map[unknown]

运行数据源条目的 JSON Schema。 JSON Schema 的构建方法参阅此处。

  • type: "custom" (default: "custom")

数据源类型,固定为 custom。

  • "custom"

  • LogsDataSourceConfig object { schema, type, metadata }

LogsDataSourceConfig,指定日志查询的元数据属性。 通常是 usecase=chatbot 或 prompt-version=v2 等元数据。 此数据源配置返回的模式定义评测中可用的变量。 使用此数据源配置时,item 和 sample 均有定义。

  • schema: map[unknown]

运行数据源条目的 JSON Schema。 JSON Schema 的构建方法参阅此处。

  • type: "logs" (default: "logs")

数据源类型,固定为 logs。

  • "logs"

  • metadata: optional Metadata or null

可附加到对象的元数据,最多包含 16 组键值对,可 以结构化方式存储对象的额外信息, 并通过 API 或控制台查询对象。

键为最多 64 个字符的字符串,值为 最多 512 个字符的字符串。

  • EvalStoredCompletionsDataSourceConfig object { schema, type, metadata }

已弃用,改用 LogsDataSourceConfig。

  • schema: map[unknown]

运行数据源条目的 JSON Schema。 JSON Schema 的构建方法参阅此处。

  • type: "stored_completions" (default: "stored_completions")

数据源类型,固定为 stored_completions。

  • "stored_completions"

  • metadata: optional Metadata or null

可附加到对象的元数据,最多包含 16 组键值对,可 以结构化方式存储对象的额外信息, 并通过 API 或控制台查询对象。

键为最多 64 个字符的字符串,值为 最多 512 个字符的字符串。

  • metadata: Metadata or null

可附加到对象的元数据,最多包含 16 组键值对,可 以结构化方式存储对象的额外信息, 并通过 API 或控制台查询对象。

键为最多 64 个字符的字符串,值为 最多 512 个字符的字符串。

  • name: string

评测名称。

  • object: "eval" (default: "eval")

对象类型。

  • "eval"

  • testing_criteria: array of LabelModelGrader or StringCheckGrader or TextSimilarityGrader or 2 more

测试标准列表。

  • LabelModelGrader object { input, labels, model, 3 more }

LabelModelGrader 对象,使用模型为评测中的每个条目 分配标签。

  • input: array of object { content, role, type }

  • content: string or ResponseInputText or OutputText { text, type } or 3 more

模型输入,可以包含模板字符串。支持输入文本、输出文本、输入图像和输入音频,可提供单个条目或条目数组。

  • TextInput = string

输入模型的文本。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • text: string

输入模型的文本。

  • type: "input_text" (default: "input_text")

输入条目类型,固定为 input_text。

  • "input_text"

  • prompt_cache_breakpoint: optional object { mode, ttl }

标记可复用提示词前缀的精确结束位置。省略 ttl 时,断点继承请求中的 prompt_cache_options.ttl;该边界不会按词元块取整。

  • mode: "explicit" (default: "explicit")

断点模式,固定为 explicit。

  • "explicit"

  • ttl: optional "30m" or "12h"

此缓存断点的最短存续时间,默认为请求的 TTL。

  • "30m"

  • "12h"

  • OutputText object { text, type }

模型输出的文本。

  • text: string

模型输出的文本内容。

  • type: "output_text"

输出文本类型,固定为 output_text。

  • "output_text"

  • InputImage object { image_url, type, detail }

用于 EvalItem 内容数组中的图像输入块。

  • image_url: string

输入图像的 URL。

format: uri

  • type: "input_image"

输入图像类型,固定为 input_image。

  • "input_image"

  • detail: optional string

发送给模型的图像细节级别,可选 high、low 或 auto,默认为 auto。

  • ResponseInputAudio object { input_audio, type }

输入模型的音频。

  • input_audio: object { data, format }

  • data: string

采用 Base64 编码的音频数据。

  • format: "mp3" or "wav"

音频数据格式,当前支持 mp3 和 wav.

  • "mp3"

  • "wav"

  • type: "input_audio"

输入条目类型,固定为 input_audio。

  • "input_audio"

  • GraderInputs = array of string or ResponseInputText or OutputText { text, type } or 2 more

输入列表,每项可以是输入文本、输出文本、输入 图像或输入音频对象。

  • TextInput = string

输入模型的文本。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • OutputText object { text, type }

模型输出的文本。

  • text: string

模型输出的文本内容。

  • type: "output_text"

输出文本类型,固定为 output_text。

  • "output_text"

  • InputImage object { image_url, type, detail }

用于 EvalItem 内容数组中的图像输入块。

  • image_url: string

输入图像的 URL。

format: uri

  • type: "input_image"

输入图像类型,固定为 input_image。

  • "input_image"

  • detail: optional string

发送给模型的图像细节级别,可选 high、low 或 auto,默认为 auto。

  • ResponseInputAudio object { input_audio, type }

输入模型的音频。

  • role: "user" or "assistant" or "system" or "developer"

输入消息的角色,可选 user、assistant、system 或 developer.

  • "user"

  • "assistant"

  • "system"

  • "developer"

  • type: optional "message"

输入消息类型,固定为 message。

  • "message"

  • labels: array of string

要为评测中每个条目分配的标签。

  • model: string

评测使用的模型,须支持结构化输出。

  • name: string

评分器名称。

  • passing_labels: array of string

表示通过评测的标签,须为 labels 的子集。

  • type: "label_model"

对象类型,固定为 label_model。

  • "label_model"

  • StringCheckGrader object { input, name, operation, 2 more }

StringCheckGrader 对象,使用指定操作对输入文本与参考文本进行字符串比较。

  • input: string

输入文本,可以包含模板字符串。

  • name: string

评分器名称。

  • operation: "eq" or "ne" or "like" or "ilike"

要执行的字符串检查操作,可选 eq、ne、like 或 ilike。

  • "eq"

  • "ne"

  • "like"

  • "ilike"

  • reference: string

参考文本,可以包含模板字符串。

  • type: "string_check"

对象类型,固定为 string_check。

  • "string_check"

  • TextSimilarityGrader = TextSimilarityGrader

TextSimilarityGrader 对象,根据文本相似度指标评分。

  • pass_threshold: number

分数阈值。

  • PythonGrader = PythonGrader

PythonGrader 对象,对输入运行 Python 脚本。

  • pass_threshold: optional number

分数阈值。

  • ScoreModelGrader = ScoreModelGrader

ScoreModelGrader 对象,使用模型为输入评分。

  • pass_threshold: optional number

分数阈值。

评测已存储补全数据源配置

  • EvalStoredCompletionsDataSourceConfig object { schema, type, metadata }

已弃用,改用 LogsDataSourceConfig。

  • schema: map[unknown]

运行数据源条目的 JSON Schema。 JSON Schema 的构建方法参阅此处。

  • type: "stored_completions" (default: "stored_completions")

数据源类型,固定为 stored_completions。

  • "stored_completions"

  • metadata: optional Metadata or null

可附加到对象的元数据,最多包含 16 组键值对,可 以结构化方式存储对象的额外信息, 并通过 API 或控制台查询对象。

键为最多 64 个字符的字符串,值为 最多 512 个字符的字符串。

评测更新响应

  • EvalUpdateResponse object { id, created_at, data_source_config, 4 more }

包含数据源配置和测试标准的 Eval 对象。 Eval 表示你的大语言模型集成需要完成的一项任务。 例如:

  • 提升聊天机器人的质量。
  • 了解聊天机器人处理客户支持的能力。
  • 检查 o4-mini 是否比 gpt-6-astra 更适合自己的用例。

  • id: string

评测的唯一标识。

  • created_at: integer

评测创建时的 Unix 时间戳,单位为秒。

format: unixtime

  • data_source_config: EvalCustomDataSourceConfig or LogsDataSourceConfig { schema, type, metadata } or EvalStoredCompletionsDataSourceConfig

评测运行使用的数据源配置。

  • EvalCustomDataSourceConfig object { schema, type }

CustomDataSourceConfig,指定 item 命名空间的模式,并可选择指定 sample 命名空间的模式。 响应模式定义以下数据的结构:

  • 用于定义测试标准的数据,以及
  • 创建运行时需要提供的数据。

  • schema: map[unknown]

运行数据源条目的 JSON Schema。 JSON Schema 的构建方法参阅此处。

  • type: "custom" (default: "custom")

数据源类型,固定为 custom。

  • "custom"

  • LogsDataSourceConfig object { schema, type, metadata }

LogsDataSourceConfig,指定日志查询的元数据属性。 通常是 usecase=chatbot 或 prompt-version=v2 等元数据。 此数据源配置返回的模式定义评测中可用的变量。 使用此数据源配置时,item 和 sample 均有定义。

  • schema: map[unknown]

运行数据源条目的 JSON Schema。 JSON Schema 的构建方法参阅此处。

  • type: "logs" (default: "logs")

数据源类型,固定为 logs。

  • "logs"

  • metadata: optional Metadata or null

可附加到对象的元数据,最多包含 16 组键值对,可 以结构化方式存储对象的额外信息, 并通过 API 或控制台查询对象。

键为最多 64 个字符的字符串,值为 最多 512 个字符的字符串。

  • EvalStoredCompletionsDataSourceConfig object { schema, type, metadata }

已弃用,改用 LogsDataSourceConfig。

  • schema: map[unknown]

运行数据源条目的 JSON Schema。 JSON Schema 的构建方法参阅此处。

  • type: "stored_completions" (default: "stored_completions")

数据源类型,固定为 stored_completions。

  • "stored_completions"

  • metadata: optional Metadata or null

可附加到对象的元数据,最多包含 16 组键值对,可 以结构化方式存储对象的额外信息, 并通过 API 或控制台查询对象。

键为最多 64 个字符的字符串,值为 最多 512 个字符的字符串。

  • metadata: Metadata or null

可附加到对象的元数据,最多包含 16 组键值对,可 以结构化方式存储对象的额外信息, 并通过 API 或控制台查询对象。

键为最多 64 个字符的字符串,值为 最多 512 个字符的字符串。

  • name: string

评测名称。

  • object: "eval" (default: "eval")

对象类型。

  • "eval"

  • testing_criteria: array of LabelModelGrader or StringCheckGrader or TextSimilarityGrader or 2 more

测试标准列表。

  • LabelModelGrader object { input, labels, model, 3 more }

LabelModelGrader 对象,使用模型为评测中的每个条目 分配标签。

  • input: array of object { content, role, type }

  • content: string or ResponseInputText or OutputText { text, type } or 3 more

模型输入,可以包含模板字符串。支持输入文本、输出文本、输入图像和输入音频,可提供单个条目或条目数组。

  • TextInput = string

输入模型的文本。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • text: string

输入模型的文本。

  • type: "input_text" (default: "input_text")

输入条目类型,固定为 input_text。

  • "input_text"

  • prompt_cache_breakpoint: optional object { mode, ttl }

标记可复用提示词前缀的精确结束位置。省略 ttl 时,断点继承请求中的 prompt_cache_options.ttl;该边界不会按词元块取整。

  • mode: "explicit" (default: "explicit")

断点模式,固定为 explicit。

  • "explicit"

  • ttl: optional "30m" or "12h"

此缓存断点的最短存续时间,默认为请求的 TTL。

  • "30m"

  • "12h"

  • OutputText object { text, type }

模型输出的文本。

  • text: string

模型输出的文本内容。

  • type: "output_text"

输出文本类型,固定为 output_text。

  • "output_text"

  • InputImage object { image_url, type, detail }

用于 EvalItem 内容数组中的图像输入块。

  • image_url: string

输入图像的 URL。

format: uri

  • type: "input_image"

输入图像类型,固定为 input_image。

  • "input_image"

  • detail: optional string

发送给模型的图像细节级别,可选 high、low 或 auto,默认为 auto。

  • ResponseInputAudio object { input_audio, type }

输入模型的音频。

  • input_audio: object { data, format }

  • data: string

采用 Base64 编码的音频数据。

  • format: "mp3" or "wav"

音频数据格式,当前支持 mp3 和 wav.

  • "mp3"

  • "wav"

  • type: "input_audio"

输入条目类型,固定为 input_audio。

  • "input_audio"

  • GraderInputs = array of string or ResponseInputText or OutputText { text, type } or 2 more

输入列表,每项可以是输入文本、输出文本、输入 图像或输入音频对象。

  • TextInput = string

输入模型的文本。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • OutputText object { text, type }

模型输出的文本。

  • text: string

模型输出的文本内容。

  • type: "output_text"

输出文本类型,固定为 output_text。

  • "output_text"

  • InputImage object { image_url, type, detail }

用于 EvalItem 内容数组中的图像输入块。

  • image_url: string

输入图像的 URL。

format: uri

  • type: "input_image"

输入图像类型,固定为 input_image。

  • "input_image"

  • detail: optional string

发送给模型的图像细节级别,可选 high、low 或 auto,默认为 auto。

  • ResponseInputAudio object { input_audio, type }

输入模型的音频。

  • role: "user" or "assistant" or "system" or "developer"

输入消息的角色,可选 user、assistant、system 或 developer.

  • "user"

  • "assistant"

  • "system"

  • "developer"

  • type: optional "message"

输入消息类型,固定为 message。

  • "message"

  • labels: array of string

要为评测中每个条目分配的标签。

  • model: string

评测使用的模型,须支持结构化输出。

  • name: string

评分器名称。

  • passing_labels: array of string

表示通过评测的标签,须为 labels 的子集。

  • type: "label_model"

对象类型,固定为 label_model。

  • "label_model"

  • StringCheckGrader object { input, name, operation, 2 more }

StringCheckGrader 对象,使用指定操作对输入文本与参考文本进行字符串比较。

  • input: string

输入文本,可以包含模板字符串。

  • name: string

评分器名称。

  • operation: "eq" or "ne" or "like" or "ilike"

要执行的字符串检查操作,可选 eq、ne、like 或 ilike。

  • "eq"

  • "ne"

  • "like"

  • "ilike"

  • reference: string

参考文本,可以包含模板字符串。

  • type: "string_check"

对象类型,固定为 string_check。

  • "string_check"

  • TextSimilarityGrader = TextSimilarityGrader

TextSimilarityGrader 对象,根据文本相似度指标评分。

  • pass_threshold: number

分数阈值。

  • PythonGrader = PythonGrader

PythonGrader 对象,对输入运行 Python 脚本。

  • pass_threshold: optional number

分数阈值。

  • ScoreModelGrader = ScoreModelGrader

ScoreModelGrader 对象,使用模型为输入评分。

  • pass_threshold: optional number

分数阈值。

Runs 评测运行

取消评测运行

post /evals/{eval_id}/runs/{run_id}/cancel

取消正在进行的评测运行。

路径参数

  • eval_id: string

要取消其运行的评测的 ID。

  • run_id: string

要取消的运行的 ID。

返回值

  • id: string

评测运行的唯一标识。

  • created_at: integer

评测运行创建时的 Unix 时间戳,单位为秒。

format: unixtime

  • data_source: CreateEvalJSONLRunDataSource or CreateEvalCompletionsRunDataSource or ResponsesRunDataSource { source, type, input_messages, 2 more }

本次运行的数据源信息。

  • CreateEvalJSONLRunDataSource object { source, type }

JsonlRunDataSource 对象,指定与该评测匹配的 JSONL 文件。

  • source: EvalJSONLFileContentSource { content, type } or EvalJSONLFileIDSource { id, type }

决定数据源中 item 命名空间的内容。

  • EvalJSONLFileContentSource object { content, type }

  • content: array of object { item, sample }

JSONL 文件的内容。

  • item: map[unknown]

  • sample: optional map[unknown]

  • type: "file_content" (default: "file_content")

JSONL 来源的类型,固定为 file_content。

  • "file_content"

  • EvalJSONLFileIDSource object { id, type }

  • id: string

文件标识。

  • type: "file_id" (default: "file_id")

JSONL 来源的类型,固定为 file_id。

  • "file_id"

  • type: "jsonl" (default: "jsonl")

数据源类型,固定为 jsonl。

  • "jsonl"

  • CreateEvalCompletionsRunDataSource object { source, type, input_messages, 2 more }

描述模型采样配置的 CompletionsRunDataSource 对象。

  • source: EvalJSONLFileContentSource { content, type } or EvalJSONLFileIDSource { id, type } or StoredCompletionsRunDataSource { type, created_after, created_before, 3 more }

决定本次运行数据源中 item 命名空间的内容。

  • EvalJSONLFileContentSource object { content, type }

  • content: array of object { item, sample }

JSONL 文件的内容。

  • item: map[unknown]

  • sample: optional map[unknown]

  • type: "file_content" (default: "file_content")

JSONL 来源的类型,固定为 file_content。

  • "file_content"

  • EvalJSONLFileIDSource object { id, type }

  • id: string

文件标识。

  • type: "file_id" (default: "file_id")

JSONL 来源的类型,固定为 file_id。

  • "file_id"

  • StoredCompletionsRunDataSource object { type, created_after, created_before, 3 more }

描述一组筛选条件的 StoredCompletionsRunDataSource 配置。

  • type: "stored_completions" (default: "stored_completions")

来源类型,固定为 stored_completions。

  • "stored_completions"

  • created_after: optional integer or null

可选的 Unix 时间戳,用于筛选在此时间之后创建的条目。

  • created_before: optional integer or null

可选的 Unix 时间戳,用于筛选在此时间之前创建的条目。

  • limit: optional integer or null

可选的返回条目数量上限。

  • metadata: optional Metadata or null

可附加到对象的元数据,最多包含 16 组键值对,可 以结构化方式存储对象的额外信息, 并通过 API 或控制台查询对象。

键为最多 64 个字符的字符串,值为 最多 512 个字符的字符串。

  • model: optional string or null

可选的模型筛选条件,例如 'gpt-6-astra'。

  • type: "completions" (default: "completions")

运行数据源类型,固定为 completions。

  • "completions"

  • input_messages: optional TemplateInputMessages { template, type } or ItemReferenceInputMessages { item_reference, type }

从模型采样时使用,规定传给模型的消息结构。可以引用预先构建的轨迹,例如 item.input_trajectory,也可以使用包含 item 命名空间变量引用的模板。

  • TemplateInputMessages object { template, type }

  • template: array of EasyInputMessage or EvalMessageObject { content, role, type }

构成提示词或上下文的聊天消息列表,可以包含对 item 命名空间的变量引用,例如 {{item.name}}。

  • EasyInputMessage object { content, role, phase, type }

输入模型的消息,其角色表示指令遵循的 优先级。以 developer 或 system 角色给出的指令 优先于 user 角色给出的指令。 assistant 角色的消息被视为模型在此前 交互中生成的内容。

  • content: string or ResponseInputMessageContentList

用于生成响应的文本、图像或音频输入。 也可以包含此前的助手响应。

  • TextInput = string

输入模型的文本。

  • ResponseInputMessageContentList = array of ResponseInputContent

输入模型的一个或多个条目的列表,可以包含不同 内容类型。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • text: string

输入模型的文本。

  • type: "input_text" (default: "input_text")

输入条目类型,固定为 input_text。

  • "input_text"

  • prompt_cache_breakpoint: optional object { mode, ttl }

标记可复用提示词前缀的精确结束位置。省略 ttl 时,断点继承请求中的 prompt_cache_options.ttl;该边界不会按词元块取整。

  • mode: "explicit" (default: "explicit")

断点模式,固定为 explicit。

  • "explicit"

  • ttl: optional "30m" or "12h"

此缓存断点的最短存续时间,默认为请求的 TTL。

  • "30m"

  • "12h"

  • ResponseInputImage object { detail, type, file_id, 2 more }

输入模型的图像。参阅图像输入。

  • detail: ImageDetail

发送给模型的图像细节级别,可选 high、low、auto 或 original,默认为 auto。

  • "low"

  • "high"

  • "auto"

  • "original"

  • type: "input_image" (default: "input_image")

输入条目类型,固定为 input_image。

  • "input_image"

  • file_id: optional string or null

要发送给模型的文件 ID。

  • image_url: optional string or null

要发送给模型的图像 URL,可以是完整 URL,或包含 Base64 编码图像的 data URL。

format: uri

  • prompt_cache_breakpoint: optional object { mode, ttl }

标记可复用提示词前缀的精确结束位置。省略 ttl 时,断点继承请求中的 prompt_cache_options.ttl;该边界不会按词元块取整。

  • mode: "explicit" (default: "explicit")

断点模式,固定为 explicit。

  • "explicit"

  • ttl: optional "30m" or "12h"

此缓存断点的最短存续时间,默认为请求的 TTL。

  • "30m"

  • "12h"

  • ResponseInputFile object { type, detail, file_data, 4 more }

输入模型的文件。

  • type: "input_file" (default: "input_file")

输入条目类型,固定为 input_file。

  • "input_file"

  • detail: optional "auto" or "low" or "high"

发送给模型的文件细节级别。使用 auto 由系统选择;对于 GPT-5.6 及后续模型,auto 使用高质量渲染,可能增加输入词元用量。使用 low 进行成本较低的渲染,或使用 high 以更高质量渲染文件。默认为 auto。

  • "auto"

  • "low"

  • "high"

  • file_data: optional string

要发送给模型的文件内容。

  • file_id: optional string or null

要发送给模型的文件 ID。

  • file_url: optional string

要发送给模型的文件 URL。

format: uri

  • filename: optional string

要发送给模型的文件名。

  • prompt_cache_breakpoint: optional object { mode, ttl }

标记可复用提示词前缀的精确结束位置。省略 ttl 时,断点继承请求中的 prompt_cache_options.ttl;该边界不会按词元块取整。

  • mode: "explicit" (default: "explicit")

断点模式,固定为 explicit。

  • "explicit"

  • ttl: optional "30m" or "12h"

此缓存断点的最短存续时间,默认为请求的 TTL。

  • "30m"

  • "12h"

  • role: "user" or "assistant" or "system" or "developer"

输入消息的角色,可选 user、assistant、system 或 developer.

  • "user"

  • "assistant"

  • "system"

  • "developer"

  • phase: optional "commentary" or "final_answer" or null

将 assistant 消息标记为中间说明(commentary)或最终答案(final_answer)。 对于 gpt-5.3-codex 及后续此类模型,发送后续请求时,须保留并重新发送 所有助手消息的 phase;丢弃它可能降低表现。用户消息不使用此字段。

  • "commentary"

  • "final_answer"

  • type: optional "message"

输入消息类型,固定为 message。

  • "message"

  • EvalMessageObject object { content, role, type }

输入模型的消息,其角色表示指令遵循的 优先级。以 developer 或 system 角色给出的指令 优先于 user 角色给出的指令。 assistant 角色的消息被视为模型在此前 交互中生成的内容。

  • content: string or ResponseInputText or OutputText { text, type } or 3 more

模型输入,可以包含模板字符串。支持输入文本、输出文本、输入图像和输入音频,可提供单个条目或条目数组。

  • TextInput = string

输入模型的文本。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • OutputText object { text, type }

模型输出的文本。

  • text: string

模型输出的文本内容。

  • type: "output_text"

输出文本类型,固定为 output_text。

  • "output_text"

  • InputImage object { image_url, type, detail }

用于 EvalItem 内容数组中的图像输入块。

  • image_url: string

输入图像的 URL。

format: uri

  • type: "input_image"

输入图像类型,固定为 input_image。

  • "input_image"

  • detail: optional string

发送给模型的图像细节级别,可选 high、low 或 auto,默认为 auto。

  • ResponseInputAudio object { input_audio, type }

输入模型的音频。

  • input_audio: object { data, format }

  • data: string

采用 Base64 编码的音频数据。

  • format: "mp3" or "wav"

音频数据格式,当前支持 mp3 和 wav.

  • "mp3"

  • "wav"

  • type: "input_audio"

输入条目类型,固定为 input_audio。

  • "input_audio"

  • GraderInputs = array of string or ResponseInputText or OutputText { text, type } or 2 more

输入列表,每项可以是输入文本、输出文本、输入 图像或输入音频对象。

  • TextInput = string

输入模型的文本。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • OutputText object { text, type }

模型输出的文本。

  • text: string

模型输出的文本内容。

  • type: "output_text"

输出文本类型,固定为 output_text。

  • "output_text"

  • InputImage object { image_url, type, detail }

用于 EvalItem 内容数组中的图像输入块。

  • image_url: string

输入图像的 URL。

format: uri

  • type: "input_image"

输入图像类型,固定为 input_image。

  • "input_image"

  • detail: optional string

发送给模型的图像细节级别,可选 high、low 或 auto,默认为 auto。

  • ResponseInputAudio object { input_audio, type }

输入模型的音频。

  • role: "user" or "assistant" or "system" or "developer"

输入消息的角色,可选 user、assistant、system 或 developer.

  • "user"

  • "assistant"

  • "system"

  • "developer"

  • type: optional "message"

输入消息类型,固定为 message。

  • "message"

  • type: "template"

输入消息类型,固定为 template。

  • "template"

  • ItemReferenceInputMessages object { item_reference, type }

  • item_reference: string

对 item 命名空间中变量的引用,例如 "item.input_trajectory"。

  • type: "item_reference"

输入消息类型,固定为 item_reference。

  • "item_reference"

  • model: optional string

用于生成补全内容的模型名称,例如 "o3-mini"。

  • sampling_params: optional object { max_completion_tokens, reasoning_effort, response_format, 4 more }

  • max_completion_tokens: optional integer

生成输出的最大词元数。

  • reasoning_effort: optional ReasoningEffort or null (default: "medium")

限制推理模型的推理强度。当前支持 none、minimal、low、medium、high、xhigh 和 max。 降低推理强度可能加快响应,并减少响应中用于 推理的词元数。并非所有推理模型都支持每个 取值。各模型的支持情况请参阅 推理指南 中的说明。

  • "none"

  • "minimal"

  • "low"

  • "medium"

  • "high"

  • "xhigh"

  • "max"

  • response_format: optional ResponseFormatText or ResponseFormatJSONSchema or ResponseFormatJSONObject

指定模型必须输出的格式的对象。

设为 { "type": "json_schema", "json_schema": {...} } 会启用 结构化输出,确保模型遵循你提供的 JSON 模式。更多信息请参阅结构化输出 指南。

设为 { "type": "json_object" } 会启用旧版 JSON 模式, 确保模型生成有效的 JSON。对于支持的模型,优先使用 json_schema 格式。

  • ResponseFormatText object { type }

默认响应格式,用于生成文本响应。

  • type: "text"

定义的响应格式类型,固定为 text。

  • "text"

  • ResponseFormatJSONSchema object { json_schema, type }

JSON Schema 响应格式,用于生成结构化 JSON 响应。 参阅结构化输出。

  • json_schema: object { name, description, schema, strict }

结构化输出配置选项,包含 JSON Schema。

  • name: string

响应格式的名称,须使用 a-z、A-Z、0-9,或包含 下划线和连字符,最长为 64 个字符。

  • description: optional string

响应格式的用途描述,模型据此 判断如何按该格式响应。

  • schema: optional map[unknown]

以 JSON Schema 对象描述的响应格式模式。 JSON Schema 的构建方法参阅此处。

  • strict: optional boolean or null (default: false)

生成输出时是否启用严格模式遵循。 设为 true 时,模型始终严格遵循 schema 字段中定义的模式。strict 为 true 时仅支持 JSON Schema 的子集。更多信息请参阅结构化输出 指南。

  • type: "json_schema"

定义的响应格式类型,固定为 json_schema。

  • "json_schema"

  • ResponseFormatJSONObject object { type }

JSON 对象响应格式,是生成 JSON 响应的较早方式。 对于支持的模型,建议使用 json_schema。注意: 须在系统消息或用户消息中指示模型生成 JSON, 模型才会生成 JSON。

  • type: "json_object"

定义的响应格式类型,固定为 json_object。

  • "json_object"

  • seed: optional integer (default: 42)

采样时用于初始化随机性的种子值。

  • temperature: optional number (default: 1)

较高的 temperature 会增加输出的随机性。

  • tools: optional array of ChatCompletionFunctionTool

模型可以调用的工具列表。目前工具仅支持函数。通过此项提供模型可为其生成 JSON 输入的函数列表,最多支持 128 个函数。

  • function: FunctionDefinition

  • name: string

要调用的函数名称,须使用 a-z、A-Z、0-9,或包含下划线和连字符,最长为 64 个字符。

  • description: optional string

函数功能的描述,模型据此选择何时以及如何调用该函数。

  • parameters: optional FunctionParameters

函数接受的参数,以 JSON Schema 对象描述。示例参阅指南,格式说明参阅 JSON Schema 参考。

省略 parameters 表示定义参数列表为空的函数。

  • strict: optional boolean or null (default: false)

生成函数调用时是否启用严格模式遵循。设为 true 时,模型严格遵循 parameters 字段中定义的模式。strict 为 true 时仅支持 JSON Schema 的子集。结构化输出的更多信息参阅函数调用指南。

  • type: "function"

工具类型,目前仅支持 function。

  • "function"

  • top_p: optional number (default: 1)

用于核采样的参数,是 temperature 的替代方案;1.0 表示包含所有词元。

  • ResponsesRunDataSource object { source, type, input_messages, 2 more }

描述模型采样配置的 ResponsesRunDataSource 对象。

  • source: EvalJSONLFileContentSource { content, type } or EvalJSONLFileIDSource { id, type } or EvalResponsesSource { type, created_after, created_before, 8 more }

决定本次运行数据源中 item 命名空间的内容。

  • EvalJSONLFileContentSource object { content, type }

  • content: array of object { item, sample }

JSONL 文件的内容。

  • item: map[unknown]

  • sample: optional map[unknown]

  • type: "file_content" (default: "file_content")

JSONL 来源的类型,固定为 file_content。

  • "file_content"

  • EvalJSONLFileIDSource object { id, type }

  • id: string

文件标识。

  • type: "file_id" (default: "file_id")

JSONL 来源的类型,固定为 file_id。

  • "file_id"

  • EvalResponsesSource object { type, created_after, created_before, 8 more }

描述运行数据源配置的 EvalResponsesSource 对象。

  • type: "responses"

运行数据源类型,固定为 responses。

  • "responses"

  • created_after: optional integer or null

仅包含在此时间戳之后创建的条目,含边界。此查询参数用于选择响应。

minimum: 0

  • created_before: optional integer or null

仅包含在此时间戳之前创建的条目,含边界。此查询参数用于选择响应。

minimum: 0

  • instructions_search: optional string or null

可选的字符串,用于搜索 'instructions' 字段。此查询参数用于选择响应。

  • metadata: optional unknown or null

响应的元数据筛选条件。此查询参数用于选择响应。

  • model: optional string or null

要查找其响应的模型名称。此查询参数用于选择响应。

  • reasoning_effort: optional ReasoningEffort or null (default: "medium")

限制推理模型的推理强度。当前支持 none、minimal、low、medium、high、xhigh 和 max。 降低推理强度可能加快响应,并减少响应中用于 推理的词元数。并非所有推理模型都支持每个 取值。各模型的支持情况请参阅 推理指南 中的说明。

  • temperature: optional number or null

采样温度。此查询参数用于选择响应。

  • tools: optional array of string or null

工具名称列表。此查询参数用于选择响应。

  • top_p: optional number or null

核采样参数。此查询参数用于选择响应。

  • users: optional array of string or null

用户标识列表。此查询参数用于选择响应。

  • type: "responses" (default: "responses")

运行数据源类型,固定为 responses。

  • "responses"

  • input_messages: optional InputMessagesTemplate { template, type } or InputMessagesItemReference { item_reference, type }

从模型采样时使用,规定传给模型的消息结构。可以引用预先构建的轨迹,例如 item.input_trajectory,也可以使用包含 item 命名空间变量引用的模板。

  • InputMessagesTemplate object { template, type }

  • template: array of ChatMessage { content, role } or EvalMessageObject { content, role, type }

构成提示词或上下文的聊天消息列表,可以包含对 item 命名空间的变量引用,例如 {{item.name}}。

  • ChatMessage object { content, role }

  • content: string

消息内容。

  • role: string

消息角色,例如 "system"、"assistant"、"user"。

  • EvalMessageObject object { content, role, type }

输入模型的消息,其角色表示指令遵循的 优先级。以 developer 或 system 角色给出的指令 优先于 user 角色给出的指令。 assistant 角色的消息被视为模型在此前 交互中生成的内容。

  • content: string or ResponseInputText or OutputText { text, type } or 3 more

模型输入,可以包含模板字符串。支持输入文本、输出文本、输入图像和输入音频,可提供单个条目或条目数组。

  • TextInput = string

输入模型的文本。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • OutputText object { text, type }

模型输出的文本。

  • text: string

模型输出的文本内容。

  • type: "output_text"

输出文本类型,固定为 output_text。

  • "output_text"

  • InputImage object { image_url, type, detail }

用于 EvalItem 内容数组中的图像输入块。

  • image_url: string

输入图像的 URL。

format: uri

  • type: "input_image"

输入图像类型,固定为 input_image。

  • "input_image"

  • detail: optional string

发送给模型的图像细节级别,可选 high、low 或 auto,默认为 auto。

  • ResponseInputAudio object { input_audio, type }

输入模型的音频。

  • GraderInputs = array of string or ResponseInputText or OutputText { text, type } or 2 more

输入列表,每项可以是输入文本、输出文本、输入 图像或输入音频对象。

  • role: "user" or "assistant" or "system" or "developer"

输入消息的角色,可选 user、assistant、system 或 developer.

  • "user"

  • "assistant"

  • "system"

  • "developer"

  • type: optional "message"

输入消息类型,固定为 message。

  • "message"

  • type: "template"

输入消息类型,固定为 template。

  • "template"

  • InputMessagesItemReference object { item_reference, type }

  • item_reference: string

对 item 命名空间中变量的引用,例如 "item.name"。

  • type: "item_reference"

输入消息类型,固定为 item_reference。

  • "item_reference"

  • model: optional string

用于生成补全内容的模型名称,例如 "o3-mini"。

  • sampling_params: optional object { max_completion_tokens, reasoning_effort, seed, 4 more }

  • max_completion_tokens: optional integer

生成输出的最大词元数。

  • reasoning_effort: optional ReasoningEffort or null (default: "medium")

限制推理模型的推理强度。当前支持 none、minimal、low、medium、high、xhigh 和 max。 降低推理强度可能加快响应,并减少响应中用于 推理的词元数。并非所有推理模型都支持每个 取值。各模型的支持情况请参阅 推理指南 中的说明。

  • seed: optional integer (default: 42)

采样时用于初始化随机性的种子值。

  • temperature: optional number (default: 1)

较高的 temperature 会增加输出的随机性。

  • text: optional object { format }

模型文本响应的配置选项,可以是纯 文本或结构化 JSON 数据。更多信息:

  • format: optional ResponseFormatTextConfig

指定模型必须输出的格式的对象。

配置 { "type": "json_schema" } 会启用结构化输出, 确保模型遵循你提供的 JSON Schema。更多信息参阅 结构化输出指南。

默认格式为 { "type": "text" },没有额外选项。

不建议用于 gpt-4o 及后续模型:

设为 { "type": "json_object" } 会启用旧版 JSON 模式, 确保模型生成有效的 JSON。对于支持的模型,优先使用 json_schema 格式。

  • ResponseFormatText object { type }

默认响应格式,用于生成文本响应。

  • ResponseFormatTextJSONSchemaConfig object { name, schema, type, 2 more }

JSON Schema 响应格式,用于生成结构化 JSON 响应。 参阅结构化输出。

  • name: string

响应格式的名称,须使用 a-z、A-Z、0-9,或包含 下划线和连字符,最长为 64 个字符。

  • schema: map[unknown]

以 JSON Schema 对象描述的响应格式模式。 JSON Schema 的构建方法参阅此处。

  • type: "json_schema"

定义的响应格式类型,固定为 json_schema。

  • "json_schema"

  • description: optional string

响应格式的用途描述,模型据此 判断如何按该格式响应。

  • strict: optional boolean or null (default: false)

生成输出时是否启用严格模式遵循。 设为 true 时,模型始终严格遵循 schema 字段中定义的模式。strict 为 true 时仅支持 JSON Schema 的子集。更多信息请参阅结构化输出 指南。

  • ResponseFormatJSONObject object { type }

JSON 对象响应格式,是生成 JSON 响应的较早方式。 对于支持的模型,建议使用 json_schema。注意: 须在系统消息或用户消息中指示模型生成 JSON, 模型才会生成 JSON。

  • tools: optional array of Function { name, parameters, strict, 6 more } or FileSearch { type, vector_store_ids, filters, 2 more } or Computer { type } or 13 more

模型生成响应时可以调用的工具数组。你 可以通过 tool_choice 参数指定要使用的工具。

可向模型提供以下两类工具:

  • 内置工具:由 OpenAI 提供,用于扩展 模型能力,例如网页搜索 或文件搜索。更多信息参阅 内置工具。
  • 函数调用(自定义工具):由你定义的函数, 使模型可以调用你自己的代码。更多信息参阅 函数调用。

  • Function object { name, parameters, strict, 6 more }

定义模型可以选择调用的自有代码函数。参阅函数调用。

  • name: string

要调用的函数名称。

  • parameters: map[unknown] or null

描述函数参数的 JSON Schema 对象。

  • strict: boolean or null

是否对此函数工具强制执行严格参数校验。

  • type: "function" (default: "function")

函数工具类型,固定为 function。

  • "function"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

  • "direct"

  • "programmatic"

  • async: optional boolean

  • defer_loading: optional boolean

此函数是否延迟加载并通过工具搜索加载。

  • description: optional string or null

函数描述,模型据此判断是否调用该函数。

  • output_schema: optional map[unknown] or null

描述此函数字符串输出中编码的 JSON 值的 JSON Schema 对象。

  • FileSearch object { type, vector_store_ids, filters, 2 more }

搜索已上传文件中相关内容的工具。参阅文件搜索工具。

  • type: "file_search" (default: "file_search")

文件搜索工具类型,固定为 file_search。

  • "file_search"

  • vector_store_ids: array of string

要搜索的向量存储 ID 列表。

  • filters: optional ComparisonFilter or CompoundFilter or null

要应用的筛选条件。

  • ComparisonFilter object { key, type, value }

使用指定比较运算,将某个属性键与给定值比较的筛选条件。

  • key: string

要与值比较的属性键。

  • type: "eq" or "ne" or "gt" or 5 more (default: "eq")

指定比较运算符:eq、ne、gt、gte、lt、lte、in、nin。

  • eq:等于
  • ne:不等于
  • gt:大于
  • gte:大于或等于
  • lt:小于
  • lte:小于或等于
  • in:属于
  • nin:不属于

  • "eq"

  • "ne"

  • "gt"

  • "gte"

  • "lt"

  • "lte"

  • "in"

  • "nin"

  • value: string or number or boolean or array of string or number

用于与属性键比较的值,支持字符串、数字或布尔类型。

  • string

  • number

  • boolean

  • array of string or number

  • string

  • number

  • CompoundFilter object { filters, type }

使用 and 或 or 组合多个筛选条件。

  • filters: array of ComparisonFilter or CompoundFilter

要组合的筛选条件数组,条目可以是 ComparisonFilter 或 CompoundFilter。

  • ComparisonFilter object { key, type, value }

使用指定比较运算,将某个属性键与给定值比较的筛选条件。

  • CompoundFilter object { filters, type }

使用 and 或 or 组合多个筛选条件。

  • type: "and" or "or"

运算类型:and 或 or。

  • "and"

  • "or"

  • max_num_results: optional integer

返回结果数量上限,须介于 1–50 之间,含边界。

  • ranking_options: optional object { hybrid_search, ranker, score_threshold }

搜索结果的排序选项。

  • hybrid_search: optional object { embedding_weight, text_weight }

启用混合搜索时,控制倒数排名融合如何平衡语义嵌入匹配与稀疏关键词匹配的权重。

  • embedding_weight: number

嵌入在倒数排名融合中的权重。

  • text_weight: number

文本在倒数排名融合中的权重。

  • ranker: optional "auto" or "default-2024-11-15"

文件搜索所用的排序器。

  • "auto"

  • "default-2024-11-15"

  • score_threshold: optional number

文件搜索的分数阈值,为 0–1 之间的数字。越接近 1,越倾向于只返回最相关的结果,但返回数量可能减少。

  • Computer object { type }

控制虚拟计算机的工具。参阅计算机工具。

  • type: "computer" (default: "computer")

计算机工具类型,固定为 computer。

  • "computer"

  • ComputerUsePreview object { display_height, display_width, environment, type }

控制虚拟计算机的工具。参阅计算机工具。

  • display_height: integer

计算机显示区域的高度。

  • display_width: integer

计算机显示区域的宽度。

  • environment: "windows" or "mac" or "linux" or 2 more

要控制的计算机环境类型。

  • "windows"

  • "mac"

  • "linux"

  • "ubuntu"

  • "browser"

  • type: "computer_use_preview" (default: "computer_use_preview")

计算机使用工具类型,固定为 computer_use_preview。

  • "computer_use_preview"

  • WebSearch object { type, external_web_access, filters, 2 more }

在互联网上搜索与提示词相关的信息来源。参阅 网络搜索工具时。

  • type: "web_search" or "web_search_2025_08_26" (default: "web_search")

网页搜索工具类型,可选 web_search 或 web_search_2025_08_26。

  • "web_search"

  • "web_search_2025_08_26"

  • external_web_access: optional boolean (default: true)

是否允许网页搜索实时访问互联网。省略时默认为 true。设为 false 时,网页搜索工具以离线或仅缓存模式运行,不会抓取新的外部内容。

  • filters: optional object { allowed_domains } or null

搜索的筛选条件。

  • allowed_domains: optional array of string or null (default: [])

搜索允许的域名。未提供时允许所有域名。 也允许访问所提供域名的子域名。

示例:["pubmed.ncbi.nlm.nih.gov"]

  • search_context_size: optional "low" or "medium" or "high" (default: "medium")

对搜索占用上下文窗口空间大小的总体指导,可选 low、medium 或 high,默认为 medium。

  • "low"

  • "medium"

  • "high"

  • user_location: optional object { city, country, region, 2 more } or null

用户的大致位置。省略或设为 null 时,默认为 美国。若要避免此默认值,可传入不包含位置字段的 {"type": "approximate"}。 若要本地化结果,须提供相应位置字段。

  • city: optional string or null

用户所在城市的自由文本,例如 San Francisco。

  • country: optional string or null

用户所在国家/地区的两字母 ISO 代码,例如 US。

  • region: optional string or null

用户所在地区的自由文本,例如 California。

  • timezone: optional string or null

用户所在的 IANA 时区,例如 America/Los_Angeles。

  • type: optional "approximate" (default: "approximate")

位置估算类型,固定为 approximate。

  • "approximate"

  • Mcp object { server_label, type, allowed_callers, 9 more }

通过远程模型上下文协议(MCP)服务器, 向模型提供额外工具。了解 MCP。

  • server_label: string

此 MCP 服务器的标签,用于在工具调用中标识服务器。

  • type: "mcp"

MCP 工具类型,固定为 mcp。

  • "mcp"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • allowed_tools: optional array of string or McpToolFilter { read_only, tool_names } or null

允许的工具名称列表或筛选对象。

  • McpAllowedTools = array of string

允许的工具名称组成的字符串数组。

  • McpToolFilter object { read_only, tool_names }

用于指定允许哪些工具的筛选对象。

  • read_only: optional boolean

表示工具会修改数据还是只读。如果 MCP 服务器标注了 readOnlyHint, 就会与此筛选条件匹配。

  • tool_names: optional array of string

允许的工具名称列表。

  • authorization: optional string

可用于远程 MCP 服务器的 OAuth 访问令牌,既可 配合自定义 MCP 服务器 URL,也可配合服务连接器。你的应用 须处理 OAuth 授权流程,并在此提供令牌。

  • connector_id: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 5 more

服务连接器的标识,例如 ChatGPT 中提供的连接器。须提供 server_url、connector_id 或 tunnel_id 中的一项。更多 服务连接器信息参阅此处。

对于 2026 年 9 月 1 日之后发布的模型,此字段已弃用。 使用 server_url 连接远程 MCP 服务器,或使用 tunnel_id 通过安全 MCP 隧道连接。

当前支持的 connector_id 值如下:

  • Dropbox:connector_dropbox
  • Gmail:connector_gmail
  • Google 日历:connector_googlecalendar
  • Google 云端硬盘:connector_googledrive
  • Microsoft Teams:connector_microsoftteams
  • Outlook 日历:connector_outlookcalendar
  • Outlook 邮箱:connector_outlookemail
  • SharePoint:connector_sharepoint

  • "connector_dropbox"

  • "connector_gmail"

  • "connector_googlecalendar"

  • "connector_googledrive"

  • "connector_microsoftteams"

  • "connector_outlookcalendar"

  • "connector_outlookemail"

  • "connector_sharepoint"

  • defer_loading: optional boolean

此 MCP 工具是否延迟加载并通过工具搜索发现。

  • headers: optional map[string] or null

可选的发送给 MCP 服务器的 HTTP 请求头,用于认证 或其他用途。

  • require_approval: optional McpToolApprovalFilter { always, never } or "always" or "never" or null (default: "always")

指定 MCP 服务器的哪些工具需要批准。

  • McpToolApprovalFilter object { always, never }

指定 MCP 服务器的哪些工具需要批准。可以是 always、never,或与需要批准的工具关联的 筛选对象。

  • always: optional object { read_only, tool_names }

用于指定允许哪些工具的筛选对象。

  • read_only: optional boolean

表示工具会修改数据还是只读。如果 MCP 服务器标注了 readOnlyHint, 就会与此筛选条件匹配。

  • tool_names: optional array of string

允许的工具名称列表。

  • never: optional object { read_only, tool_names }

用于指定允许哪些工具的筛选对象。

  • read_only: optional boolean

表示工具会修改数据还是只读。如果 MCP 服务器标注了 readOnlyHint, 就会与此筛选条件匹配。

  • tool_names: optional array of string

允许的工具名称列表。

  • McpToolApprovalSetting = "always" or "never"

为所有工具指定统一的批准策略,可选 always 或 never。设为 always 时,所有工具均需要批准; 设为 never 时,所有工具均不需要批准。

  • "always"

  • "never"

  • server_description: optional string

MCP 服务器的可选描述,用于提供更多上下文。

  • server_url: optional string

MCP 服务器的 URL。须提供 server_url、connector_id 或 tunnel_id 中的一项。

format: uri

  • tunnel_id: optional string

用来替代直接服务器 URL 的安全 MCP 隧道 ID。须提供 server_url、connector_id 或 tunnel_id 中的一项。

pattern: ^tunnel_[a-z0-9]{32}$

  • CodeInterpreter object { container, type, allowed_callers }

运行 Python 代码以帮助生成提示词响应的工具。

  • container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }

代码解释器容器,可以是容器 ID,也可以是 指定代码可用的已上传文件 ID 的对象,同时可提供 可选的 memory_limit 设置。

  • string

容器 ID。

  • CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }

代码解释器容器配置,可以指定运行代码时所处理的文件 ID。

  • type: "auto" (default: "auto")

固定为 auto。

  • "auto"

  • file_ids: optional array of string

可选的已上传文件列表,这些文件将提供给代码使用。

maxItems: 50

  • memory_limit: optional "1g" or "4g" or "16g" or "64g" or null

代码解释器容器的内存上限。

  • "1g"

  • "4g"

  • "16g"

  • "64g"

  • network_policy: optional ContainerNetworkPolicyDisabled or ContainerNetworkPolicyAllowlist

容器的网络访问策略。

  • ContainerNetworkPolicyDisabled object { type }

  • type: "disabled" (default: "disabled")

禁用出站网络访问,固定为 disabled。

  • "disabled"

  • ContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }

  • allowed_domains: array of string

type 为 allowlist 时允许访问的域名列表。

minItems: 1

  • type: "allowlist" (default: "allowlist")

仅允许对指定域名发起出站网络访问,固定为 allowlist。

  • "allowlist"

  • domain_secrets: optional array of ContainerNetworkPolicyDomainSecret

可选的仅用于允许访问域名的域名级密钥。

minItems: 1

  • domain: string

密钥关联的域名。

minLength: 1

  • name: string

要为该域名注入的密钥名称。

minLength: 1

  • value: string

要为该域名注入的密钥值。

minLength: 1, maxLength: 10485760

  • type: "code_interpreter"

代码解释器工具类型,固定为 code_interpreter。

  • "code_interpreter"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • ProgrammaticToolCalling object { type }

  • type: "programmatic_tool_calling" (default: "programmatic_tool_calling")

工具类型,固定为 programmatic_tool_calling。

  • "programmatic_tool_calling"

  • ImageGeneration object { type, action, background, 13 more }

使用 GPT 图像模型生成图像的工具。

  • type: "image_generation"

图像生成工具类型,固定为 image_generation。

  • "image_generation"

  • action: optional "generate" or "edit" or "auto"

生成新图像还是编辑已有图像,默认为 auto。

  • "generate"

  • "edit"

  • "auto"

  • background: optional "transparent" or "opaque" or "auto" (default: "auto")

生成图像的背景,可选 transparent、opaque, 或 auto。gpt-image-2.5-sunburst 和 gpt-image-2.5-flare,包括 对应的 2026-09-08 快照,支持 opaque 和 transparent 背景。受支持的 GPT Image 模型可以使用透明 背景。对于 gpt-image-2 和 gpt-image-2-2026-04-21,此功能处于 预览阶段。使用 transparent 时,须将输出格式设为 png 或 webp。 默认为 auto。

  • "transparent"

  • "opaque"

  • "auto"

  • complexity: optional "low" or "medium" or "high"

用于规划图像的计算投入,与渲染质量分开设置。 覆盖外层响应用于图像生成的 reasoning.effort。 省略时,继承外层受支持的推理强度,或使用 图像模型配置的默认值。 对于 SVG 输出,此项控制参考图像,而不是 SVG 生成模型的 推理。

  • "low"

  • "medium"

  • "high"

  • frame_count: optional integer (default: 9)

GIF 帧数,要求 output_format 为 gif,默认为 9。

minimum: 2, maximum: 16

  • frame_duration_ms: optional integer (default: 200)

每个 GIF 帧的时长,单位为毫秒,取整到 10 毫秒。 要求 output_format 为 gif,默认为 200。

minimum: 20, maximum: 2000

  • input_fidelity: optional "high" or "low" or null

控制模型为匹配输入图像风格和特征(尤其是面部特征)投入的程度。gpt-image-1.5 支持 high 和 low,gpt-image-1-mini 仅支持 low。使用 gpt-image-2 时应省略此参数。支持该参数的模型默认为 low。

  • "high"

  • "low"

  • input_image_mask: optional object { file_id, image_url }

可选的局部重绘蒙版,包含 image_url (可选字符串)和 file_id(可选字符串)。

  • file_id: optional string

蒙版图像的文件 ID。

  • image_url: optional string

采用 Base64 编码的蒙版图像。

  • model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-2" or 9 more

用于图像生成的模型,可选 gpt-image-1-mini、 gpt-image-1.5, gpt-image-2, gpt-image-2-2026-04-21、gpt-image-2.5-sunburst、 gpt-image-2.5-sunburst-2026-09-08、gpt-image-2.5-flare、 gpt-image-2.5-flare-2026-09-08, gpt-image-2.6-sunburst, gpt-image-2.6-flare 或 chatgpt-image-latest。默认值: gpt-image-2.6-sunburst.

gpt-image-1 已于 2026 年 10 月 23 日停用,请使用 gpt-image-2.5-sunburst 或 gpt-image-2.5-flare。

  • string

  • "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-2" or 9 more

用于图像生成的模型,可选 gpt-image-1-mini、 gpt-image-1.5, gpt-image-2, gpt-image-2-2026-04-21、gpt-image-2.5-sunburst、 gpt-image-2.5-sunburst-2026-09-08、gpt-image-2.5-flare、 gpt-image-2.5-flare-2026-09-08, gpt-image-2.6-sunburst, gpt-image-2.6-flare 或 chatgpt-image-latest。默认值: gpt-image-2.6-sunburst.

gpt-image-1 已于 2026 年 10 月 23 日停用,请使用 gpt-image-2.5-sunburst 或 gpt-image-2.5-flare。

  • "gpt-image-1"

  • "gpt-image-1-mini"

  • "gpt-image-2"

  • "gpt-image-2-2026-04-21"

  • "gpt-image-2.5-sunburst"

  • "gpt-image-2.5-sunburst-2026-09-08"

  • "gpt-image-2.5-flare"

  • "gpt-image-2.5-flare-2026-09-08"

  • "gpt-image-2.6-sunburst"

  • "gpt-image-2.6-flare"

  • "gpt-image-1.5"

  • "chatgpt-image-latest"

  • moderation: optional "auto" or "low" (default: "auto")

生成图像的审核级别,默认为 auto。

  • "auto"

  • "low"

  • output_compression: optional integer (default: 100)

输出图像的压缩级别,默认为 100。

minimum: 0, maximum: 100

  • output_format: optional "png" or "webp" or "jpeg" or 2 more (default: "png")

输出图像格式,可选 png、webp、jpeg、 gif 或 svg,默认为 png。GIF 和 SVG 输出要求模型 支持所选格式。GIF 输出不支持 部分图像流式传输,即 partial_images 大于 0, 也不支持 input_image_mask 或自定义 output_compression。 GIF 输出仍可以流式发送 Responses 生命周期事件。

  • "png"

  • "webp"

  • "jpeg"

  • "gif"

  • "svg"

  • partial_images: optional integer (default: 0)

流式模式中生成的部分图像数量,范围为 0(默认值)到 3。

minimum: 0, maximum: 3

  • quality: optional "low" or "medium" or "high" or 3 more (default: "auto")

生成图像的质量。GPT 图像模型支持 low、 medium 和 high。gpt-image-2.5-sunburst 和 gpt-image-2.5-flare, 包括对应的 2026-09-08 快照,还支持 xhigh 和 max。 默认为 auto。

  • "low"

  • "medium"

  • "high"

  • "xhigh"

  • "max"

  • "auto"

  • size: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "auto" (default: "auto")

生成图像的尺寸。gpt-image-2、gpt-image-2-2026-04-21、gpt-image-2.5-sunburst、gpt-image-2.5-sunburst-2026-09-08、gpt-image-2.5-flare 和 gpt-image-2.5-flare-2026-09-08 支持以 WIDTHxHEIGHT 字符串指定任意分辨率,例如 1536x864。宽和高均须能被 16 整除,宽高比须在 1:3 至 3:1 之间。高于 2560x1440 的分辨率属于实验功能,支持的最高分辨率为 3840x2160。尺寸还须符合模型当前的像素数与边长限制。GPT Image 模型支持标准尺寸 1024x1024、1536x1024 和 1024x1536;允许自动尺寸的模型支持 auto。

  • string

  • "1024x1024" or "1024x1536" or "1536x1024" or "auto"

生成图像的尺寸。gpt-image-2、gpt-image-2-2026-04-21、gpt-image-2.5-sunburst、gpt-image-2.5-sunburst-2026-09-08、gpt-image-2.5-flare 和 gpt-image-2.5-flare-2026-09-08 支持以 WIDTHxHEIGHT 字符串指定任意分辨率,例如 1536x864。宽和高均须能被 16 整除,宽高比须在 1:3 至 3:1 之间。高于 2560x1440 的分辨率属于实验功能,支持的最高分辨率为 3840x2160。尺寸还须符合模型当前的像素数与边长限制。GPT Image 模型支持标准尺寸 1024x1024、1536x1024 和 1024x1536;允许自动尺寸的模型支持 auto。

  • "1024x1024"

  • "1024x1536"

  • "1536x1024"

  • "auto"

  • svg: optional object { model, reasoning }

SVG 生成模型的设置,要求 output_format 为 svg。 启用 SVG 模型选择时,省略此对象会使用 外层响应模型。否则使用默认 SVG 生成模型,且 不能显式覆盖模型。

  • model: optional string

minLength: 1

  • reasoning: optional object { effort } or null

SVG 编写的推理强度。省略时,Images 和 Responses 均使用编写模型的默认值。

  • effort: optional "none" or "minimal" or "low" or 4 more

控制模型为此次请求投入的推理强度。

  • "none"

  • "minimal"

  • "low"

  • "medium"

  • "high"

  • "xhigh"

  • "max"

  • LocalShell object { type }

允许模型在本地环境执行 shell 命令的工具。

  • type: "local_shell" (default: "local_shell")

本地 shell 工具类型,固定为 local_shell。

  • "local_shell"

  • Shell object { type, allowed_callers, environment }

允许模型执行 shell 命令的工具。

  • type: "shell" (default: "shell")

shell 工具类型,固定为 shell。

  • "shell"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • environment: optional ContainerAuto or LocalEnvironment or ContainerReference or null

  • ContainerAuto object { type, file_ids, memory_limit, 2 more }

  • type: "container_auto" (default: "container_auto")

为此请求自动创建容器。

  • "container_auto"

  • file_ids: optional array of string

可选的已上传文件列表,这些文件将提供给代码使用。

maxItems: 50

  • memory_limit: optional "1g" or "4g" or "16g" or "64g" or null

容器的内存上限。

  • "1g"

  • "4g"

  • "16g"

  • "64g"

  • network_policy: optional ContainerNetworkPolicyDisabled or ContainerNetworkPolicyAllowlist

容器的网络访问策略。

  • ContainerNetworkPolicyDisabled object { type }

  • ContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }

  • skills: optional array of SkillReference or InlineSkill

可选的技能列表,通过 ID 或内联数据引用技能。

maxItems: 200

  • SkillReference object { skill_id, type, version }

  • skill_id: string

引用的技能 ID。

minLength: 1, maxLength: 64

  • type: "skill_reference" (default: "skill_reference")

引用通过 /v1/skills 接口创建的技能。

  • "skill_reference"

  • version: optional string

可选的技能版本。使用正整数或 'latest',省略时使用默认版本。

  • InlineSkill object { description, name, source, type }

  • description: string

技能描述。

  • name: string

技能名称。

  • source: InlineSkillSource

内联技能载荷。

  • data: string

采用 Base64 编码的技能 ZIP 包。

minLength: 1, maxLength: 70254592

  • media_type: "application/zip" (default: "application/zip")

内联技能载荷的媒体类型,必须为 application/zip。

  • "application/zip"

  • type: "base64" (default: "base64")

内联技能来源的类型,必须为 base64。

  • "base64"

  • type: "inline" (default: "inline")

为此请求定义内联技能。

  • "inline"

  • LocalEnvironment object { type, skills }

  • type: "local" (default: "local")

使用本地计算机环境。

  • "local"

  • skills: optional array of LocalSkill

可选的技能列表。

maxItems: 200

  • description: string

技能描述。

  • name: string

技能名称。

  • path: string

包含该技能的目录路径。

  • ContainerReference object { container_id, type }

  • container_id: string

引用的容器 ID。

  • type: "container_reference" (default: "container_reference")

引用通过 /v1/containers 接口创建的容器。

  • "container_reference"

  • Custom object { name, type, allowed_callers, 4 more }

使用指定格式处理输入的自定义工具。参阅自定义工具。

  • name: string

自定义工具的名称,用于在工具调用中标识它。

  • type: "custom" (default: "custom")

自定义工具类型,固定为 custom。

  • "custom"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • async: optional boolean

工具响应是否可以异步返回,而非在下一次创建响应时立即返回。

  • defer_loading: optional boolean

此工具是否应延迟加载并通过工具搜索发现。

  • description: optional string

自定义工具的可选描述,用于提供更多上下文。

  • format: optional CustomToolInputFormat

自定义工具的输入格式,默认为无约束文本。

  • Text object { type }

无约束的自由文本。

  • type: "text" (default: "text")

无约束文本格式,固定为 text。

  • "text"

  • Grammar object { definition, syntax, type }

用户定义的语法。

  • definition: string

语法定义。

  • syntax: "lark" or "regex"

语法定义的语法类型,可选 lark 或 regex。

  • "lark"

  • "regex"

  • type: "grammar" (default: "grammar")

语法格式,固定为 grammar。

  • "grammar"

  • Namespace object { description, name, tools, type }

将函数工具或自定义工具归入共享命名空间。

  • description: string

展示给模型的命名空间描述。

  • name: string

工具调用使用的命名空间名称,例如 crm。

minLength: 1

  • tools: array of Function { name, type, allowed_callers, 6 more } or Custom { name, type, allowed_callers, 4 more }

此命名空间内可用的函数工具或自定义工具。

minItems: 1

  • Function object { name, type, allowed_callers, 6 more }

  • name: string

pattern: ^[a-zA-Z0-9_-]+$, minLength: 1, maxLength: 128

  • type: "function" (default: "function")

  • "function"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • async: optional boolean

工具响应是否可以异步返回,而非在下一次创建响应时立即返回。

  • defer_loading: optional boolean

此函数是否应延迟加载并通过工具搜索发现。

  • description: optional string or null

  • output_schema: optional map[unknown] or null

描述此函数工具字符串输出中编码的 JSON 值的 JSON Schema,不用于描述内容数组输出。

  • parameters: optional unknown or null

  • strict: optional boolean or null

是否强制执行严格参数校验。省略时,模式兼容的情况下 Responses 会尝试严格校验,否则退回非严格校验。

  • Custom object { name, type, allowed_callers, 4 more }

使用指定格式处理输入的自定义工具。参阅自定义工具。

  • name: string

自定义工具的名称,用于在工具调用中标识它。

  • type: "custom" (default: "custom")

自定义工具类型,固定为 custom。

  • "custom"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • async: optional boolean

工具响应是否可以异步返回,而非在下一次创建响应时立即返回。

  • defer_loading: optional boolean

此工具是否应延迟加载并通过工具搜索发现。

  • description: optional string

自定义工具的可选描述,用于提供更多上下文。

  • format: optional CustomToolInputFormat

自定义工具的输入格式,默认为无约束文本。

  • type: "namespace" (default: "namespace")

工具类型,固定为 namespace。

  • "namespace"

  • ToolSearch object { type, description, execution, parameters }

用于延迟加载工具的托管工具搜索或自带工具(BYOT)搜索配置。

  • type: "tool_search" (default: "tool_search")

工具类型,固定为 tool_search。

  • "tool_search"

  • description: optional string or null

客户端执行的工具搜索工具展示给模型的描述。

  • execution: optional "server" or "client"

工具搜索由服务端还是客户端执行。

  • "server"

  • "client"

  • parameters: optional unknown or null

客户端执行的工具搜索工具的参数模式。

  • WebSearchPreview object { type, search_content_types, search_context_size, user_location }

搜索网页以获取可用于响应的相关结果的工具。参阅网页搜索工具。

  • type: "web_search_preview" or "web_search_preview_2025_03_11" (default: "web_search_preview")

网页搜索工具类型,可选 web_search_preview 或 web_search_preview_2025_03_11。

  • "web_search_preview"

  • "web_search_preview_2025_03_11"

  • search_content_types: optional array of "text" or "image"

  • "text"

  • "image"

  • search_context_size: optional "low" or "medium" or "high"

对搜索占用上下文窗口空间大小的总体指导,可选 low、medium 或 high,默认为 medium。

  • "low"

  • "medium"

  • "high"

  • user_location: optional object { type, city, country, 2 more } or null

用户的大致位置。省略或设为 null 时默认为美国。若要避免此默认值,可传入不包含位置字段的 {"type": "approximate"}。若要本地化结果,须提供相应位置字段。

  • type: "approximate" (default: "approximate")

位置估算类型,固定为 approximate。

  • "approximate"

  • city: optional string or null

用户所在城市的自由文本,例如 San Francisco。

  • country: optional string or null

用户所在国家/地区的两字母 ISO 代码,例如 US。

  • region: optional string or null

用户所在地区的自由文本,例如 California。

  • timezone: optional string or null

用户所在的 IANA 时区,例如 America/Los_Angeles。

  • ApplyPatch object { type, allowed_callers }

允许助手使用统一差异格式创建、删除或更新文件。

  • type: "apply_patch" (default: "apply_patch")

工具类型,固定为 apply_patch。

  • "apply_patch"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • top_p: optional number (default: 1)

用于核采样的参数,是 temperature 的替代方案;1.0 表示包含所有词元。

  • error: EvalAPIError or null

表示 Eval API 错误响应的对象。

  • code: string

错误代码。

  • message: string

错误消息。

  • eval_id: string

关联评测的标识。

  • metadata: Metadata or null

可附加到对象的元数据,最多包含 16 组键值对,可 以结构化方式存储对象的额外信息, 并通过 API 或控制台查询对象。

键为最多 64 个字符的字符串,值为 最多 512 个字符的字符串。

  • model: string or null

被评测的模型,如适用。

  • name: string or null

评测运行名称。

  • object: "eval.run" (default: "eval.run")

对象类型,固定为 "eval.run"。

  • "eval.run"

  • per_model_usage: array of object { cached_tokens, completion_tokens, invocation_count, 3 more } or null

评测运行期间各模型的用量统计。

  • cached_tokens: integer

从缓存读取的词元数。

  • completion_tokens: integer

生成的补全词元数。

  • invocation_count: integer

调用次数。

  • model_name: string

模型名称。

  • prompt_tokens: integer

使用的提示词词元数。

  • total_tokens: integer

使用的总词元数。

  • per_testing_criteria_results: array of object { failed, passed, testing_criteria } or null

评测运行中各测试标准的结果。

  • failed: integer

未通过此标准的测试数量。

  • passed: integer

通过此标准的测试数量。

  • testing_criteria: string

测试标准的描述。

  • report_url: string

在控制台界面中呈现评测运行报告的 URL。

format: uri

  • result_counts: object { errored, failed, passed, total }

汇总评测运行结果的计数器。

  • errored: integer

因错误而失败的输出条目数量。

  • failed: integer

未通过评测的输出条目数量。

  • passed: integer

通过评测的输出条目数量。

  • total: integer

已执行的输出条目总数。

  • status: string

评测运行状态。

示例

## 设置 OPENAI_API_KEY,并将评测 ID 和运行 ID 替换为实际值。
curl https://api.openai.com/v1/evals/$EVAL_ID/runs/$RUN_ID/cancel \
    -X POST \
    -H "Authorization: Bearer $OPENAI_API_KEY"

200 响应示例

{
  "id": "id",
  "created_at": 0,
  "data_source": {
    "source": {
      "content": [
        {
          "item": {
            "foo": "bar"
          },
          "sample": {
            "foo": "bar"
          }
        }
      ],
      "type": "file_content"
    },
    "type": "jsonl"
  },
  "error": {
    "code": "code",
    "message": "message"
  },
  "eval_id": "eval_id",
  "metadata": {
    "foo": "string"
  },
  "model": "model",
  "name": "name",
  "object": "eval.run",
  "per_model_usage": [
    {
      "cached_tokens": 0,
      "completion_tokens": 0,
      "invocation_count": 0,
      "model_name": "model_name",
      "prompt_tokens": 0,
      "total_tokens": 0
    }
  ],
  "per_testing_criteria_results": [
    {
      "failed": 0,
      "passed": 0,
      "testing_criteria": "testing_criteria"
    }
  ],
  "report_url": "https://example.com",
  "result_counts": {
    "errored": 0,
    "failed": 0,
    "passed": 0,
    "total": 0
  },
  "status": "status"
}

示例

## 设置 OPENAI_API_KEY,并将评测 ID 和运行 ID 替换为实际值。
curl https://api.openai.com/v1/evals/eval_67abd54d9b0081909a86353f6fb9317a/runs/evalrun_67abd54d60ec8190832b46859da808f7/cancel \
  -X POST \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json"

响应示例

{
  "object": "eval.run",
  "id": "evalrun_67abd54d60ec8190832b46859da808f7",
  "eval_id": "eval_67abd54d9b0081909a86353f6fb9317a",
  "report_url": "https://platform.openai.com/evaluations/eval_67abd54d9b0081909a86353f6fb9317a?run_id=evalrun_67abd54d60ec8190832b46859da808f7",
  "status": "canceled",
  "model": "gpt-6-astra",
  "name": "gpt-6-astra",
  "created_at": 1743092069,
  "result_counts": {
    "total": 0,
    "errored": 0,
    "failed": 0,
    "passed": 0
  },
  "per_model_usage": null,
  "per_testing_criteria_results": null,
  "data_source": {
    "type": "completions",
    "source": {
      "type": "file_content",
      "content": [
        {
          "item": {
            "input": "科技公司推出先进的人工智能平台",
            "ground_truth": "Technology"
          }
        },
        {
          "item": {
            "input": "通胀担忧之际,央行提高利率",
            "ground_truth": "Markets"
          }
        },
        {
          "item": {
            "input": "国际峰会讨论应对气候变化的策略",
            "ground_truth": "World"
          }
        },
        {
          "item": {
            "input": "大型零售商公布创纪录的假日销售额",
            "ground_truth": "Business"
          }
        },
        {
          "item": {
            "input": "国家队晋级世界锦标赛决赛",
            "ground_truth": "Sports"
          }
        },
        {
          "item": {
            "input": "利好经济数据公布后股市上涨",
            "ground_truth": "Markets"
          }
        },
        {
          "item": {
            "input": "全球制造商宣布与竞争对手合并",
            "ground_truth": "Business"
          }
        },
        {
          "item": {
            "input": "可再生能源技术取得突破",
            "ground_truth": "Technology"
          }
        },
        {
          "item": {
            "input": "各国领导人签署历史性气候协议",
            "ground_truth": "World"
          }
        },
        {
          "item": {
            "input": "职业运动员在锦标赛中刷新纪录",
            "ground_truth": "Sports"
          }
        },
        {
          "item": {
            "input": "金融机构适应新的监管要求",
            "ground_truth": "Business"
          }
        },
        {
          "item": {
            "input": "科技大会展示人工智能领域的进展",
            "ground_truth": "Technology"
          }
        },
        {
          "item": {
            "input": "全球市场对油价波动作出反应",
            "ground_truth": "Markets"
          }
        },
        {
          "item": {
            "input": "新条约加强国际合作",
            "ground_truth": "World"
          }
        },
        {
          "item": {
            "input": "体育联盟公布新赛季调整后的赛程",
            "ground_truth": "Sports"
          }
        }
      ]
    },
    "input_messages": {
      "type": "template",
      "template": [
        {
          "type": "message",
          "role": "developer",
          "content": {
            "type": "input_text",
            "text": "将给定新闻标题归入以下主题之一:Technology(科技)、Markets(市场)、World(国际)、Business(商业)或 Sports(体育)。\n\n# 步骤\n\n1. 分析新闻标题的内容,理解其主要关注点。\n2. 提取主题,找出关键线索或关键词。\n3. 根据这些线索,从 Technology、Markets、World、Business、Sports 五个选项中选择最合适的类别。\n4. 每个标题只能选择一个类别。\n\n# 输出格式\n\n仅返回所选类别的一个英文单词,例如:\"Technology\"、\"Markets\"、\"World\"、\"Business\" 或 \"Sports\"。\n\n# 示例\n\n**输入**:\"苹果发布搭载先进 AI 功能的新款 iPhone\"  \n**输出**:\"Technology\"\n\n**输入**:\"投资者等待央行决议,全球股市涨跌互现\"  \n**输出**:\"Markets\"\n\n**输入**:\"乌克兰战争:谈判进展最新消息\"  \n**输出**:\"World\"\n\n**输入**:\"微软洽谈以 20 亿美元收购游戏公司\"  \n**输出**:\"Business\"\n\n**输入**:\"曼联赢得英超足球比赛\"  \n**输出**:\"Sports\" \n\n# 注意\n\n- 如果标题似乎符合多个类别,选择最主要的主题。\n- “股票”“公司收购”“比赛”等关键词或短语,以及科技品牌,都可以作为分类线索。\n"
          }
        },
        {
          "type": "message",
          "role": "user",
          "content": {
            "type": "input_text",
            "text": "{{item.input}}"
          }
        }
      ]
    },
    "model": "gpt-6-astra",
    "sampling_params": {
      "max_completions_tokens": 2048
    }
  },
  "error": null,
  "metadata": {}
}

创建评测运行

post /evals/{eval_id}/runs

为指定评测启动新运行,指定数据源以及测试所用的模型配置。数据源将根据评测配置中指定的模式进行校验。

路径参数

  • eval_id: string

要创建运行的评测的 ID。

请求体参数

内容类型:application/json

  • data_source: CreateEvalJSONLRunDataSource or CreateEvalCompletionsRunDataSource or ResponsesRunDataSource { source, type, input_messages, 2 more }

本次运行的数据源详情。

  • CreateEvalJSONLRunDataSource object { source, type }

JsonlRunDataSource 对象,指定与该评测匹配的 JSONL 文件。

  • source: EvalJSONLFileContentSource { content, type } or EvalJSONLFileIDSource { id, type }

决定数据源中 item 命名空间的内容。

  • EvalJSONLFileContentSource object { content, type }

  • content: array of object { item, sample }

JSONL 文件的内容。

  • item: map[unknown]

  • sample: optional map[unknown]

  • type: "file_content" (default: "file_content")

JSONL 来源的类型,固定为 file_content。

  • "file_content"

  • EvalJSONLFileIDSource object { id, type }

  • id: string

文件标识。

  • type: "file_id" (default: "file_id")

JSONL 来源的类型,固定为 file_id。

  • "file_id"

  • type: "jsonl" (default: "jsonl")

数据源类型,固定为 jsonl。

  • "jsonl"

  • CreateEvalCompletionsRunDataSource object { source, type, input_messages, 2 more }

描述模型采样配置的 CompletionsRunDataSource 对象。

  • source: EvalJSONLFileContentSource { content, type } or EvalJSONLFileIDSource { id, type } or StoredCompletionsRunDataSource { type, created_after, created_before, 3 more }

决定本次运行数据源中 item 命名空间的内容。

  • EvalJSONLFileContentSource object { content, type }

  • content: array of object { item, sample }

JSONL 文件的内容。

  • item: map[unknown]

  • sample: optional map[unknown]

  • type: "file_content" (default: "file_content")

JSONL 来源的类型,固定为 file_content。

  • "file_content"

  • EvalJSONLFileIDSource object { id, type }

  • id: string

文件标识。

  • type: "file_id" (default: "file_id")

JSONL 来源的类型,固定为 file_id。

  • "file_id"

  • StoredCompletionsRunDataSource object { type, created_after, created_before, 3 more }

描述一组筛选条件的 StoredCompletionsRunDataSource 配置。

  • type: "stored_completions" (default: "stored_completions")

来源类型,固定为 stored_completions。

  • "stored_completions"

  • created_after: optional integer or null

可选的 Unix 时间戳,用于筛选在此时间之后创建的条目。

  • created_before: optional integer or null

可选的 Unix 时间戳,用于筛选在此时间之前创建的条目。

  • limit: optional integer or null

可选的返回条目数量上限。

  • metadata: optional Metadata or null

可附加到对象的元数据,最多包含 16 组键值对,可 以结构化方式存储对象的额外信息, 并通过 API 或控制台查询对象。

键为最多 64 个字符的字符串,值为 最多 512 个字符的字符串。

  • model: optional string or null

可选的模型筛选条件,例如 'gpt-6-astra'。

  • type: "completions" (default: "completions")

运行数据源类型,固定为 completions。

  • "completions"

  • input_messages: optional TemplateInputMessages { template, type } or ItemReferenceInputMessages { item_reference, type }

从模型采样时使用,规定传给模型的消息结构。可以引用预先构建的轨迹,例如 item.input_trajectory,也可以使用包含 item 命名空间变量引用的模板。

  • TemplateInputMessages object { template, type }

  • template: array of EasyInputMessage or EvalMessageObject { content, role, type }

构成提示词或上下文的聊天消息列表,可以包含对 item 命名空间的变量引用,例如 {{item.name}}。

  • EasyInputMessage object { content, role, phase, type }

输入模型的消息,其角色表示指令遵循的 优先级。以 developer 或 system 角色给出的指令 优先于 user 角色给出的指令。 assistant 角色的消息被视为模型在此前 交互中生成的内容。

  • content: string or ResponseInputMessageContentList

用于生成响应的文本、图像或音频输入。 也可以包含此前的助手响应。

  • TextInput = string

输入模型的文本。

  • ResponseInputMessageContentList = array of ResponseInputContent

输入模型的一个或多个条目的列表,可以包含不同 内容类型。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • text: string

输入模型的文本。

  • type: "input_text" (default: "input_text")

输入条目类型,固定为 input_text。

  • "input_text"

  • prompt_cache_breakpoint: optional object { mode, ttl }

标记可复用提示词前缀的精确结束位置。省略 ttl 时,断点继承请求中的 prompt_cache_options.ttl;该边界不会按词元块取整。

  • mode: "explicit" (default: "explicit")

断点模式,固定为 explicit。

  • "explicit"

  • ttl: optional "30m" or "12h"

此缓存断点的最短存续时间,默认为请求的 TTL。

  • "30m"

  • "12h"

  • ResponseInputImage object { detail, type, file_id, 2 more }

输入模型的图像。参阅图像输入。

  • detail: ImageDetail

发送给模型的图像细节级别,可选 high、low、auto 或 original,默认为 auto。

  • "low"

  • "high"

  • "auto"

  • "original"

  • type: "input_image" (default: "input_image")

输入条目类型,固定为 input_image。

  • "input_image"

  • file_id: optional string or null

要发送给模型的文件 ID。

  • image_url: optional string or null

要发送给模型的图像 URL,可以是完整 URL,或包含 Base64 编码图像的 data URL。

format: uri

  • prompt_cache_breakpoint: optional object { mode, ttl }

标记可复用提示词前缀的精确结束位置。省略 ttl 时,断点继承请求中的 prompt_cache_options.ttl;该边界不会按词元块取整。

  • mode: "explicit" (default: "explicit")

断点模式,固定为 explicit。

  • "explicit"

  • ttl: optional "30m" or "12h"

此缓存断点的最短存续时间,默认为请求的 TTL。

  • "30m"

  • "12h"

  • ResponseInputFile object { type, detail, file_data, 4 more }

输入模型的文件。

  • type: "input_file" (default: "input_file")

输入条目类型,固定为 input_file。

  • "input_file"

  • detail: optional "auto" or "low" or "high"

发送给模型的文件细节级别。使用 auto 由系统选择;对于 GPT-5.6 及后续模型,auto 使用高质量渲染,可能增加输入词元用量。使用 low 进行成本较低的渲染,或使用 high 以更高质量渲染文件。默认为 auto。

  • "auto"

  • "low"

  • "high"

  • file_data: optional string

要发送给模型的文件内容。

  • file_id: optional string or null

要发送给模型的文件 ID。

  • file_url: optional string

要发送给模型的文件 URL。

format: uri

  • filename: optional string

要发送给模型的文件名。

  • prompt_cache_breakpoint: optional object { mode, ttl }

标记可复用提示词前缀的精确结束位置。省略 ttl 时,断点继承请求中的 prompt_cache_options.ttl;该边界不会按词元块取整。

  • mode: "explicit" (default: "explicit")

断点模式,固定为 explicit。

  • "explicit"

  • ttl: optional "30m" or "12h"

此缓存断点的最短存续时间,默认为请求的 TTL。

  • "30m"

  • "12h"

  • role: "user" or "assistant" or "system" or "developer"

输入消息的角色,可选 user、assistant、system 或 developer.

  • "user"

  • "assistant"

  • "system"

  • "developer"

  • phase: optional "commentary" or "final_answer" or null

将 assistant 消息标记为中间说明(commentary)或最终答案(final_answer)。 对于 gpt-5.3-codex 及后续此类模型,发送后续请求时,须保留并重新发送 所有助手消息的 phase;丢弃它可能降低表现。用户消息不使用此字段。

  • "commentary"

  • "final_answer"

  • type: optional "message"

输入消息类型,固定为 message。

  • "message"

  • EvalMessageObject object { content, role, type }

输入模型的消息,其角色表示指令遵循的 优先级。以 developer 或 system 角色给出的指令 优先于 user 角色给出的指令。 assistant 角色的消息被视为模型在此前 交互中生成的内容。

  • content: string or ResponseInputText or OutputText { text, type } or 3 more

模型输入,可以包含模板字符串。支持输入文本、输出文本、输入图像和输入音频,可提供单个条目或条目数组。

  • TextInput = string

输入模型的文本。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • OutputText object { text, type }

模型输出的文本。

  • text: string

模型输出的文本内容。

  • type: "output_text"

输出文本类型,固定为 output_text。

  • "output_text"

  • InputImage object { image_url, type, detail }

用于 EvalItem 内容数组中的图像输入块。

  • image_url: string

输入图像的 URL。

format: uri

  • type: "input_image"

输入图像类型,固定为 input_image。

  • "input_image"

  • detail: optional string

发送给模型的图像细节级别,可选 high、low 或 auto,默认为 auto。

  • ResponseInputAudio object { input_audio, type }

输入模型的音频。

  • input_audio: object { data, format }

  • data: string

采用 Base64 编码的音频数据。

  • format: "mp3" or "wav"

音频数据格式,当前支持 mp3 和 wav.

  • "mp3"

  • "wav"

  • type: "input_audio"

输入条目类型,固定为 input_audio。

  • "input_audio"

  • GraderInputs = array of string or ResponseInputText or OutputText { text, type } or 2 more

输入列表,每项可以是输入文本、输出文本、输入 图像或输入音频对象。

  • TextInput = string

输入模型的文本。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • OutputText object { text, type }

模型输出的文本。

  • text: string

模型输出的文本内容。

  • type: "output_text"

输出文本类型,固定为 output_text。

  • "output_text"

  • InputImage object { image_url, type, detail }

用于 EvalItem 内容数组中的图像输入块。

  • image_url: string

输入图像的 URL。

format: uri

  • type: "input_image"

输入图像类型,固定为 input_image。

  • "input_image"

  • detail: optional string

发送给模型的图像细节级别,可选 high、low 或 auto,默认为 auto。

  • ResponseInputAudio object { input_audio, type }

输入模型的音频。

  • role: "user" or "assistant" or "system" or "developer"

输入消息的角色,可选 user、assistant、system 或 developer.

  • "user"

  • "assistant"

  • "system"

  • "developer"

  • type: optional "message"

输入消息类型,固定为 message。

  • "message"

  • type: "template"

输入消息类型,固定为 template。

  • "template"

  • ItemReferenceInputMessages object { item_reference, type }

  • item_reference: string

对 item 命名空间中变量的引用,例如 "item.input_trajectory"。

  • type: "item_reference"

输入消息类型,固定为 item_reference。

  • "item_reference"

  • model: optional string

用于生成补全内容的模型名称,例如 "o3-mini"。

  • sampling_params: optional object { max_completion_tokens, reasoning_effort, response_format, 4 more }

  • max_completion_tokens: optional integer

生成输出的最大词元数。

  • reasoning_effort: optional ReasoningEffort or null (default: "medium")

限制推理模型的推理强度。当前支持 none、minimal、low、medium、high、xhigh 和 max。 降低推理强度可能加快响应,并减少响应中用于 推理的词元数。并非所有推理模型都支持每个 取值。各模型的支持情况请参阅 推理指南 中的说明。

  • "none"

  • "minimal"

  • "low"

  • "medium"

  • "high"

  • "xhigh"

  • "max"

  • response_format: optional ResponseFormatText or ResponseFormatJSONSchema or ResponseFormatJSONObject

指定模型必须输出的格式的对象。

设为 { "type": "json_schema", "json_schema": {...} } 会启用 结构化输出,确保模型遵循你提供的 JSON 模式。更多信息请参阅结构化输出 指南。

设为 { "type": "json_object" } 会启用旧版 JSON 模式, 确保模型生成有效的 JSON。对于支持的模型,优先使用 json_schema 格式。

  • ResponseFormatText object { type }

默认响应格式,用于生成文本响应。

  • type: "text"

定义的响应格式类型,固定为 text。

  • "text"

  • ResponseFormatJSONSchema object { json_schema, type }

JSON Schema 响应格式,用于生成结构化 JSON 响应。 参阅结构化输出。

  • json_schema: object { name, description, schema, strict }

结构化输出配置选项,包含 JSON Schema。

  • name: string

响应格式的名称,须使用 a-z、A-Z、0-9,或包含 下划线和连字符,最长为 64 个字符。

  • description: optional string

响应格式的用途描述,模型据此 判断如何按该格式响应。

  • schema: optional map[unknown]

以 JSON Schema 对象描述的响应格式模式。 JSON Schema 的构建方法参阅此处。

  • strict: optional boolean or null (default: false)

生成输出时是否启用严格模式遵循。 设为 true 时,模型始终严格遵循 schema 字段中定义的模式。strict 为 true 时仅支持 JSON Schema 的子集。更多信息请参阅结构化输出 指南。

  • type: "json_schema"

定义的响应格式类型,固定为 json_schema。

  • "json_schema"

  • ResponseFormatJSONObject object { type }

JSON 对象响应格式,是生成 JSON 响应的较早方式。 对于支持的模型,建议使用 json_schema。注意: 须在系统消息或用户消息中指示模型生成 JSON, 模型才会生成 JSON。

  • type: "json_object"

定义的响应格式类型,固定为 json_object。

  • "json_object"

  • seed: optional integer (default: 42)

采样时用于初始化随机性的种子值。

  • temperature: optional number (default: 1)

较高的 temperature 会增加输出的随机性。

  • tools: optional array of ChatCompletionFunctionTool

模型可以调用的工具列表。目前工具仅支持函数。通过此项提供模型可为其生成 JSON 输入的函数列表,最多支持 128 个函数。

  • function: FunctionDefinition

  • name: string

要调用的函数名称,须使用 a-z、A-Z、0-9,或包含下划线和连字符,最长为 64 个字符。

  • description: optional string

函数功能的描述,模型据此选择何时以及如何调用该函数。

  • parameters: optional FunctionParameters

函数接受的参数,以 JSON Schema 对象描述。示例参阅指南,格式说明参阅 JSON Schema 参考。

省略 parameters 表示定义参数列表为空的函数。

  • strict: optional boolean or null (default: false)

生成函数调用时是否启用严格模式遵循。设为 true 时,模型严格遵循 parameters 字段中定义的模式。strict 为 true 时仅支持 JSON Schema 的子集。结构化输出的更多信息参阅函数调用指南。

  • type: "function"

工具类型,目前仅支持 function。

  • "function"

  • top_p: optional number (default: 1)

用于核采样的参数,是 temperature 的替代方案;1.0 表示包含所有词元。

  • ResponsesRunDataSource object { source, type, input_messages, 2 more }

描述模型采样配置的 ResponsesRunDataSource 对象。

  • source: EvalJSONLFileContentSource { content, type } or EvalJSONLFileIDSource { id, type } or EvalResponsesSource { type, created_after, created_before, 8 more }

决定本次运行数据源中 item 命名空间的内容。

  • EvalJSONLFileContentSource object { content, type }

  • content: array of object { item, sample }

JSONL 文件的内容。

  • item: map[unknown]

  • sample: optional map[unknown]

  • type: "file_content" (default: "file_content")

JSONL 来源的类型,固定为 file_content。

  • "file_content"

  • EvalJSONLFileIDSource object { id, type }

  • id: string

文件标识。

  • type: "file_id" (default: "file_id")

JSONL 来源的类型,固定为 file_id。

  • "file_id"

  • EvalResponsesSource object { type, created_after, created_before, 8 more }

描述运行数据源配置的 EvalResponsesSource 对象。

  • type: "responses"

运行数据源类型,固定为 responses。

  • "responses"

  • created_after: optional integer or null

仅包含在此时间戳之后创建的条目,含边界。此查询参数用于选择响应。

minimum: 0

  • created_before: optional integer or null

仅包含在此时间戳之前创建的条目,含边界。此查询参数用于选择响应。

minimum: 0

  • instructions_search: optional string or null

可选的字符串,用于搜索 'instructions' 字段。此查询参数用于选择响应。

  • metadata: optional unknown or null

响应的元数据筛选条件。此查询参数用于选择响应。

  • model: optional string or null

要查找其响应的模型名称。此查询参数用于选择响应。

  • reasoning_effort: optional ReasoningEffort or null (default: "medium")

限制推理模型的推理强度。当前支持 none、minimal、low、medium、high、xhigh 和 max。 降低推理强度可能加快响应,并减少响应中用于 推理的词元数。并非所有推理模型都支持每个 取值。各模型的支持情况请参阅 推理指南 中的说明。

  • temperature: optional number or null

采样温度。此查询参数用于选择响应。

  • tools: optional array of string or null

工具名称列表。此查询参数用于选择响应。

  • top_p: optional number or null

核采样参数。此查询参数用于选择响应。

  • users: optional array of string or null

用户标识列表。此查询参数用于选择响应。

  • type: "responses" (default: "responses")

运行数据源类型,固定为 responses。

  • "responses"

  • input_messages: optional InputMessagesTemplate { template, type } or InputMessagesItemReference { item_reference, type }

从模型采样时使用,规定传给模型的消息结构。可以引用预先构建的轨迹,例如 item.input_trajectory,也可以使用包含 item 命名空间变量引用的模板。

  • InputMessagesTemplate object { template, type }

  • template: array of ChatMessage { content, role } or EvalMessageObject { content, role, type }

构成提示词或上下文的聊天消息列表,可以包含对 item 命名空间的变量引用,例如 {{item.name}}。

  • ChatMessage object { content, role }

  • content: string

消息内容。

  • role: string

消息角色,例如 "system"、"assistant"、"user"。

  • EvalMessageObject object { content, role, type }

输入模型的消息,其角色表示指令遵循的 优先级。以 developer 或 system 角色给出的指令 优先于 user 角色给出的指令。 assistant 角色的消息被视为模型在此前 交互中生成的内容。

  • content: string or ResponseInputText or OutputText { text, type } or 3 more

模型输入,可以包含模板字符串。支持输入文本、输出文本、输入图像和输入音频,可提供单个条目或条目数组。

  • TextInput = string

输入模型的文本。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • OutputText object { text, type }

模型输出的文本。

  • text: string

模型输出的文本内容。

  • type: "output_text"

输出文本类型,固定为 output_text。

  • "output_text"

  • InputImage object { image_url, type, detail }

用于 EvalItem 内容数组中的图像输入块。

  • image_url: string

输入图像的 URL。

format: uri

  • type: "input_image"

输入图像类型,固定为 input_image。

  • "input_image"

  • detail: optional string

发送给模型的图像细节级别,可选 high、low 或 auto,默认为 auto。

  • ResponseInputAudio object { input_audio, type }

输入模型的音频。

  • GraderInputs = array of string or ResponseInputText or OutputText { text, type } or 2 more

输入列表,每项可以是输入文本、输出文本、输入 图像或输入音频对象。

  • role: "user" or "assistant" or "system" or "developer"

输入消息的角色,可选 user、assistant、system 或 developer.

  • "user"

  • "assistant"

  • "system"

  • "developer"

  • type: optional "message"

输入消息类型,固定为 message。

  • "message"

  • type: "template"

输入消息类型,固定为 template。

  • "template"

  • InputMessagesItemReference object { item_reference, type }

  • item_reference: string

对 item 命名空间中变量的引用,例如 "item.name"。

  • type: "item_reference"

输入消息类型,固定为 item_reference。

  • "item_reference"

  • model: optional string

用于生成补全内容的模型名称,例如 "o3-mini"。

  • sampling_params: optional object { max_completion_tokens, reasoning_effort, seed, 4 more }

  • max_completion_tokens: optional integer

生成输出的最大词元数。

  • reasoning_effort: optional ReasoningEffort or null (default: "medium")

限制推理模型的推理强度。当前支持 none、minimal、low、medium、high、xhigh 和 max。 降低推理强度可能加快响应,并减少响应中用于 推理的词元数。并非所有推理模型都支持每个 取值。各模型的支持情况请参阅 推理指南 中的说明。

  • seed: optional integer (default: 42)

采样时用于初始化随机性的种子值。

  • temperature: optional number (default: 1)

较高的 temperature 会增加输出的随机性。

  • text: optional object { format }

模型文本响应的配置选项,可以是纯 文本或结构化 JSON 数据。更多信息:

  • format: optional ResponseFormatTextConfig

指定模型必须输出的格式的对象。

配置 { "type": "json_schema" } 会启用结构化输出, 确保模型遵循你提供的 JSON Schema。更多信息参阅 结构化输出指南。

默认格式为 { "type": "text" },没有额外选项。

不建议用于 gpt-4o 及后续模型:

设为 { "type": "json_object" } 会启用旧版 JSON 模式, 确保模型生成有效的 JSON。对于支持的模型,优先使用 json_schema 格式。

  • ResponseFormatText object { type }

默认响应格式,用于生成文本响应。

  • ResponseFormatTextJSONSchemaConfig object { name, schema, type, 2 more }

JSON Schema 响应格式,用于生成结构化 JSON 响应。 参阅结构化输出。

  • name: string

响应格式的名称,须使用 a-z、A-Z、0-9,或包含 下划线和连字符,最长为 64 个字符。

  • schema: map[unknown]

以 JSON Schema 对象描述的响应格式模式。 JSON Schema 的构建方法参阅此处。

  • type: "json_schema"

定义的响应格式类型,固定为 json_schema。

  • "json_schema"

  • description: optional string

响应格式的用途描述,模型据此 判断如何按该格式响应。

  • strict: optional boolean or null (default: false)

生成输出时是否启用严格模式遵循。 设为 true 时,模型始终严格遵循 schema 字段中定义的模式。strict 为 true 时仅支持 JSON Schema 的子集。更多信息请参阅结构化输出 指南。

  • ResponseFormatJSONObject object { type }

JSON 对象响应格式,是生成 JSON 响应的较早方式。 对于支持的模型,建议使用 json_schema。注意: 须在系统消息或用户消息中指示模型生成 JSON, 模型才会生成 JSON。

  • tools: optional array of Function { name, parameters, strict, 6 more } or FileSearch { type, vector_store_ids, filters, 2 more } or Computer { type } or 13 more

模型生成响应时可以调用的工具数组。你 可以通过 tool_choice 参数指定要使用的工具。

可向模型提供以下两类工具:

  • 内置工具:由 OpenAI 提供,用于扩展 模型能力,例如网页搜索 或文件搜索。更多信息参阅 内置工具。
  • 函数调用(自定义工具):由你定义的函数, 使模型可以调用你自己的代码。更多信息参阅 函数调用。

  • Function object { name, parameters, strict, 6 more }

定义模型可以选择调用的自有代码函数。参阅函数调用。

  • name: string

要调用的函数名称。

  • parameters: map[unknown] or null

描述函数参数的 JSON Schema 对象。

  • strict: boolean or null

是否对此函数工具强制执行严格参数校验。

  • type: "function" (default: "function")

函数工具类型,固定为 function。

  • "function"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

  • "direct"

  • "programmatic"

  • async: optional boolean

  • defer_loading: optional boolean

此函数是否延迟加载并通过工具搜索加载。

  • description: optional string or null

函数描述,模型据此判断是否调用该函数。

  • output_schema: optional map[unknown] or null

描述此函数字符串输出中编码的 JSON 值的 JSON Schema 对象。

  • FileSearch object { type, vector_store_ids, filters, 2 more }

搜索已上传文件中相关内容的工具。参阅文件搜索工具。

  • type: "file_search" (default: "file_search")

文件搜索工具类型,固定为 file_search。

  • "file_search"

  • vector_store_ids: array of string

要搜索的向量存储 ID 列表。

  • filters: optional ComparisonFilter or CompoundFilter or null

要应用的筛选条件。

  • ComparisonFilter object { key, type, value }

使用指定比较运算,将某个属性键与给定值比较的筛选条件。

  • key: string

要与值比较的属性键。

  • type: "eq" or "ne" or "gt" or 5 more (default: "eq")

指定比较运算符:eq、ne、gt、gte、lt、lte、in、nin。

  • eq:等于
  • ne:不等于
  • gt:大于
  • gte:大于或等于
  • lt:小于
  • lte:小于或等于
  • in:属于
  • nin:不属于

  • "eq"

  • "ne"

  • "gt"

  • "gte"

  • "lt"

  • "lte"

  • "in"

  • "nin"

  • value: string or number or boolean or array of string or number

用于与属性键比较的值,支持字符串、数字或布尔类型。

  • string

  • number

  • boolean

  • array of string or number

  • string

  • number

  • CompoundFilter object { filters, type }

使用 and 或 or 组合多个筛选条件。

  • filters: array of ComparisonFilter or CompoundFilter

要组合的筛选条件数组,条目可以是 ComparisonFilter 或 CompoundFilter。

  • ComparisonFilter object { key, type, value }

使用指定比较运算,将某个属性键与给定值比较的筛选条件。

  • CompoundFilter object { filters, type }

使用 and 或 or 组合多个筛选条件。

  • type: "and" or "or"

运算类型:and 或 or。

  • "and"

  • "or"

  • max_num_results: optional integer

返回结果数量上限,须介于 1–50 之间,含边界。

  • ranking_options: optional object { hybrid_search, ranker, score_threshold }

搜索结果的排序选项。

  • hybrid_search: optional object { embedding_weight, text_weight }

启用混合搜索时,控制倒数排名融合如何平衡语义嵌入匹配与稀疏关键词匹配的权重。

  • embedding_weight: number

嵌入在倒数排名融合中的权重。

  • text_weight: number

文本在倒数排名融合中的权重。

  • ranker: optional "auto" or "default-2024-11-15"

文件搜索所用的排序器。

  • "auto"

  • "default-2024-11-15"

  • score_threshold: optional number

文件搜索的分数阈值,为 0–1 之间的数字。越接近 1,越倾向于只返回最相关的结果,但返回数量可能减少。

  • Computer object { type }

控制虚拟计算机的工具。参阅计算机工具。

  • type: "computer" (default: "computer")

计算机工具类型,固定为 computer。

  • "computer"

  • ComputerUsePreview object { display_height, display_width, environment, type }

控制虚拟计算机的工具。参阅计算机工具。

  • display_height: integer

计算机显示区域的高度。

  • display_width: integer

计算机显示区域的宽度。

  • environment: "windows" or "mac" or "linux" or 2 more

要控制的计算机环境类型。

  • "windows"

  • "mac"

  • "linux"

  • "ubuntu"

  • "browser"

  • type: "computer_use_preview" (default: "computer_use_preview")

计算机使用工具类型,固定为 computer_use_preview。

  • "computer_use_preview"

  • WebSearch object { type, external_web_access, filters, 2 more }

在互联网上搜索与提示词相关的信息来源。参阅 网络搜索工具时。

  • type: "web_search" or "web_search_2025_08_26" (default: "web_search")

网页搜索工具类型,可选 web_search 或 web_search_2025_08_26。

  • "web_search"

  • "web_search_2025_08_26"

  • external_web_access: optional boolean (default: true)

是否允许网页搜索实时访问互联网。省略时默认为 true。设为 false 时,网页搜索工具以离线或仅缓存模式运行,不会抓取新的外部内容。

  • filters: optional object { allowed_domains } or null

搜索的筛选条件。

  • allowed_domains: optional array of string or null (default: [])

搜索允许的域名。未提供时允许所有域名。 也允许访问所提供域名的子域名。

示例:["pubmed.ncbi.nlm.nih.gov"]

  • search_context_size: optional "low" or "medium" or "high" (default: "medium")

对搜索占用上下文窗口空间大小的总体指导,可选 low、medium 或 high,默认为 medium。

  • "low"

  • "medium"

  • "high"

  • user_location: optional object { city, country, region, 2 more } or null

用户的大致位置。省略或设为 null 时,默认为 美国。若要避免此默认值,可传入不包含位置字段的 {"type": "approximate"}。 若要本地化结果,须提供相应位置字段。

  • city: optional string or null

用户所在城市的自由文本,例如 San Francisco。

  • country: optional string or null

用户所在国家/地区的两字母 ISO 代码,例如 US。

  • region: optional string or null

用户所在地区的自由文本,例如 California。

  • timezone: optional string or null

用户所在的 IANA 时区,例如 America/Los_Angeles。

  • type: optional "approximate" (default: "approximate")

位置估算类型,固定为 approximate。

  • "approximate"

  • Mcp object { server_label, type, allowed_callers, 9 more }

通过远程模型上下文协议(MCP)服务器, 向模型提供额外工具。了解 MCP。

  • server_label: string

此 MCP 服务器的标签,用于在工具调用中标识服务器。

  • type: "mcp"

MCP 工具类型,固定为 mcp。

  • "mcp"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • allowed_tools: optional array of string or McpToolFilter { read_only, tool_names } or null

允许的工具名称列表或筛选对象。

  • McpAllowedTools = array of string

允许的工具名称组成的字符串数组。

  • McpToolFilter object { read_only, tool_names }

用于指定允许哪些工具的筛选对象。

  • read_only: optional boolean

表示工具会修改数据还是只读。如果 MCP 服务器标注了 readOnlyHint, 就会与此筛选条件匹配。

  • tool_names: optional array of string

允许的工具名称列表。

  • authorization: optional string

可用于远程 MCP 服务器的 OAuth 访问令牌,既可 配合自定义 MCP 服务器 URL,也可配合服务连接器。你的应用 须处理 OAuth 授权流程,并在此提供令牌。

  • connector_id: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 5 more

服务连接器的标识,例如 ChatGPT 中提供的连接器。须提供 server_url、connector_id 或 tunnel_id 中的一项。更多 服务连接器信息参阅此处。

对于 2026 年 9 月 1 日之后发布的模型,此字段已弃用。 使用 server_url 连接远程 MCP 服务器,或使用 tunnel_id 通过安全 MCP 隧道连接。

当前支持的 connector_id 值如下:

  • Dropbox:connector_dropbox
  • Gmail:connector_gmail
  • Google 日历:connector_googlecalendar
  • Google 云端硬盘:connector_googledrive
  • Microsoft Teams:connector_microsoftteams
  • Outlook 日历:connector_outlookcalendar
  • Outlook 邮箱:connector_outlookemail
  • SharePoint:connector_sharepoint

  • "connector_dropbox"

  • "connector_gmail"

  • "connector_googlecalendar"

  • "connector_googledrive"

  • "connector_microsoftteams"

  • "connector_outlookcalendar"

  • "connector_outlookemail"

  • "connector_sharepoint"

  • defer_loading: optional boolean

此 MCP 工具是否延迟加载并通过工具搜索发现。

  • headers: optional map[string] or null

可选的发送给 MCP 服务器的 HTTP 请求头,用于认证 或其他用途。

  • require_approval: optional McpToolApprovalFilter { always, never } or "always" or "never" or null (default: "always")

指定 MCP 服务器的哪些工具需要批准。

  • McpToolApprovalFilter object { always, never }

指定 MCP 服务器的哪些工具需要批准。可以是 always、never,或与需要批准的工具关联的 筛选对象。

  • always: optional object { read_only, tool_names }

用于指定允许哪些工具的筛选对象。

  • read_only: optional boolean

表示工具会修改数据还是只读。如果 MCP 服务器标注了 readOnlyHint, 就会与此筛选条件匹配。

  • tool_names: optional array of string

允许的工具名称列表。

  • never: optional object { read_only, tool_names }

用于指定允许哪些工具的筛选对象。

  • read_only: optional boolean

表示工具会修改数据还是只读。如果 MCP 服务器标注了 readOnlyHint, 就会与此筛选条件匹配。

  • tool_names: optional array of string

允许的工具名称列表。

  • McpToolApprovalSetting = "always" or "never"

为所有工具指定统一的批准策略,可选 always 或 never。设为 always 时,所有工具均需要批准; 设为 never 时,所有工具均不需要批准。

  • "always"

  • "never"

  • server_description: optional string

MCP 服务器的可选描述,用于提供更多上下文。

  • server_url: optional string

MCP 服务器的 URL。须提供 server_url、connector_id 或 tunnel_id 中的一项。

format: uri

  • tunnel_id: optional string

用来替代直接服务器 URL 的安全 MCP 隧道 ID。须提供 server_url、connector_id 或 tunnel_id 中的一项。

pattern: ^tunnel_[a-z0-9]{32}$

  • CodeInterpreter object { container, type, allowed_callers }

运行 Python 代码以帮助生成提示词响应的工具。

  • container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }

代码解释器容器,可以是容器 ID,也可以是 指定代码可用的已上传文件 ID 的对象,同时可提供 可选的 memory_limit 设置。

  • string

容器 ID。

  • CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }

代码解释器容器配置,可以指定运行代码时所处理的文件 ID。

  • type: "auto" (default: "auto")

固定为 auto。

  • "auto"

  • file_ids: optional array of string

可选的已上传文件列表,这些文件将提供给代码使用。

maxItems: 50

  • memory_limit: optional "1g" or "4g" or "16g" or "64g" or null

代码解释器容器的内存上限。

  • "1g"

  • "4g"

  • "16g"

  • "64g"

  • network_policy: optional ContainerNetworkPolicyDisabled or ContainerNetworkPolicyAllowlist

容器的网络访问策略。

  • ContainerNetworkPolicyDisabled object { type }

  • type: "disabled" (default: "disabled")

禁用出站网络访问,固定为 disabled。

  • "disabled"

  • ContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }

  • allowed_domains: array of string

type 为 allowlist 时允许访问的域名列表。

minItems: 1

  • type: "allowlist" (default: "allowlist")

仅允许对指定域名发起出站网络访问,固定为 allowlist。

  • "allowlist"

  • domain_secrets: optional array of ContainerNetworkPolicyDomainSecret

可选的仅用于允许访问域名的域名级密钥。

minItems: 1

  • domain: string

密钥关联的域名。

minLength: 1

  • name: string

要为该域名注入的密钥名称。

minLength: 1

  • value: string

要为该域名注入的密钥值。

minLength: 1, maxLength: 10485760

  • type: "code_interpreter"

代码解释器工具类型,固定为 code_interpreter。

  • "code_interpreter"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • ProgrammaticToolCalling object { type }

  • type: "programmatic_tool_calling" (default: "programmatic_tool_calling")

工具类型,固定为 programmatic_tool_calling。

  • "programmatic_tool_calling"

  • ImageGeneration object { type, action, background, 13 more }

使用 GPT 图像模型生成图像的工具。

  • type: "image_generation"

图像生成工具类型,固定为 image_generation。

  • "image_generation"

  • action: optional "generate" or "edit" or "auto"

生成新图像还是编辑已有图像,默认为 auto。

  • "generate"

  • "edit"

  • "auto"

  • background: optional "transparent" or "opaque" or "auto" (default: "auto")

生成图像的背景,可选 transparent、opaque, 或 auto。gpt-image-2.5-sunburst 和 gpt-image-2.5-flare,包括 对应的 2026-09-08 快照,支持 opaque 和 transparent 背景。受支持的 GPT Image 模型可以使用透明 背景。对于 gpt-image-2 和 gpt-image-2-2026-04-21,此功能处于 预览阶段。使用 transparent 时,须将输出格式设为 png 或 webp。 默认为 auto。

  • "transparent"

  • "opaque"

  • "auto"

  • complexity: optional "low" or "medium" or "high"

用于规划图像的计算投入,与渲染质量分开设置。 覆盖外层响应用于图像生成的 reasoning.effort。 省略时,继承外层受支持的推理强度,或使用 图像模型配置的默认值。 对于 SVG 输出,此项控制参考图像,而不是 SVG 生成模型的 推理。

  • "low"

  • "medium"

  • "high"

  • frame_count: optional integer (default: 9)

GIF 帧数,要求 output_format 为 gif,默认为 9。

minimum: 2, maximum: 16

  • frame_duration_ms: optional integer (default: 200)

每个 GIF 帧的时长,单位为毫秒,取整到 10 毫秒。 要求 output_format 为 gif,默认为 200。

minimum: 20, maximum: 2000

  • input_fidelity: optional "high" or "low" or null

控制模型为匹配输入图像风格和特征(尤其是面部特征)投入的程度。gpt-image-1.5 支持 high 和 low,gpt-image-1-mini 仅支持 low。使用 gpt-image-2 时应省略此参数。支持该参数的模型默认为 low。

  • "high"

  • "low"

  • input_image_mask: optional object { file_id, image_url }

可选的局部重绘蒙版,包含 image_url (可选字符串)和 file_id(可选字符串)。

  • file_id: optional string

蒙版图像的文件 ID。

  • image_url: optional string

采用 Base64 编码的蒙版图像。

  • model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-2" or 9 more

用于图像生成的模型,可选 gpt-image-1-mini、 gpt-image-1.5, gpt-image-2, gpt-image-2-2026-04-21、gpt-image-2.5-sunburst、 gpt-image-2.5-sunburst-2026-09-08、gpt-image-2.5-flare、 gpt-image-2.5-flare-2026-09-08, gpt-image-2.6-sunburst, gpt-image-2.6-flare 或 chatgpt-image-latest。默认值: gpt-image-2.6-sunburst.

gpt-image-1 已于 2026 年 10 月 23 日停用,请使用 gpt-image-2.5-sunburst 或 gpt-image-2.5-flare。

  • string

  • "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-2" or 9 more

用于图像生成的模型,可选 gpt-image-1-mini、 gpt-image-1.5, gpt-image-2, gpt-image-2-2026-04-21、gpt-image-2.5-sunburst、 gpt-image-2.5-sunburst-2026-09-08、gpt-image-2.5-flare、 gpt-image-2.5-flare-2026-09-08, gpt-image-2.6-sunburst, gpt-image-2.6-flare 或 chatgpt-image-latest。默认值: gpt-image-2.6-sunburst.

gpt-image-1 已于 2026 年 10 月 23 日停用,请使用 gpt-image-2.5-sunburst 或 gpt-image-2.5-flare。

  • "gpt-image-1"

  • "gpt-image-1-mini"

  • "gpt-image-2"

  • "gpt-image-2-2026-04-21"

  • "gpt-image-2.5-sunburst"

  • "gpt-image-2.5-sunburst-2026-09-08"

  • "gpt-image-2.5-flare"

  • "gpt-image-2.5-flare-2026-09-08"

  • "gpt-image-2.6-sunburst"

  • "gpt-image-2.6-flare"

  • "gpt-image-1.5"

  • "chatgpt-image-latest"

  • moderation: optional "auto" or "low" (default: "auto")

生成图像的审核级别,默认为 auto。

  • "auto"

  • "low"

  • output_compression: optional integer (default: 100)

输出图像的压缩级别,默认为 100。

minimum: 0, maximum: 100

  • output_format: optional "png" or "webp" or "jpeg" or 2 more (default: "png")

输出图像格式,可选 png、webp、jpeg、 gif 或 svg,默认为 png。GIF 和 SVG 输出要求模型 支持所选格式。GIF 输出不支持 部分图像流式传输,即 partial_images 大于 0, 也不支持 input_image_mask 或自定义 output_compression。 GIF 输出仍可以流式发送 Responses 生命周期事件。

  • "png"

  • "webp"

  • "jpeg"

  • "gif"

  • "svg"

  • partial_images: optional integer (default: 0)

流式模式中生成的部分图像数量,范围为 0(默认值)到 3。

minimum: 0, maximum: 3

  • quality: optional "low" or "medium" or "high" or 3 more (default: "auto")

生成图像的质量。GPT 图像模型支持 low、 medium 和 high。gpt-image-2.5-sunburst 和 gpt-image-2.5-flare, 包括对应的 2026-09-08 快照,还支持 xhigh 和 max。 默认为 auto。

  • "low"

  • "medium"

  • "high"

  • "xhigh"

  • "max"

  • "auto"

  • size: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "auto" (default: "auto")

生成图像的尺寸。gpt-image-2、gpt-image-2-2026-04-21、gpt-image-2.5-sunburst、gpt-image-2.5-sunburst-2026-09-08、gpt-image-2.5-flare 和 gpt-image-2.5-flare-2026-09-08 支持以 WIDTHxHEIGHT 字符串指定任意分辨率,例如 1536x864。宽和高均须能被 16 整除,宽高比须在 1:3 至 3:1 之间。高于 2560x1440 的分辨率属于实验功能,支持的最高分辨率为 3840x2160。尺寸还须符合模型当前的像素数与边长限制。GPT Image 模型支持标准尺寸 1024x1024、1536x1024 和 1024x1536;允许自动尺寸的模型支持 auto。

  • string

  • "1024x1024" or "1024x1536" or "1536x1024" or "auto"

生成图像的尺寸。gpt-image-2、gpt-image-2-2026-04-21、gpt-image-2.5-sunburst、gpt-image-2.5-sunburst-2026-09-08、gpt-image-2.5-flare 和 gpt-image-2.5-flare-2026-09-08 支持以 WIDTHxHEIGHT 字符串指定任意分辨率,例如 1536x864。宽和高均须能被 16 整除,宽高比须在 1:3 至 3:1 之间。高于 2560x1440 的分辨率属于实验功能,支持的最高分辨率为 3840x2160。尺寸还须符合模型当前的像素数与边长限制。GPT Image 模型支持标准尺寸 1024x1024、1536x1024 和 1024x1536;允许自动尺寸的模型支持 auto。

  • "1024x1024"

  • "1024x1536"

  • "1536x1024"

  • "auto"

  • svg: optional object { model, reasoning }

SVG 生成模型的设置,要求 output_format 为 svg。 启用 SVG 模型选择时,省略此对象会使用 外层响应模型。否则使用默认 SVG 生成模型,且 不能显式覆盖模型。

  • model: optional string

minLength: 1

  • reasoning: optional object { effort } or null

SVG 编写的推理强度。省略时,Images 和 Responses 均使用编写模型的默认值。

  • effort: optional "none" or "minimal" or "low" or 4 more

控制模型为此次请求投入的推理强度。

  • "none"

  • "minimal"

  • "low"

  • "medium"

  • "high"

  • "xhigh"

  • "max"

  • LocalShell object { type }

允许模型在本地环境执行 shell 命令的工具。

  • type: "local_shell" (default: "local_shell")

本地 shell 工具类型,固定为 local_shell。

  • "local_shell"

  • Shell object { type, allowed_callers, environment }

允许模型执行 shell 命令的工具。

  • type: "shell" (default: "shell")

shell 工具类型,固定为 shell。

  • "shell"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • environment: optional ContainerAuto or LocalEnvironment or ContainerReference or null

  • ContainerAuto object { type, file_ids, memory_limit, 2 more }

  • type: "container_auto" (default: "container_auto")

为此请求自动创建容器。

  • "container_auto"

  • file_ids: optional array of string

可选的已上传文件列表,这些文件将提供给代码使用。

maxItems: 50

  • memory_limit: optional "1g" or "4g" or "16g" or "64g" or null

容器的内存上限。

  • "1g"

  • "4g"

  • "16g"

  • "64g"

  • network_policy: optional ContainerNetworkPolicyDisabled or ContainerNetworkPolicyAllowlist

容器的网络访问策略。

  • ContainerNetworkPolicyDisabled object { type }

  • ContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }

  • skills: optional array of SkillReference or InlineSkill

可选的技能列表,通过 ID 或内联数据引用技能。

maxItems: 200

  • SkillReference object { skill_id, type, version }

  • skill_id: string

引用的技能 ID。

minLength: 1, maxLength: 64

  • type: "skill_reference" (default: "skill_reference")

引用通过 /v1/skills 接口创建的技能。

  • "skill_reference"

  • version: optional string

可选的技能版本。使用正整数或 'latest',省略时使用默认版本。

  • InlineSkill object { description, name, source, type }

  • description: string

技能描述。

  • name: string

技能名称。

  • source: InlineSkillSource

内联技能载荷。

  • data: string

采用 Base64 编码的技能 ZIP 包。

minLength: 1, maxLength: 70254592

  • media_type: "application/zip" (default: "application/zip")

内联技能载荷的媒体类型,必须为 application/zip。

  • "application/zip"

  • type: "base64" (default: "base64")

内联技能来源的类型,必须为 base64。

  • "base64"

  • type: "inline" (default: "inline")

为此请求定义内联技能。

  • "inline"

  • LocalEnvironment object { type, skills }

  • type: "local" (default: "local")

使用本地计算机环境。

  • "local"

  • skills: optional array of LocalSkill

可选的技能列表。

maxItems: 200

  • description: string

技能描述。

  • name: string

技能名称。

  • path: string

包含该技能的目录路径。

  • ContainerReference object { container_id, type }

  • container_id: string

引用的容器 ID。

  • type: "container_reference" (default: "container_reference")

引用通过 /v1/containers 接口创建的容器。

  • "container_reference"

  • Custom object { name, type, allowed_callers, 4 more }

使用指定格式处理输入的自定义工具。参阅自定义工具。

  • name: string

自定义工具的名称,用于在工具调用中标识它。

  • type: "custom" (default: "custom")

自定义工具类型,固定为 custom。

  • "custom"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • async: optional boolean

工具响应是否可以异步返回,而非在下一次创建响应时立即返回。

  • defer_loading: optional boolean

此工具是否应延迟加载并通过工具搜索发现。

  • description: optional string

自定义工具的可选描述,用于提供更多上下文。

  • format: optional CustomToolInputFormat

自定义工具的输入格式,默认为无约束文本。

  • Text object { type }

无约束的自由文本。

  • type: "text" (default: "text")

无约束文本格式,固定为 text。

  • "text"

  • Grammar object { definition, syntax, type }

用户定义的语法。

  • definition: string

语法定义。

  • syntax: "lark" or "regex"

语法定义的语法类型,可选 lark 或 regex。

  • "lark"

  • "regex"

  • type: "grammar" (default: "grammar")

语法格式,固定为 grammar。

  • "grammar"

  • Namespace object { description, name, tools, type }

将函数工具或自定义工具归入共享命名空间。

  • description: string

展示给模型的命名空间描述。

  • name: string

工具调用使用的命名空间名称,例如 crm。

minLength: 1

  • tools: array of Function { name, type, allowed_callers, 6 more } or Custom { name, type, allowed_callers, 4 more }

此命名空间内可用的函数工具或自定义工具。

minItems: 1

  • Function object { name, type, allowed_callers, 6 more }

  • name: string

pattern: ^[a-zA-Z0-9_-]+$, minLength: 1, maxLength: 128

  • type: "function" (default: "function")

  • "function"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • async: optional boolean

工具响应是否可以异步返回,而非在下一次创建响应时立即返回。

  • defer_loading: optional boolean

此函数是否应延迟加载并通过工具搜索发现。

  • description: optional string or null

  • output_schema: optional map[unknown] or null

描述此函数工具字符串输出中编码的 JSON 值的 JSON Schema,不用于描述内容数组输出。

  • parameters: optional unknown or null

  • strict: optional boolean or null

是否强制执行严格参数校验。省略时,模式兼容的情况下 Responses 会尝试严格校验,否则退回非严格校验。

  • Custom object { name, type, allowed_callers, 4 more }

使用指定格式处理输入的自定义工具。参阅自定义工具。

  • name: string

自定义工具的名称,用于在工具调用中标识它。

  • type: "custom" (default: "custom")

自定义工具类型,固定为 custom。

  • "custom"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • async: optional boolean

工具响应是否可以异步返回,而非在下一次创建响应时立即返回。

  • defer_loading: optional boolean

此工具是否应延迟加载并通过工具搜索发现。

  • description: optional string

自定义工具的可选描述,用于提供更多上下文。

  • format: optional CustomToolInputFormat

自定义工具的输入格式,默认为无约束文本。

  • type: "namespace" (default: "namespace")

工具类型,固定为 namespace。

  • "namespace"

  • ToolSearch object { type, description, execution, parameters }

用于延迟加载工具的托管工具搜索或自带工具(BYOT)搜索配置。

  • type: "tool_search" (default: "tool_search")

工具类型,固定为 tool_search。

  • "tool_search"

  • description: optional string or null

客户端执行的工具搜索工具展示给模型的描述。

  • execution: optional "server" or "client"

工具搜索由服务端还是客户端执行。

  • "server"

  • "client"

  • parameters: optional unknown or null

客户端执行的工具搜索工具的参数模式。

  • WebSearchPreview object { type, search_content_types, search_context_size, user_location }

搜索网页以获取可用于响应的相关结果的工具。参阅网页搜索工具。

  • type: "web_search_preview" or "web_search_preview_2025_03_11" (default: "web_search_preview")

网页搜索工具类型,可选 web_search_preview 或 web_search_preview_2025_03_11。

  • "web_search_preview"

  • "web_search_preview_2025_03_11"

  • search_content_types: optional array of "text" or "image"

  • "text"

  • "image"

  • search_context_size: optional "low" or "medium" or "high"

对搜索占用上下文窗口空间大小的总体指导,可选 low、medium 或 high,默认为 medium。

  • "low"

  • "medium"

  • "high"

  • user_location: optional object { type, city, country, 2 more } or null

用户的大致位置。省略或设为 null 时默认为美国。若要避免此默认值,可传入不包含位置字段的 {"type": "approximate"}。若要本地化结果,须提供相应位置字段。

  • type: "approximate" (default: "approximate")

位置估算类型,固定为 approximate。

  • "approximate"

  • city: optional string or null

用户所在城市的自由文本,例如 San Francisco。

  • country: optional string or null

用户所在国家/地区的两字母 ISO 代码,例如 US。

  • region: optional string or null

用户所在地区的自由文本,例如 California。

  • timezone: optional string or null

用户所在的 IANA 时区,例如 America/Los_Angeles。

  • ApplyPatch object { type, allowed_callers }

允许助手使用统一差异格式创建、删除或更新文件。

  • type: "apply_patch" (default: "apply_patch")

工具类型,固定为 apply_patch。

  • "apply_patch"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • top_p: optional number (default: 1)

用于核采样的参数,是 temperature 的替代方案;1.0 表示包含所有词元。

  • metadata: optional Metadata or null

可附加到对象的元数据,最多包含 16 组键值对,可 以结构化方式存储对象的额外信息, 并通过 API 或控制台查询对象。

键为最多 64 个字符的字符串,值为 最多 512 个字符的字符串。

  • name: optional string

运行名称。

返回值

  • id: string

评测运行的唯一标识。

  • created_at: integer

评测运行创建时的 Unix 时间戳,单位为秒。

format: unixtime

  • data_source: CreateEvalJSONLRunDataSource or CreateEvalCompletionsRunDataSource or ResponsesRunDataSource { source, type, input_messages, 2 more }

本次运行的数据源信息。

  • CreateEvalJSONLRunDataSource object { source, type }

JsonlRunDataSource 对象,指定与该评测匹配的 JSONL 文件。

  • source: EvalJSONLFileContentSource { content, type } or EvalJSONLFileIDSource { id, type }

决定数据源中 item 命名空间的内容。

  • EvalJSONLFileContentSource object { content, type }

  • content: array of object { item, sample }

JSONL 文件的内容。

  • item: map[unknown]

  • sample: optional map[unknown]

  • type: "file_content" (default: "file_content")

JSONL 来源的类型,固定为 file_content。

  • "file_content"

  • EvalJSONLFileIDSource object { id, type }

  • id: string

文件标识。

  • type: "file_id" (default: "file_id")

JSONL 来源的类型,固定为 file_id。

  • "file_id"

  • type: "jsonl" (default: "jsonl")

数据源类型,固定为 jsonl。

  • "jsonl"

  • CreateEvalCompletionsRunDataSource object { source, type, input_messages, 2 more }

描述模型采样配置的 CompletionsRunDataSource 对象。

  • source: EvalJSONLFileContentSource { content, type } or EvalJSONLFileIDSource { id, type } or StoredCompletionsRunDataSource { type, created_after, created_before, 3 more }

决定本次运行数据源中 item 命名空间的内容。

  • EvalJSONLFileContentSource object { content, type }

  • content: array of object { item, sample }

JSONL 文件的内容。

  • item: map[unknown]

  • sample: optional map[unknown]

  • type: "file_content" (default: "file_content")

JSONL 来源的类型,固定为 file_content。

  • "file_content"

  • EvalJSONLFileIDSource object { id, type }

  • id: string

文件标识。

  • type: "file_id" (default: "file_id")

JSONL 来源的类型,固定为 file_id。

  • "file_id"

  • StoredCompletionsRunDataSource object { type, created_after, created_before, 3 more }

描述一组筛选条件的 StoredCompletionsRunDataSource 配置。

  • type: "stored_completions" (default: "stored_completions")

来源类型,固定为 stored_completions。

  • "stored_completions"

  • created_after: optional integer or null

可选的 Unix 时间戳,用于筛选在此时间之后创建的条目。

  • created_before: optional integer or null

可选的 Unix 时间戳,用于筛选在此时间之前创建的条目。

  • limit: optional integer or null

可选的返回条目数量上限。

  • metadata: optional Metadata or null

可附加到对象的元数据,最多包含 16 组键值对,可 以结构化方式存储对象的额外信息, 并通过 API 或控制台查询对象。

键为最多 64 个字符的字符串,值为 最多 512 个字符的字符串。

  • model: optional string or null

可选的模型筛选条件,例如 'gpt-6-astra'。

  • type: "completions" (default: "completions")

运行数据源类型,固定为 completions。

  • "completions"

  • input_messages: optional TemplateInputMessages { template, type } or ItemReferenceInputMessages { item_reference, type }

从模型采样时使用,规定传给模型的消息结构。可以引用预先构建的轨迹,例如 item.input_trajectory,也可以使用包含 item 命名空间变量引用的模板。

  • TemplateInputMessages object { template, type }

  • template: array of EasyInputMessage or EvalMessageObject { content, role, type }

构成提示词或上下文的聊天消息列表,可以包含对 item 命名空间的变量引用,例如 {{item.name}}。

  • EasyInputMessage object { content, role, phase, type }

输入模型的消息,其角色表示指令遵循的 优先级。以 developer 或 system 角色给出的指令 优先于 user 角色给出的指令。 assistant 角色的消息被视为模型在此前 交互中生成的内容。

  • content: string or ResponseInputMessageContentList

用于生成响应的文本、图像或音频输入。 也可以包含此前的助手响应。

  • TextInput = string

输入模型的文本。

  • ResponseInputMessageContentList = array of ResponseInputContent

输入模型的一个或多个条目的列表,可以包含不同 内容类型。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • text: string

输入模型的文本。

  • type: "input_text" (default: "input_text")

输入条目类型,固定为 input_text。

  • "input_text"

  • prompt_cache_breakpoint: optional object { mode, ttl }

标记可复用提示词前缀的精确结束位置。省略 ttl 时,断点继承请求中的 prompt_cache_options.ttl;该边界不会按词元块取整。

  • mode: "explicit" (default: "explicit")

断点模式,固定为 explicit。

  • "explicit"

  • ttl: optional "30m" or "12h"

此缓存断点的最短存续时间,默认为请求的 TTL。

  • "30m"

  • "12h"

  • ResponseInputImage object { detail, type, file_id, 2 more }

输入模型的图像。参阅图像输入。

  • detail: ImageDetail

发送给模型的图像细节级别,可选 high、low、auto 或 original,默认为 auto。

  • "low"

  • "high"

  • "auto"

  • "original"

  • type: "input_image" (default: "input_image")

输入条目类型,固定为 input_image。

  • "input_image"

  • file_id: optional string or null

要发送给模型的文件 ID。

  • image_url: optional string or null

要发送给模型的图像 URL,可以是完整 URL,或包含 Base64 编码图像的 data URL。

format: uri

  • prompt_cache_breakpoint: optional object { mode, ttl }

标记可复用提示词前缀的精确结束位置。省略 ttl 时,断点继承请求中的 prompt_cache_options.ttl;该边界不会按词元块取整。

  • mode: "explicit" (default: "explicit")

断点模式,固定为 explicit。

  • "explicit"

  • ttl: optional "30m" or "12h"

此缓存断点的最短存续时间,默认为请求的 TTL。

  • "30m"

  • "12h"

  • ResponseInputFile object { type, detail, file_data, 4 more }

输入模型的文件。

  • type: "input_file" (default: "input_file")

输入条目类型,固定为 input_file。

  • "input_file"

  • detail: optional "auto" or "low" or "high"

发送给模型的文件细节级别。使用 auto 由系统选择;对于 GPT-5.6 及后续模型,auto 使用高质量渲染,可能增加输入词元用量。使用 low 进行成本较低的渲染,或使用 high 以更高质量渲染文件。默认为 auto。

  • "auto"

  • "low"

  • "high"

  • file_data: optional string

要发送给模型的文件内容。

  • file_id: optional string or null

要发送给模型的文件 ID。

  • file_url: optional string

要发送给模型的文件 URL。

format: uri

  • filename: optional string

要发送给模型的文件名。

  • prompt_cache_breakpoint: optional object { mode, ttl }

标记可复用提示词前缀的精确结束位置。省略 ttl 时,断点继承请求中的 prompt_cache_options.ttl;该边界不会按词元块取整。

  • mode: "explicit" (default: "explicit")

断点模式,固定为 explicit。

  • "explicit"

  • ttl: optional "30m" or "12h"

此缓存断点的最短存续时间,默认为请求的 TTL。

  • "30m"

  • "12h"

  • role: "user" or "assistant" or "system" or "developer"

输入消息的角色,可选 user、assistant、system 或 developer.

  • "user"

  • "assistant"

  • "system"

  • "developer"

  • phase: optional "commentary" or "final_answer" or null

将 assistant 消息标记为中间说明(commentary)或最终答案(final_answer)。 对于 gpt-5.3-codex 及后续此类模型,发送后续请求时,须保留并重新发送 所有助手消息的 phase;丢弃它可能降低表现。用户消息不使用此字段。

  • "commentary"

  • "final_answer"

  • type: optional "message"

输入消息类型,固定为 message。

  • "message"

  • EvalMessageObject object { content, role, type }

输入模型的消息,其角色表示指令遵循的 优先级。以 developer 或 system 角色给出的指令 优先于 user 角色给出的指令。 assistant 角色的消息被视为模型在此前 交互中生成的内容。

  • content: string or ResponseInputText or OutputText { text, type } or 3 more

模型输入,可以包含模板字符串。支持输入文本、输出文本、输入图像和输入音频,可提供单个条目或条目数组。

  • TextInput = string

输入模型的文本。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • OutputText object { text, type }

模型输出的文本。

  • text: string

模型输出的文本内容。

  • type: "output_text"

输出文本类型,固定为 output_text。

  • "output_text"

  • InputImage object { image_url, type, detail }

用于 EvalItem 内容数组中的图像输入块。

  • image_url: string

输入图像的 URL。

format: uri

  • type: "input_image"

输入图像类型,固定为 input_image。

  • "input_image"

  • detail: optional string

发送给模型的图像细节级别,可选 high、low 或 auto,默认为 auto。

  • ResponseInputAudio object { input_audio, type }

输入模型的音频。

  • input_audio: object { data, format }

  • data: string

采用 Base64 编码的音频数据。

  • format: "mp3" or "wav"

音频数据格式,当前支持 mp3 和 wav.

  • "mp3"

  • "wav"

  • type: "input_audio"

输入条目类型,固定为 input_audio。

  • "input_audio"

  • GraderInputs = array of string or ResponseInputText or OutputText { text, type } or 2 more

输入列表,每项可以是输入文本、输出文本、输入 图像或输入音频对象。

  • TextInput = string

输入模型的文本。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • OutputText object { text, type }

模型输出的文本。

  • text: string

模型输出的文本内容。

  • type: "output_text"

输出文本类型,固定为 output_text。

  • "output_text"

  • InputImage object { image_url, type, detail }

用于 EvalItem 内容数组中的图像输入块。

  • image_url: string

输入图像的 URL。

format: uri

  • type: "input_image"

输入图像类型,固定为 input_image。

  • "input_image"

  • detail: optional string

发送给模型的图像细节级别,可选 high、low 或 auto,默认为 auto。

  • ResponseInputAudio object { input_audio, type }

输入模型的音频。

  • role: "user" or "assistant" or "system" or "developer"

输入消息的角色,可选 user、assistant、system 或 developer.

  • "user"

  • "assistant"

  • "system"

  • "developer"

  • type: optional "message"

输入消息类型,固定为 message。

  • "message"

  • type: "template"

输入消息类型,固定为 template。

  • "template"

  • ItemReferenceInputMessages object { item_reference, type }

  • item_reference: string

对 item 命名空间中变量的引用,例如 "item.input_trajectory"。

  • type: "item_reference"

输入消息类型,固定为 item_reference。

  • "item_reference"

  • model: optional string

用于生成补全内容的模型名称,例如 "o3-mini"。

  • sampling_params: optional object { max_completion_tokens, reasoning_effort, response_format, 4 more }

  • max_completion_tokens: optional integer

生成输出的最大词元数。

  • reasoning_effort: optional ReasoningEffort or null (default: "medium")

限制推理模型的推理强度。当前支持 none、minimal、low、medium、high、xhigh 和 max。 降低推理强度可能加快响应,并减少响应中用于 推理的词元数。并非所有推理模型都支持每个 取值。各模型的支持情况请参阅 推理指南 中的说明。

  • "none"

  • "minimal"

  • "low"

  • "medium"

  • "high"

  • "xhigh"

  • "max"

  • response_format: optional ResponseFormatText or ResponseFormatJSONSchema or ResponseFormatJSONObject

指定模型必须输出的格式的对象。

设为 { "type": "json_schema", "json_schema": {...} } 会启用 结构化输出,确保模型遵循你提供的 JSON 模式。更多信息请参阅结构化输出 指南。

设为 { "type": "json_object" } 会启用旧版 JSON 模式, 确保模型生成有效的 JSON。对于支持的模型,优先使用 json_schema 格式。

  • ResponseFormatText object { type }

默认响应格式,用于生成文本响应。

  • type: "text"

定义的响应格式类型,固定为 text。

  • "text"

  • ResponseFormatJSONSchema object { json_schema, type }

JSON Schema 响应格式,用于生成结构化 JSON 响应。 参阅结构化输出。

  • json_schema: object { name, description, schema, strict }

结构化输出配置选项,包含 JSON Schema。

  • name: string

响应格式的名称,须使用 a-z、A-Z、0-9,或包含 下划线和连字符,最长为 64 个字符。

  • description: optional string

响应格式的用途描述,模型据此 判断如何按该格式响应。

  • schema: optional map[unknown]

以 JSON Schema 对象描述的响应格式模式。 JSON Schema 的构建方法参阅此处。

  • strict: optional boolean or null (default: false)

生成输出时是否启用严格模式遵循。 设为 true 时,模型始终严格遵循 schema 字段中定义的模式。strict 为 true 时仅支持 JSON Schema 的子集。更多信息请参阅结构化输出 指南。

  • type: "json_schema"

定义的响应格式类型,固定为 json_schema。

  • "json_schema"

  • ResponseFormatJSONObject object { type }

JSON 对象响应格式,是生成 JSON 响应的较早方式。 对于支持的模型,建议使用 json_schema。注意: 须在系统消息或用户消息中指示模型生成 JSON, 模型才会生成 JSON。

  • type: "json_object"

定义的响应格式类型,固定为 json_object。

  • "json_object"

  • seed: optional integer (default: 42)

采样时用于初始化随机性的种子值。

  • temperature: optional number (default: 1)

较高的 temperature 会增加输出的随机性。

  • tools: optional array of ChatCompletionFunctionTool

模型可以调用的工具列表。目前工具仅支持函数。通过此项提供模型可为其生成 JSON 输入的函数列表,最多支持 128 个函数。

  • function: FunctionDefinition

  • name: string

要调用的函数名称,须使用 a-z、A-Z、0-9,或包含下划线和连字符,最长为 64 个字符。

  • description: optional string

函数功能的描述,模型据此选择何时以及如何调用该函数。

  • parameters: optional FunctionParameters

函数接受的参数,以 JSON Schema 对象描述。示例参阅指南,格式说明参阅 JSON Schema 参考。

省略 parameters 表示定义参数列表为空的函数。

  • strict: optional boolean or null (default: false)

生成函数调用时是否启用严格模式遵循。设为 true 时,模型严格遵循 parameters 字段中定义的模式。strict 为 true 时仅支持 JSON Schema 的子集。结构化输出的更多信息参阅函数调用指南。

  • type: "function"

工具类型,目前仅支持 function。

  • "function"

  • top_p: optional number (default: 1)

用于核采样的参数,是 temperature 的替代方案;1.0 表示包含所有词元。

  • ResponsesRunDataSource object { source, type, input_messages, 2 more }

描述模型采样配置的 ResponsesRunDataSource 对象。

  • source: EvalJSONLFileContentSource { content, type } or EvalJSONLFileIDSource { id, type } or EvalResponsesSource { type, created_after, created_before, 8 more }

决定本次运行数据源中 item 命名空间的内容。

  • EvalJSONLFileContentSource object { content, type }

  • content: array of object { item, sample }

JSONL 文件的内容。

  • item: map[unknown]

  • sample: optional map[unknown]

  • type: "file_content" (default: "file_content")

JSONL 来源的类型,固定为 file_content。

  • "file_content"

  • EvalJSONLFileIDSource object { id, type }

  • id: string

文件标识。

  • type: "file_id" (default: "file_id")

JSONL 来源的类型,固定为 file_id。

  • "file_id"

  • EvalResponsesSource object { type, created_after, created_before, 8 more }

描述运行数据源配置的 EvalResponsesSource 对象。

  • type: "responses"

运行数据源类型,固定为 responses。

  • "responses"

  • created_after: optional integer or null

仅包含在此时间戳之后创建的条目,含边界。此查询参数用于选择响应。

minimum: 0

  • created_before: optional integer or null

仅包含在此时间戳之前创建的条目,含边界。此查询参数用于选择响应。

minimum: 0

  • instructions_search: optional string or null

可选的字符串,用于搜索 'instructions' 字段。此查询参数用于选择响应。

  • metadata: optional unknown or null

响应的元数据筛选条件。此查询参数用于选择响应。

  • model: optional string or null

要查找其响应的模型名称。此查询参数用于选择响应。

  • reasoning_effort: optional ReasoningEffort or null (default: "medium")

限制推理模型的推理强度。当前支持 none、minimal、low、medium、high、xhigh 和 max。 降低推理强度可能加快响应,并减少响应中用于 推理的词元数。并非所有推理模型都支持每个 取值。各模型的支持情况请参阅 推理指南 中的说明。

  • temperature: optional number or null

采样温度。此查询参数用于选择响应。

  • tools: optional array of string or null

工具名称列表。此查询参数用于选择响应。

  • top_p: optional number or null

核采样参数。此查询参数用于选择响应。

  • users: optional array of string or null

用户标识列表。此查询参数用于选择响应。

  • type: "responses" (default: "responses")

运行数据源类型,固定为 responses。

  • "responses"

  • input_messages: optional InputMessagesTemplate { template, type } or InputMessagesItemReference { item_reference, type }

从模型采样时使用,规定传给模型的消息结构。可以引用预先构建的轨迹,例如 item.input_trajectory,也可以使用包含 item 命名空间变量引用的模板。

  • InputMessagesTemplate object { template, type }

  • template: array of ChatMessage { content, role } or EvalMessageObject { content, role, type }

构成提示词或上下文的聊天消息列表,可以包含对 item 命名空间的变量引用,例如 {{item.name}}。

  • ChatMessage object { content, role }

  • content: string

消息内容。

  • role: string

消息角色,例如 "system"、"assistant"、"user"。

  • EvalMessageObject object { content, role, type }

输入模型的消息,其角色表示指令遵循的 优先级。以 developer 或 system 角色给出的指令 优先于 user 角色给出的指令。 assistant 角色的消息被视为模型在此前 交互中生成的内容。

  • content: string or ResponseInputText or OutputText { text, type } or 3 more

模型输入,可以包含模板字符串。支持输入文本、输出文本、输入图像和输入音频,可提供单个条目或条目数组。

  • TextInput = string

输入模型的文本。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • OutputText object { text, type }

模型输出的文本。

  • text: string

模型输出的文本内容。

  • type: "output_text"

输出文本类型,固定为 output_text。

  • "output_text"

  • InputImage object { image_url, type, detail }

用于 EvalItem 内容数组中的图像输入块。

  • image_url: string

输入图像的 URL。

format: uri

  • type: "input_image"

输入图像类型,固定为 input_image。

  • "input_image"

  • detail: optional string

发送给模型的图像细节级别,可选 high、low 或 auto,默认为 auto。

  • ResponseInputAudio object { input_audio, type }

输入模型的音频。

  • GraderInputs = array of string or ResponseInputText or OutputText { text, type } or 2 more

输入列表,每项可以是输入文本、输出文本、输入 图像或输入音频对象。

  • role: "user" or "assistant" or "system" or "developer"

输入消息的角色,可选 user、assistant、system 或 developer.

  • "user"

  • "assistant"

  • "system"

  • "developer"

  • type: optional "message"

输入消息类型,固定为 message。

  • "message"

  • type: "template"

输入消息类型,固定为 template。

  • "template"

  • InputMessagesItemReference object { item_reference, type }

  • item_reference: string

对 item 命名空间中变量的引用,例如 "item.name"。

  • type: "item_reference"

输入消息类型,固定为 item_reference。

  • "item_reference"

  • model: optional string

用于生成补全内容的模型名称,例如 "o3-mini"。

  • sampling_params: optional object { max_completion_tokens, reasoning_effort, seed, 4 more }

  • max_completion_tokens: optional integer

生成输出的最大词元数。

  • reasoning_effort: optional ReasoningEffort or null (default: "medium")

限制推理模型的推理强度。当前支持 none、minimal、low、medium、high、xhigh 和 max。 降低推理强度可能加快响应,并减少响应中用于 推理的词元数。并非所有推理模型都支持每个 取值。各模型的支持情况请参阅 推理指南 中的说明。

  • seed: optional integer (default: 42)

采样时用于初始化随机性的种子值。

  • temperature: optional number (default: 1)

较高的 temperature 会增加输出的随机性。

  • text: optional object { format }

模型文本响应的配置选项,可以是纯 文本或结构化 JSON 数据。更多信息:

  • format: optional ResponseFormatTextConfig

指定模型必须输出的格式的对象。

配置 { "type": "json_schema" } 会启用结构化输出, 确保模型遵循你提供的 JSON Schema。更多信息参阅 结构化输出指南。

默认格式为 { "type": "text" },没有额外选项。

不建议用于 gpt-4o 及后续模型:

设为 { "type": "json_object" } 会启用旧版 JSON 模式, 确保模型生成有效的 JSON。对于支持的模型,优先使用 json_schema 格式。

  • ResponseFormatText object { type }

默认响应格式,用于生成文本响应。

  • ResponseFormatTextJSONSchemaConfig object { name, schema, type, 2 more }

JSON Schema 响应格式,用于生成结构化 JSON 响应。 参阅结构化输出。

  • name: string

响应格式的名称,须使用 a-z、A-Z、0-9,或包含 下划线和连字符,最长为 64 个字符。

  • schema: map[unknown]

以 JSON Schema 对象描述的响应格式模式。 JSON Schema 的构建方法参阅此处。

  • type: "json_schema"

定义的响应格式类型,固定为 json_schema。

  • "json_schema"

  • description: optional string

响应格式的用途描述,模型据此 判断如何按该格式响应。

  • strict: optional boolean or null (default: false)

生成输出时是否启用严格模式遵循。 设为 true 时,模型始终严格遵循 schema 字段中定义的模式。strict 为 true 时仅支持 JSON Schema 的子集。更多信息请参阅结构化输出 指南。

  • ResponseFormatJSONObject object { type }

JSON 对象响应格式,是生成 JSON 响应的较早方式。 对于支持的模型,建议使用 json_schema。注意: 须在系统消息或用户消息中指示模型生成 JSON, 模型才会生成 JSON。

  • tools: optional array of Function { name, parameters, strict, 6 more } or FileSearch { type, vector_store_ids, filters, 2 more } or Computer { type } or 13 more

模型生成响应时可以调用的工具数组。你 可以通过 tool_choice 参数指定要使用的工具。

可向模型提供以下两类工具:

  • 内置工具:由 OpenAI 提供,用于扩展 模型能力,例如网页搜索 或文件搜索。更多信息参阅 内置工具。
  • 函数调用(自定义工具):由你定义的函数, 使模型可以调用你自己的代码。更多信息参阅 函数调用。

  • Function object { name, parameters, strict, 6 more }

定义模型可以选择调用的自有代码函数。参阅函数调用。

  • name: string

要调用的函数名称。

  • parameters: map[unknown] or null

描述函数参数的 JSON Schema 对象。

  • strict: boolean or null

是否对此函数工具强制执行严格参数校验。

  • type: "function" (default: "function")

函数工具类型,固定为 function。

  • "function"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

  • "direct"

  • "programmatic"

  • async: optional boolean

  • defer_loading: optional boolean

此函数是否延迟加载并通过工具搜索加载。

  • description: optional string or null

函数描述,模型据此判断是否调用该函数。

  • output_schema: optional map[unknown] or null

描述此函数字符串输出中编码的 JSON 值的 JSON Schema 对象。

  • FileSearch object { type, vector_store_ids, filters, 2 more }

搜索已上传文件中相关内容的工具。参阅文件搜索工具。

  • type: "file_search" (default: "file_search")

文件搜索工具类型,固定为 file_search。

  • "file_search"

  • vector_store_ids: array of string

要搜索的向量存储 ID 列表。

  • filters: optional ComparisonFilter or CompoundFilter or null

要应用的筛选条件。

  • ComparisonFilter object { key, type, value }

使用指定比较运算,将某个属性键与给定值比较的筛选条件。

  • key: string

要与值比较的属性键。

  • type: "eq" or "ne" or "gt" or 5 more (default: "eq")

指定比较运算符:eq、ne、gt、gte、lt、lte、in、nin。

  • eq:等于
  • ne:不等于
  • gt:大于
  • gte:大于或等于
  • lt:小于
  • lte:小于或等于
  • in:属于
  • nin:不属于

  • "eq"

  • "ne"

  • "gt"

  • "gte"

  • "lt"

  • "lte"

  • "in"

  • "nin"

  • value: string or number or boolean or array of string or number

用于与属性键比较的值,支持字符串、数字或布尔类型。

  • string

  • number

  • boolean

  • array of string or number

  • string

  • number

  • CompoundFilter object { filters, type }

使用 and 或 or 组合多个筛选条件。

  • filters: array of ComparisonFilter or CompoundFilter

要组合的筛选条件数组,条目可以是 ComparisonFilter 或 CompoundFilter。

  • ComparisonFilter object { key, type, value }

使用指定比较运算,将某个属性键与给定值比较的筛选条件。

  • CompoundFilter object { filters, type }

使用 and 或 or 组合多个筛选条件。

  • type: "and" or "or"

运算类型:and 或 or。

  • "and"

  • "or"

  • max_num_results: optional integer

返回结果数量上限,须介于 1–50 之间,含边界。

  • ranking_options: optional object { hybrid_search, ranker, score_threshold }

搜索结果的排序选项。

  • hybrid_search: optional object { embedding_weight, text_weight }

启用混合搜索时,控制倒数排名融合如何平衡语义嵌入匹配与稀疏关键词匹配的权重。

  • embedding_weight: number

嵌入在倒数排名融合中的权重。

  • text_weight: number

文本在倒数排名融合中的权重。

  • ranker: optional "auto" or "default-2024-11-15"

文件搜索所用的排序器。

  • "auto"

  • "default-2024-11-15"

  • score_threshold: optional number

文件搜索的分数阈值,为 0–1 之间的数字。越接近 1,越倾向于只返回最相关的结果,但返回数量可能减少。

  • Computer object { type }

控制虚拟计算机的工具。参阅计算机工具。

  • type: "computer" (default: "computer")

计算机工具类型,固定为 computer。

  • "computer"

  • ComputerUsePreview object { display_height, display_width, environment, type }

控制虚拟计算机的工具。参阅计算机工具。

  • display_height: integer

计算机显示区域的高度。

  • display_width: integer

计算机显示区域的宽度。

  • environment: "windows" or "mac" or "linux" or 2 more

要控制的计算机环境类型。

  • "windows"

  • "mac"

  • "linux"

  • "ubuntu"

  • "browser"

  • type: "computer_use_preview" (default: "computer_use_preview")

计算机使用工具类型,固定为 computer_use_preview。

  • "computer_use_preview"

  • WebSearch object { type, external_web_access, filters, 2 more }

在互联网上搜索与提示词相关的信息来源。参阅 网络搜索工具时。

  • type: "web_search" or "web_search_2025_08_26" (default: "web_search")

网页搜索工具类型,可选 web_search 或 web_search_2025_08_26。

  • "web_search"

  • "web_search_2025_08_26"

  • external_web_access: optional boolean (default: true)

是否允许网页搜索实时访问互联网。省略时默认为 true。设为 false 时,网页搜索工具以离线或仅缓存模式运行,不会抓取新的外部内容。

  • filters: optional object { allowed_domains } or null

搜索的筛选条件。

  • allowed_domains: optional array of string or null (default: [])

搜索允许的域名。未提供时允许所有域名。 也允许访问所提供域名的子域名。

示例:["pubmed.ncbi.nlm.nih.gov"]

  • search_context_size: optional "low" or "medium" or "high" (default: "medium")

对搜索占用上下文窗口空间大小的总体指导,可选 low、medium 或 high,默认为 medium。

  • "low"

  • "medium"

  • "high"

  • user_location: optional object { city, country, region, 2 more } or null

用户的大致位置。省略或设为 null 时,默认为 美国。若要避免此默认值,可传入不包含位置字段的 {"type": "approximate"}。 若要本地化结果,须提供相应位置字段。

  • city: optional string or null

用户所在城市的自由文本,例如 San Francisco。

  • country: optional string or null

用户所在国家/地区的两字母 ISO 代码,例如 US。

  • region: optional string or null

用户所在地区的自由文本,例如 California。

  • timezone: optional string or null

用户所在的 IANA 时区,例如 America/Los_Angeles。

  • type: optional "approximate" (default: "approximate")

位置估算类型,固定为 approximate。

  • "approximate"

  • Mcp object { server_label, type, allowed_callers, 9 more }

通过远程模型上下文协议(MCP)服务器, 向模型提供额外工具。了解 MCP。

  • server_label: string

此 MCP 服务器的标签,用于在工具调用中标识服务器。

  • type: "mcp"

MCP 工具类型,固定为 mcp。

  • "mcp"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • allowed_tools: optional array of string or McpToolFilter { read_only, tool_names } or null

允许的工具名称列表或筛选对象。

  • McpAllowedTools = array of string

允许的工具名称组成的字符串数组。

  • McpToolFilter object { read_only, tool_names }

用于指定允许哪些工具的筛选对象。

  • read_only: optional boolean

表示工具会修改数据还是只读。如果 MCP 服务器标注了 readOnlyHint, 就会与此筛选条件匹配。

  • tool_names: optional array of string

允许的工具名称列表。

  • authorization: optional string

可用于远程 MCP 服务器的 OAuth 访问令牌,既可 配合自定义 MCP 服务器 URL,也可配合服务连接器。你的应用 须处理 OAuth 授权流程,并在此提供令牌。

  • connector_id: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 5 more

服务连接器的标识,例如 ChatGPT 中提供的连接器。须提供 server_url、connector_id 或 tunnel_id 中的一项。更多 服务连接器信息参阅此处。

对于 2026 年 9 月 1 日之后发布的模型,此字段已弃用。 使用 server_url 连接远程 MCP 服务器,或使用 tunnel_id 通过安全 MCP 隧道连接。

当前支持的 connector_id 值如下:

  • Dropbox:connector_dropbox
  • Gmail:connector_gmail
  • Google 日历:connector_googlecalendar
  • Google 云端硬盘:connector_googledrive
  • Microsoft Teams:connector_microsoftteams
  • Outlook 日历:connector_outlookcalendar
  • Outlook 邮箱:connector_outlookemail
  • SharePoint:connector_sharepoint

  • "connector_dropbox"

  • "connector_gmail"

  • "connector_googlecalendar"

  • "connector_googledrive"

  • "connector_microsoftteams"

  • "connector_outlookcalendar"

  • "connector_outlookemail"

  • "connector_sharepoint"

  • defer_loading: optional boolean

此 MCP 工具是否延迟加载并通过工具搜索发现。

  • headers: optional map[string] or null

可选的发送给 MCP 服务器的 HTTP 请求头,用于认证 或其他用途。

  • require_approval: optional McpToolApprovalFilter { always, never } or "always" or "never" or null (default: "always")

指定 MCP 服务器的哪些工具需要批准。

  • McpToolApprovalFilter object { always, never }

指定 MCP 服务器的哪些工具需要批准。可以是 always、never,或与需要批准的工具关联的 筛选对象。

  • always: optional object { read_only, tool_names }

用于指定允许哪些工具的筛选对象。

  • read_only: optional boolean

表示工具会修改数据还是只读。如果 MCP 服务器标注了 readOnlyHint, 就会与此筛选条件匹配。

  • tool_names: optional array of string

允许的工具名称列表。

  • never: optional object { read_only, tool_names }

用于指定允许哪些工具的筛选对象。

  • read_only: optional boolean

表示工具会修改数据还是只读。如果 MCP 服务器标注了 readOnlyHint, 就会与此筛选条件匹配。

  • tool_names: optional array of string

允许的工具名称列表。

  • McpToolApprovalSetting = "always" or "never"

为所有工具指定统一的批准策略,可选 always 或 never。设为 always 时,所有工具均需要批准; 设为 never 时,所有工具均不需要批准。

  • "always"

  • "never"

  • server_description: optional string

MCP 服务器的可选描述,用于提供更多上下文。

  • server_url: optional string

MCP 服务器的 URL。须提供 server_url、connector_id 或 tunnel_id 中的一项。

format: uri

  • tunnel_id: optional string

用来替代直接服务器 URL 的安全 MCP 隧道 ID。须提供 server_url、connector_id 或 tunnel_id 中的一项。

pattern: ^tunnel_[a-z0-9]{32}$

  • CodeInterpreter object { container, type, allowed_callers }

运行 Python 代码以帮助生成提示词响应的工具。

  • container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }

代码解释器容器,可以是容器 ID,也可以是 指定代码可用的已上传文件 ID 的对象,同时可提供 可选的 memory_limit 设置。

  • string

容器 ID。

  • CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }

代码解释器容器配置,可以指定运行代码时所处理的文件 ID。

  • type: "auto" (default: "auto")

固定为 auto。

  • "auto"

  • file_ids: optional array of string

可选的已上传文件列表,这些文件将提供给代码使用。

maxItems: 50

  • memory_limit: optional "1g" or "4g" or "16g" or "64g" or null

代码解释器容器的内存上限。

  • "1g"

  • "4g"

  • "16g"

  • "64g"

  • network_policy: optional ContainerNetworkPolicyDisabled or ContainerNetworkPolicyAllowlist

容器的网络访问策略。

  • ContainerNetworkPolicyDisabled object { type }

  • type: "disabled" (default: "disabled")

禁用出站网络访问,固定为 disabled。

  • "disabled"

  • ContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }

  • allowed_domains: array of string

type 为 allowlist 时允许访问的域名列表。

minItems: 1

  • type: "allowlist" (default: "allowlist")

仅允许对指定域名发起出站网络访问,固定为 allowlist。

  • "allowlist"

  • domain_secrets: optional array of ContainerNetworkPolicyDomainSecret

可选的仅用于允许访问域名的域名级密钥。

minItems: 1

  • domain: string

密钥关联的域名。

minLength: 1

  • name: string

要为该域名注入的密钥名称。

minLength: 1

  • value: string

要为该域名注入的密钥值。

minLength: 1, maxLength: 10485760

  • type: "code_interpreter"

代码解释器工具类型,固定为 code_interpreter。

  • "code_interpreter"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • ProgrammaticToolCalling object { type }

  • type: "programmatic_tool_calling" (default: "programmatic_tool_calling")

工具类型,固定为 programmatic_tool_calling。

  • "programmatic_tool_calling"

  • ImageGeneration object { type, action, background, 13 more }

使用 GPT 图像模型生成图像的工具。

  • type: "image_generation"

图像生成工具类型,固定为 image_generation。

  • "image_generation"

  • action: optional "generate" or "edit" or "auto"

生成新图像还是编辑已有图像,默认为 auto。

  • "generate"

  • "edit"

  • "auto"

  • background: optional "transparent" or "opaque" or "auto" (default: "auto")

生成图像的背景,可选 transparent、opaque, 或 auto。gpt-image-2.5-sunburst 和 gpt-image-2.5-flare,包括 对应的 2026-09-08 快照,支持 opaque 和 transparent 背景。受支持的 GPT Image 模型可以使用透明 背景。对于 gpt-image-2 和 gpt-image-2-2026-04-21,此功能处于 预览阶段。使用 transparent 时,须将输出格式设为 png 或 webp。 默认为 auto。

  • "transparent"

  • "opaque"

  • "auto"

  • complexity: optional "low" or "medium" or "high"

用于规划图像的计算投入,与渲染质量分开设置。 覆盖外层响应用于图像生成的 reasoning.effort。 省略时,继承外层受支持的推理强度,或使用 图像模型配置的默认值。 对于 SVG 输出,此项控制参考图像,而不是 SVG 生成模型的 推理。

  • "low"

  • "medium"

  • "high"

  • frame_count: optional integer (default: 9)

GIF 帧数,要求 output_format 为 gif,默认为 9。

minimum: 2, maximum: 16

  • frame_duration_ms: optional integer (default: 200)

每个 GIF 帧的时长,单位为毫秒,取整到 10 毫秒。 要求 output_format 为 gif,默认为 200。

minimum: 20, maximum: 2000

  • input_fidelity: optional "high" or "low" or null

控制模型为匹配输入图像风格和特征(尤其是面部特征)投入的程度。gpt-image-1.5 支持 high 和 low,gpt-image-1-mini 仅支持 low。使用 gpt-image-2 时应省略此参数。支持该参数的模型默认为 low。

  • "high"

  • "low"

  • input_image_mask: optional object { file_id, image_url }

可选的局部重绘蒙版,包含 image_url (可选字符串)和 file_id(可选字符串)。

  • file_id: optional string

蒙版图像的文件 ID。

  • image_url: optional string

采用 Base64 编码的蒙版图像。

  • model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-2" or 9 more

用于图像生成的模型,可选 gpt-image-1-mini、 gpt-image-1.5, gpt-image-2, gpt-image-2-2026-04-21、gpt-image-2.5-sunburst、 gpt-image-2.5-sunburst-2026-09-08、gpt-image-2.5-flare、 gpt-image-2.5-flare-2026-09-08, gpt-image-2.6-sunburst, gpt-image-2.6-flare 或 chatgpt-image-latest。默认值: gpt-image-2.6-sunburst.

gpt-image-1 已于 2026 年 10 月 23 日停用,请使用 gpt-image-2.5-sunburst 或 gpt-image-2.5-flare。

  • string

  • "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-2" or 9 more

用于图像生成的模型,可选 gpt-image-1-mini、 gpt-image-1.5, gpt-image-2, gpt-image-2-2026-04-21、gpt-image-2.5-sunburst、 gpt-image-2.5-sunburst-2026-09-08、gpt-image-2.5-flare、 gpt-image-2.5-flare-2026-09-08, gpt-image-2.6-sunburst, gpt-image-2.6-flare 或 chatgpt-image-latest。默认值: gpt-image-2.6-sunburst.

gpt-image-1 已于 2026 年 10 月 23 日停用,请使用 gpt-image-2.5-sunburst 或 gpt-image-2.5-flare。

  • "gpt-image-1"

  • "gpt-image-1-mini"

  • "gpt-image-2"

  • "gpt-image-2-2026-04-21"

  • "gpt-image-2.5-sunburst"

  • "gpt-image-2.5-sunburst-2026-09-08"

  • "gpt-image-2.5-flare"

  • "gpt-image-2.5-flare-2026-09-08"

  • "gpt-image-2.6-sunburst"

  • "gpt-image-2.6-flare"

  • "gpt-image-1.5"

  • "chatgpt-image-latest"

  • moderation: optional "auto" or "low" (default: "auto")

生成图像的审核级别,默认为 auto。

  • "auto"

  • "low"

  • output_compression: optional integer (default: 100)

输出图像的压缩级别,默认为 100。

minimum: 0, maximum: 100

  • output_format: optional "png" or "webp" or "jpeg" or 2 more (default: "png")

输出图像格式,可选 png、webp、jpeg、 gif 或 svg,默认为 png。GIF 和 SVG 输出要求模型 支持所选格式。GIF 输出不支持 部分图像流式传输,即 partial_images 大于 0, 也不支持 input_image_mask 或自定义 output_compression。 GIF 输出仍可以流式发送 Responses 生命周期事件。

  • "png"

  • "webp"

  • "jpeg"

  • "gif"

  • "svg"

  • partial_images: optional integer (default: 0)

流式模式中生成的部分图像数量,范围为 0(默认值)到 3。

minimum: 0, maximum: 3

  • quality: optional "low" or "medium" or "high" or 3 more (default: "auto")

生成图像的质量。GPT 图像模型支持 low、 medium 和 high。gpt-image-2.5-sunburst 和 gpt-image-2.5-flare, 包括对应的 2026-09-08 快照,还支持 xhigh 和 max。 默认为 auto。

  • "low"

  • "medium"

  • "high"

  • "xhigh"

  • "max"

  • "auto"

  • size: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "auto" (default: "auto")

生成图像的尺寸。gpt-image-2、gpt-image-2-2026-04-21、gpt-image-2.5-sunburst、gpt-image-2.5-sunburst-2026-09-08、gpt-image-2.5-flare 和 gpt-image-2.5-flare-2026-09-08 支持以 WIDTHxHEIGHT 字符串指定任意分辨率,例如 1536x864。宽和高均须能被 16 整除,宽高比须在 1:3 至 3:1 之间。高于 2560x1440 的分辨率属于实验功能,支持的最高分辨率为 3840x2160。尺寸还须符合模型当前的像素数与边长限制。GPT Image 模型支持标准尺寸 1024x1024、1536x1024 和 1024x1536;允许自动尺寸的模型支持 auto。

  • string

  • "1024x1024" or "1024x1536" or "1536x1024" or "auto"

生成图像的尺寸。gpt-image-2、gpt-image-2-2026-04-21、gpt-image-2.5-sunburst、gpt-image-2.5-sunburst-2026-09-08、gpt-image-2.5-flare 和 gpt-image-2.5-flare-2026-09-08 支持以 WIDTHxHEIGHT 字符串指定任意分辨率,例如 1536x864。宽和高均须能被 16 整除,宽高比须在 1:3 至 3:1 之间。高于 2560x1440 的分辨率属于实验功能,支持的最高分辨率为 3840x2160。尺寸还须符合模型当前的像素数与边长限制。GPT Image 模型支持标准尺寸 1024x1024、1536x1024 和 1024x1536;允许自动尺寸的模型支持 auto。

  • "1024x1024"

  • "1024x1536"

  • "1536x1024"

  • "auto"

  • svg: optional object { model, reasoning }

SVG 生成模型的设置,要求 output_format 为 svg。 启用 SVG 模型选择时,省略此对象会使用 外层响应模型。否则使用默认 SVG 生成模型,且 不能显式覆盖模型。

  • model: optional string

minLength: 1

  • reasoning: optional object { effort } or null

SVG 编写的推理强度。省略时,Images 和 Responses 均使用编写模型的默认值。

  • effort: optional "none" or "minimal" or "low" or 4 more

控制模型为此次请求投入的推理强度。

  • "none"

  • "minimal"

  • "low"

  • "medium"

  • "high"

  • "xhigh"

  • "max"

  • LocalShell object { type }

允许模型在本地环境执行 shell 命令的工具。

  • type: "local_shell" (default: "local_shell")

本地 shell 工具类型,固定为 local_shell。

  • "local_shell"

  • Shell object { type, allowed_callers, environment }

允许模型执行 shell 命令的工具。

  • type: "shell" (default: "shell")

shell 工具类型,固定为 shell。

  • "shell"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • environment: optional ContainerAuto or LocalEnvironment or ContainerReference or null

  • ContainerAuto object { type, file_ids, memory_limit, 2 more }

  • type: "container_auto" (default: "container_auto")

为此请求自动创建容器。

  • "container_auto"

  • file_ids: optional array of string

可选的已上传文件列表,这些文件将提供给代码使用。

maxItems: 50

  • memory_limit: optional "1g" or "4g" or "16g" or "64g" or null

容器的内存上限。

  • "1g"

  • "4g"

  • "16g"

  • "64g"

  • network_policy: optional ContainerNetworkPolicyDisabled or ContainerNetworkPolicyAllowlist

容器的网络访问策略。

  • ContainerNetworkPolicyDisabled object { type }

  • ContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }

  • skills: optional array of SkillReference or InlineSkill

可选的技能列表,通过 ID 或内联数据引用技能。

maxItems: 200

  • SkillReference object { skill_id, type, version }

  • skill_id: string

引用的技能 ID。

minLength: 1, maxLength: 64

  • type: "skill_reference" (default: "skill_reference")

引用通过 /v1/skills 接口创建的技能。

  • "skill_reference"

  • version: optional string

可选的技能版本。使用正整数或 'latest',省略时使用默认版本。

  • InlineSkill object { description, name, source, type }

  • description: string

技能描述。

  • name: string

技能名称。

  • source: InlineSkillSource

内联技能载荷。

  • data: string

采用 Base64 编码的技能 ZIP 包。

minLength: 1, maxLength: 70254592

  • media_type: "application/zip" (default: "application/zip")

内联技能载荷的媒体类型,必须为 application/zip。

  • "application/zip"

  • type: "base64" (default: "base64")

内联技能来源的类型,必须为 base64。

  • "base64"

  • type: "inline" (default: "inline")

为此请求定义内联技能。

  • "inline"

  • LocalEnvironment object { type, skills }

  • type: "local" (default: "local")

使用本地计算机环境。

  • "local"

  • skills: optional array of LocalSkill

可选的技能列表。

maxItems: 200

  • description: string

技能描述。

  • name: string

技能名称。

  • path: string

包含该技能的目录路径。

  • ContainerReference object { container_id, type }

  • container_id: string

引用的容器 ID。

  • type: "container_reference" (default: "container_reference")

引用通过 /v1/containers 接口创建的容器。

  • "container_reference"

  • Custom object { name, type, allowed_callers, 4 more }

使用指定格式处理输入的自定义工具。参阅自定义工具。

  • name: string

自定义工具的名称,用于在工具调用中标识它。

  • type: "custom" (default: "custom")

自定义工具类型,固定为 custom。

  • "custom"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • async: optional boolean

工具响应是否可以异步返回,而非在下一次创建响应时立即返回。

  • defer_loading: optional boolean

此工具是否应延迟加载并通过工具搜索发现。

  • description: optional string

自定义工具的可选描述,用于提供更多上下文。

  • format: optional CustomToolInputFormat

自定义工具的输入格式,默认为无约束文本。

  • Text object { type }

无约束的自由文本。

  • type: "text" (default: "text")

无约束文本格式,固定为 text。

  • "text"

  • Grammar object { definition, syntax, type }

用户定义的语法。

  • definition: string

语法定义。

  • syntax: "lark" or "regex"

语法定义的语法类型,可选 lark 或 regex。

  • "lark"

  • "regex"

  • type: "grammar" (default: "grammar")

语法格式,固定为 grammar。

  • "grammar"

  • Namespace object { description, name, tools, type }

将函数工具或自定义工具归入共享命名空间。

  • description: string

展示给模型的命名空间描述。

  • name: string

工具调用使用的命名空间名称,例如 crm。

minLength: 1

  • tools: array of Function { name, type, allowed_callers, 6 more } or Custom { name, type, allowed_callers, 4 more }

此命名空间内可用的函数工具或自定义工具。

minItems: 1

  • Function object { name, type, allowed_callers, 6 more }

  • name: string

pattern: ^[a-zA-Z0-9_-]+$, minLength: 1, maxLength: 128

  • type: "function" (default: "function")

  • "function"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • async: optional boolean

工具响应是否可以异步返回,而非在下一次创建响应时立即返回。

  • defer_loading: optional boolean

此函数是否应延迟加载并通过工具搜索发现。

  • description: optional string or null

  • output_schema: optional map[unknown] or null

描述此函数工具字符串输出中编码的 JSON 值的 JSON Schema,不用于描述内容数组输出。

  • parameters: optional unknown or null

  • strict: optional boolean or null

是否强制执行严格参数校验。省略时,模式兼容的情况下 Responses 会尝试严格校验,否则退回非严格校验。

  • Custom object { name, type, allowed_callers, 4 more }

使用指定格式处理输入的自定义工具。参阅自定义工具。

  • name: string

自定义工具的名称,用于在工具调用中标识它。

  • type: "custom" (default: "custom")

自定义工具类型,固定为 custom。

  • "custom"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • async: optional boolean

工具响应是否可以异步返回,而非在下一次创建响应时立即返回。

  • defer_loading: optional boolean

此工具是否应延迟加载并通过工具搜索发现。

  • description: optional string

自定义工具的可选描述,用于提供更多上下文。

  • format: optional CustomToolInputFormat

自定义工具的输入格式,默认为无约束文本。

  • type: "namespace" (default: "namespace")

工具类型,固定为 namespace。

  • "namespace"

  • ToolSearch object { type, description, execution, parameters }

用于延迟加载工具的托管工具搜索或自带工具(BYOT)搜索配置。

  • type: "tool_search" (default: "tool_search")

工具类型,固定为 tool_search。

  • "tool_search"

  • description: optional string or null

客户端执行的工具搜索工具展示给模型的描述。

  • execution: optional "server" or "client"

工具搜索由服务端还是客户端执行。

  • "server"

  • "client"

  • parameters: optional unknown or null

客户端执行的工具搜索工具的参数模式。

  • WebSearchPreview object { type, search_content_types, search_context_size, user_location }

搜索网页以获取可用于响应的相关结果的工具。参阅网页搜索工具。

  • type: "web_search_preview" or "web_search_preview_2025_03_11" (default: "web_search_preview")

网页搜索工具类型,可选 web_search_preview 或 web_search_preview_2025_03_11。

  • "web_search_preview"

  • "web_search_preview_2025_03_11"

  • search_content_types: optional array of "text" or "image"

  • "text"

  • "image"

  • search_context_size: optional "low" or "medium" or "high"

对搜索占用上下文窗口空间大小的总体指导,可选 low、medium 或 high,默认为 medium。

  • "low"

  • "medium"

  • "high"

  • user_location: optional object { type, city, country, 2 more } or null

用户的大致位置。省略或设为 null 时默认为美国。若要避免此默认值,可传入不包含位置字段的 {"type": "approximate"}。若要本地化结果,须提供相应位置字段。

  • type: "approximate" (default: "approximate")

位置估算类型,固定为 approximate。

  • "approximate"

  • city: optional string or null

用户所在城市的自由文本,例如 San Francisco。

  • country: optional string or null

用户所在国家/地区的两字母 ISO 代码,例如 US。

  • region: optional string or null

用户所在地区的自由文本,例如 California。

  • timezone: optional string or null

用户所在的 IANA 时区,例如 America/Los_Angeles。

  • ApplyPatch object { type, allowed_callers }

允许助手使用统一差异格式创建、删除或更新文件。

  • type: "apply_patch" (default: "apply_patch")

工具类型,固定为 apply_patch。

  • "apply_patch"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • top_p: optional number (default: 1)

用于核采样的参数,是 temperature 的替代方案;1.0 表示包含所有词元。

  • error: EvalAPIError or null

表示 Eval API 错误响应的对象。

  • code: string

错误代码。

  • message: string

错误消息。

  • eval_id: string

关联评测的标识。

  • metadata: Metadata or null

可附加到对象的元数据,最多包含 16 组键值对,可 以结构化方式存储对象的额外信息, 并通过 API 或控制台查询对象。

键为最多 64 个字符的字符串,值为 最多 512 个字符的字符串。

  • model: string or null

被评测的模型,如适用。

  • name: string or null

评测运行名称。

  • object: "eval.run" (default: "eval.run")

对象类型,固定为 "eval.run"。

  • "eval.run"

  • per_model_usage: array of object { cached_tokens, completion_tokens, invocation_count, 3 more } or null

评测运行期间各模型的用量统计。

  • cached_tokens: integer

从缓存读取的词元数。

  • completion_tokens: integer

生成的补全词元数。

  • invocation_count: integer

调用次数。

  • model_name: string

模型名称。

  • prompt_tokens: integer

使用的提示词词元数。

  • total_tokens: integer

使用的总词元数。

  • per_testing_criteria_results: array of object { failed, passed, testing_criteria } or null

评测运行中各测试标准的结果。

  • failed: integer

未通过此标准的测试数量。

  • passed: integer

通过此标准的测试数量。

  • testing_criteria: string

测试标准的描述。

  • report_url: string

在控制台界面中呈现评测运行报告的 URL。

format: uri

  • result_counts: object { errored, failed, passed, total }

汇总评测运行结果的计数器。

  • errored: integer

因错误而失败的输出条目数量。

  • failed: integer

未通过评测的输出条目数量。

  • passed: integer

通过评测的输出条目数量。

  • total: integer

已执行的输出条目总数。

  • status: string

评测运行状态。

示例

## 设置 OPENAI_API_KEY,并将评测 ID 和运行 ID 替换为实际值。
curl https://api.openai.com/v1/evals/$EVAL_ID/runs \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $OPENAI_API_KEY" \
    -d '{
          "data_source": {
            "source": {
              "content": [
                {
                  "item": {
                    "foo": "bar"
                  }
                }
              ],
              "type": "file_content"
            },
            "type": "jsonl"
          }
        }'

201:示例

{
  "id": "id",
  "created_at": 0,
  "data_source": {
    "source": {
      "content": [
        {
          "item": {
            "foo": "bar"
          },
          "sample": {
            "foo": "bar"
          }
        }
      ],
      "type": "file_content"
    },
    "type": "jsonl"
  },
  "error": {
    "code": "code",
    "message": "message"
  },
  "eval_id": "eval_id",
  "metadata": {
    "foo": "string"
  },
  "model": "model",
  "name": "name",
  "object": "eval.run",
  "per_model_usage": [
    {
      "cached_tokens": 0,
      "completion_tokens": 0,
      "invocation_count": 0,
      "model_name": "model_name",
      "prompt_tokens": 0,
      "total_tokens": 0
    }
  ],
  "per_testing_criteria_results": [
    {
      "failed": 0,
      "passed": 0,
      "testing_criteria": "testing_criteria"
    }
  ],
  "report_url": "https://example.com",
  "result_counts": {
    "errored": 0,
    "failed": 0,
    "passed": 0,
    "total": 0
  },
  "status": "status"
}

示例

## 设置 OPENAI_API_KEY,并将评测 ID 和运行 ID 替换为实际值。
curl https://api.openai.com/v1/evals/eval_67e579652b548190aaa83ada4b125f47/runs \
  -X POST \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"gpt-6-astra","data_source":{"type":"completions","input_messages":{"type":"template","template":[{"role":"developer","content":"将给定新闻标题归入以下主题之一:Technology(科技)、Markets(市场)、World(国际)、Business(商业)或 Sports(体育)。\n\n# 步骤\n\n1. 分析新闻标题的内容,理解其主要关注点。\n2. 提取主题,找出关键线索或关键词。\n3. 根据这些线索,从 Technology、Markets、World、Business、Sports 五个选项中选择最合适的类别。\n4. 每个标题只能选择一个类别。\n\n# 输出格式\n\n仅返回所选类别的一个英文单词,例如:\"Technology\"、\"Markets\"、\"World\"、\"Business\" 或 \"Sports\"。\n\n# 示例\n\n**输入**:\"苹果发布搭载先进 AI 功能的新款 iPhone\"  \n**输出**:\"Technology\"\n\n**输入**:\"投资者等待央行决议,全球股市涨跌互现\"  \n**输出**:\"Markets\"\n\n**输入**:\"乌克兰战争:谈判进展最新消息\"  \n**输出**:\"World\"\n\n**输入**:\"微软洽谈以 20 亿美元收购游戏公司\"  \n**输出**:\"Business\"\n\n**输入**:\"曼联赢得英超足球比赛\"  \n**输出**:\"Sports\" \n\n# 注意\n\n- 如果标题似乎符合多个类别,选择最主要的主题。\n- “股票”“公司收购”“比赛”等关键词或短语,以及科技品牌,都可以作为分类线索。\n"} , {"role":"user","content":"{{item.input}}"}]} ,"sampling_params":{"max_completions_tokens":2048},"model":"gpt-6-astra","source":{"type":"file_content","content":[{"item":{"input":"科技公司推出先进的人工智能平台","ground_truth":"Technology"}}]}}}'

响应示例

{
  "object": "eval.run",
  "id": "evalrun_67e57965b480819094274e3a32235e4c",
  "eval_id": "eval_67e579652b548190aaa83ada4b125f47",
  "report_url": "https://platform.openai.com/evaluations/eval_67e579652b548190aaa83ada4b125f47&run_id=evalrun_67e57965b480819094274e3a32235e4c",
  "status": "queued",
  "model": "gpt-6-astra",
  "name": "gpt-6-astra",
  "created_at": 1743092069,
  "result_counts": {
    "total": 0,
    "errored": 0,
    "failed": 0,
    "passed": 0
  },
  "per_model_usage": null,
  "per_testing_criteria_results": null,
  "data_source": {
    "type": "completions",
    "source": {
      "type": "file_content",
      "content": [
        {
          "item": {
            "input": "科技公司推出先进的人工智能平台",
            "ground_truth": "Technology"
          }
        }
      ]
    },
    "input_messages": {
      "type": "template",
      "template": [
        {
          "type": "message",
          "role": "developer",
          "content": {
            "type": "input_text",
            "text": "将给定新闻标题归入以下主题之一:Technology(科技)、Markets(市场)、World(国际)、Business(商业)或 Sports(体育)。\n\n# 步骤\n\n1. 分析新闻标题的内容,理解其主要关注点。\n2. 提取主题,找出关键线索或关键词。\n3. 根据这些线索,从 Technology、Markets、World、Business、Sports 五个选项中选择最合适的类别。\n4. 每个标题只能选择一个类别。\n\n# 输出格式\n\n仅返回所选类别的一个英文单词,例如:\"Technology\"、\"Markets\"、\"World\"、\"Business\" 或 \"Sports\"。\n\n# 示例\n\n**输入**:\"苹果发布搭载先进 AI 功能的新款 iPhone\"  \n**输出**:\"Technology\"\n\n**输入**:\"投资者等待央行决议,全球股市涨跌互现\"  \n**输出**:\"Markets\"\n\n**输入**:\"乌克兰战争:谈判进展最新消息\"  \n**输出**:\"World\"\n\n**输入**:\"微软洽谈以 20 亿美元收购游戏公司\"  \n**输出**:\"Business\"\n\n**输入**:\"曼联赢得英超足球比赛\"  \n**输出**:\"Sports\" \n\n# 注意\n\n- 如果标题似乎符合多个类别,选择最主要的主题。\n- “股票”“公司收购”“比赛”等关键词或短语,以及科技品牌,都可以作为分类线索。\n"
          }
        },
        {
          "type": "message",
          "role": "user",
          "content": {
            "type": "input_text",
            "text": "{{item.input}}"
          }
        }
      ]
    },
    "model": "gpt-6-astra",
    "sampling_params": {
      "max_completions_tokens": 2048
    }
  },
  "error": null,
  "metadata": {}
}

删除评测运行

delete /evals/{eval_id}/runs/{run_id}

删除评测运行。

路径参数

  • eval_id: string

要删除其运行的评测的 ID。

  • run_id: string

要删除的运行的 ID。

返回值

  • deleted: optional boolean

  • object: optional string

  • run_id: optional string

示例

## 设置 OPENAI_API_KEY,并将评测 ID 和运行 ID 替换为实际值。
curl https://api.openai.com/v1/evals/$EVAL_ID/runs/$RUN_ID \
    -X DELETE \
    -H "Authorization: Bearer $OPENAI_API_KEY"

200 响应示例

{
  "deleted": true,
  "object": "eval.run.deleted",
  "run_id": "evalrun_677469f564d48190807532a852da3afb"
}

示例

## 设置 OPENAI_API_KEY,并将评测 ID 和运行 ID 替换为实际值。
curl https://api.openai.com/v1/evals/eval_123abc/runs/evalrun_abc456 \
  -X DELETE \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json"

响应示例

{
  "object": "eval.run.deleted",
  "deleted": true,
  "run_id": "evalrun_abc456"
}

获取评测运行列表

get /evals/{eval_id}/runs

获取某个评测的运行列表。

路径参数

  • eval_id: string

要获取其运行列表的评测的 ID。

查询参数

  • after: optional string

上一次分页请求中的最后一个运行的标识。

  • limit: optional integer (default: 20)

要获取的运行数量。

  • order: optional "asc" or "desc" (default: "asc")

按时间戳对运行排序,使用 asc 升序或 desc 降序,默认为 asc。

  • "asc"

  • "desc"

  • status: optional "queued" or "in_progress" or "completed" or 2 more

按状态筛选运行,可选 queued、in_progress、failed、completed 或 canceled。

  • "queued"

  • "in_progress"

  • "completed"

  • "canceled"

  • "failed"

返回值

  • data: array of object { id, created_at, data_source, 11 more }

评测运行对象数组。

  • id: string

评测运行的唯一标识。

  • created_at: integer

评测运行创建时的 Unix 时间戳,单位为秒。

format: unixtime

  • data_source: CreateEvalJSONLRunDataSource or CreateEvalCompletionsRunDataSource or ResponsesRunDataSource { source, type, input_messages, 2 more }

本次运行的数据源信息。

  • CreateEvalJSONLRunDataSource object { source, type }

JsonlRunDataSource 对象,指定与该评测匹配的 JSONL 文件。

  • source: EvalJSONLFileContentSource { content, type } or EvalJSONLFileIDSource { id, type }

决定数据源中 item 命名空间的内容。

  • EvalJSONLFileContentSource object { content, type }

  • content: array of object { item, sample }

JSONL 文件的内容。

  • item: map[unknown]

  • sample: optional map[unknown]

  • type: "file_content" (default: "file_content")

JSONL 来源的类型,固定为 file_content。

  • "file_content"

  • EvalJSONLFileIDSource object { id, type }

  • id: string

文件标识。

  • type: "file_id" (default: "file_id")

JSONL 来源的类型,固定为 file_id。

  • "file_id"

  • type: "jsonl" (default: "jsonl")

数据源类型,固定为 jsonl。

  • "jsonl"

  • CreateEvalCompletionsRunDataSource object { source, type, input_messages, 2 more }

描述模型采样配置的 CompletionsRunDataSource 对象。

  • source: EvalJSONLFileContentSource { content, type } or EvalJSONLFileIDSource { id, type } or StoredCompletionsRunDataSource { type, created_after, created_before, 3 more }

决定本次运行数据源中 item 命名空间的内容。

  • EvalJSONLFileContentSource object { content, type }

  • content: array of object { item, sample }

JSONL 文件的内容。

  • item: map[unknown]

  • sample: optional map[unknown]

  • type: "file_content" (default: "file_content")

JSONL 来源的类型,固定为 file_content。

  • "file_content"

  • EvalJSONLFileIDSource object { id, type }

  • id: string

文件标识。

  • type: "file_id" (default: "file_id")

JSONL 来源的类型,固定为 file_id。

  • "file_id"

  • StoredCompletionsRunDataSource object { type, created_after, created_before, 3 more }

描述一组筛选条件的 StoredCompletionsRunDataSource 配置。

  • type: "stored_completions" (default: "stored_completions")

来源类型,固定为 stored_completions。

  • "stored_completions"

  • created_after: optional integer or null

可选的 Unix 时间戳,用于筛选在此时间之后创建的条目。

  • created_before: optional integer or null

可选的 Unix 时间戳,用于筛选在此时间之前创建的条目。

  • limit: optional integer or null

可选的返回条目数量上限。

  • metadata: optional Metadata or null

可附加到对象的元数据,最多包含 16 组键值对,可 以结构化方式存储对象的额外信息, 并通过 API 或控制台查询对象。

键为最多 64 个字符的字符串,值为 最多 512 个字符的字符串。

  • model: optional string or null

可选的模型筛选条件,例如 'gpt-6-astra'。

  • type: "completions" (default: "completions")

运行数据源类型,固定为 completions。

  • "completions"

  • input_messages: optional TemplateInputMessages { template, type } or ItemReferenceInputMessages { item_reference, type }

从模型采样时使用,规定传给模型的消息结构。可以引用预先构建的轨迹,例如 item.input_trajectory,也可以使用包含 item 命名空间变量引用的模板。

  • TemplateInputMessages object { template, type }

  • template: array of EasyInputMessage or EvalMessageObject { content, role, type }

构成提示词或上下文的聊天消息列表,可以包含对 item 命名空间的变量引用,例如 {{item.name}}。

  • EasyInputMessage object { content, role, phase, type }

输入模型的消息,其角色表示指令遵循的 优先级。以 developer 或 system 角色给出的指令 优先于 user 角色给出的指令。 assistant 角色的消息被视为模型在此前 交互中生成的内容。

  • content: string or ResponseInputMessageContentList

用于生成响应的文本、图像或音频输入。 也可以包含此前的助手响应。

  • TextInput = string

输入模型的文本。

  • ResponseInputMessageContentList = array of ResponseInputContent

输入模型的一个或多个条目的列表,可以包含不同 内容类型。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • text: string

输入模型的文本。

  • type: "input_text" (default: "input_text")

输入条目类型,固定为 input_text。

  • "input_text"

  • prompt_cache_breakpoint: optional object { mode, ttl }

标记可复用提示词前缀的精确结束位置。省略 ttl 时,断点继承请求中的 prompt_cache_options.ttl;该边界不会按词元块取整。

  • mode: "explicit" (default: "explicit")

断点模式,固定为 explicit。

  • "explicit"

  • ttl: optional "30m" or "12h"

此缓存断点的最短存续时间,默认为请求的 TTL。

  • "30m"

  • "12h"

  • ResponseInputImage object { detail, type, file_id, 2 more }

输入模型的图像。参阅图像输入。

  • detail: ImageDetail

发送给模型的图像细节级别,可选 high、low、auto 或 original,默认为 auto。

  • "low"

  • "high"

  • "auto"

  • "original"

  • type: "input_image" (default: "input_image")

输入条目类型,固定为 input_image。

  • "input_image"

  • file_id: optional string or null

要发送给模型的文件 ID。

  • image_url: optional string or null

要发送给模型的图像 URL,可以是完整 URL,或包含 Base64 编码图像的 data URL。

format: uri

  • prompt_cache_breakpoint: optional object { mode, ttl }

标记可复用提示词前缀的精确结束位置。省略 ttl 时,断点继承请求中的 prompt_cache_options.ttl;该边界不会按词元块取整。

  • mode: "explicit" (default: "explicit")

断点模式,固定为 explicit。

  • "explicit"

  • ttl: optional "30m" or "12h"

此缓存断点的最短存续时间,默认为请求的 TTL。

  • "30m"

  • "12h"

  • ResponseInputFile object { type, detail, file_data, 4 more }

输入模型的文件。

  • type: "input_file" (default: "input_file")

输入条目类型,固定为 input_file。

  • "input_file"

  • detail: optional "auto" or "low" or "high"

发送给模型的文件细节级别。使用 auto 由系统选择;对于 GPT-5.6 及后续模型,auto 使用高质量渲染,可能增加输入词元用量。使用 low 进行成本较低的渲染,或使用 high 以更高质量渲染文件。默认为 auto。

  • "auto"

  • "low"

  • "high"

  • file_data: optional string

要发送给模型的文件内容。

  • file_id: optional string or null

要发送给模型的文件 ID。

  • file_url: optional string

要发送给模型的文件 URL。

format: uri

  • filename: optional string

要发送给模型的文件名。

  • prompt_cache_breakpoint: optional object { mode, ttl }

标记可复用提示词前缀的精确结束位置。省略 ttl 时,断点继承请求中的 prompt_cache_options.ttl;该边界不会按词元块取整。

  • mode: "explicit" (default: "explicit")

断点模式,固定为 explicit。

  • "explicit"

  • ttl: optional "30m" or "12h"

此缓存断点的最短存续时间,默认为请求的 TTL。

  • "30m"

  • "12h"

  • role: "user" or "assistant" or "system" or "developer"

输入消息的角色,可选 user、assistant、system 或 developer.

  • "user"

  • "assistant"

  • "system"

  • "developer"

  • phase: optional "commentary" or "final_answer" or null

将 assistant 消息标记为中间说明(commentary)或最终答案(final_answer)。 对于 gpt-5.3-codex 及后续此类模型,发送后续请求时,须保留并重新发送 所有助手消息的 phase;丢弃它可能降低表现。用户消息不使用此字段。

  • "commentary"

  • "final_answer"

  • type: optional "message"

输入消息类型,固定为 message。

  • "message"

  • EvalMessageObject object { content, role, type }

输入模型的消息,其角色表示指令遵循的 优先级。以 developer 或 system 角色给出的指令 优先于 user 角色给出的指令。 assistant 角色的消息被视为模型在此前 交互中生成的内容。

  • content: string or ResponseInputText or OutputText { text, type } or 3 more

模型输入,可以包含模板字符串。支持输入文本、输出文本、输入图像和输入音频,可提供单个条目或条目数组。

  • TextInput = string

输入模型的文本。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • OutputText object { text, type }

模型输出的文本。

  • text: string

模型输出的文本内容。

  • type: "output_text"

输出文本类型,固定为 output_text。

  • "output_text"

  • InputImage object { image_url, type, detail }

用于 EvalItem 内容数组中的图像输入块。

  • image_url: string

输入图像的 URL。

format: uri

  • type: "input_image"

输入图像类型,固定为 input_image。

  • "input_image"

  • detail: optional string

发送给模型的图像细节级别,可选 high、low 或 auto,默认为 auto。

  • ResponseInputAudio object { input_audio, type }

输入模型的音频。

  • input_audio: object { data, format }

  • data: string

采用 Base64 编码的音频数据。

  • format: "mp3" or "wav"

音频数据格式,当前支持 mp3 和 wav.

  • "mp3"

  • "wav"

  • type: "input_audio"

输入条目类型,固定为 input_audio。

  • "input_audio"

  • GraderInputs = array of string or ResponseInputText or OutputText { text, type } or 2 more

输入列表,每项可以是输入文本、输出文本、输入 图像或输入音频对象。

  • TextInput = string

输入模型的文本。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • OutputText object { text, type }

模型输出的文本。

  • text: string

模型输出的文本内容。

  • type: "output_text"

输出文本类型,固定为 output_text。

  • "output_text"

  • InputImage object { image_url, type, detail }

用于 EvalItem 内容数组中的图像输入块。

  • image_url: string

输入图像的 URL。

format: uri

  • type: "input_image"

输入图像类型,固定为 input_image。

  • "input_image"

  • detail: optional string

发送给模型的图像细节级别,可选 high、low 或 auto,默认为 auto。

  • ResponseInputAudio object { input_audio, type }

输入模型的音频。

  • role: "user" or "assistant" or "system" or "developer"

输入消息的角色,可选 user、assistant、system 或 developer.

  • "user"

  • "assistant"

  • "system"

  • "developer"

  • type: optional "message"

输入消息类型,固定为 message。

  • "message"

  • type: "template"

输入消息类型,固定为 template。

  • "template"

  • ItemReferenceInputMessages object { item_reference, type }

  • item_reference: string

对 item 命名空间中变量的引用,例如 "item.input_trajectory"。

  • type: "item_reference"

输入消息类型,固定为 item_reference。

  • "item_reference"

  • model: optional string

用于生成补全内容的模型名称,例如 "o3-mini"。

  • sampling_params: optional object { max_completion_tokens, reasoning_effort, response_format, 4 more }

  • max_completion_tokens: optional integer

生成输出的最大词元数。

  • reasoning_effort: optional ReasoningEffort or null (default: "medium")

限制推理模型的推理强度。当前支持 none、minimal、low、medium、high、xhigh 和 max。 降低推理强度可能加快响应,并减少响应中用于 推理的词元数。并非所有推理模型都支持每个 取值。各模型的支持情况请参阅 推理指南 中的说明。

  • "none"

  • "minimal"

  • "low"

  • "medium"

  • "high"

  • "xhigh"

  • "max"

  • response_format: optional ResponseFormatText or ResponseFormatJSONSchema or ResponseFormatJSONObject

指定模型必须输出的格式的对象。

设为 { "type": "json_schema", "json_schema": {...} } 会启用 结构化输出,确保模型遵循你提供的 JSON 模式。更多信息请参阅结构化输出 指南。

设为 { "type": "json_object" } 会启用旧版 JSON 模式, 确保模型生成有效的 JSON。对于支持的模型,优先使用 json_schema 格式。

  • ResponseFormatText object { type }

默认响应格式,用于生成文本响应。

  • type: "text"

定义的响应格式类型,固定为 text。

  • "text"

  • ResponseFormatJSONSchema object { json_schema, type }

JSON Schema 响应格式,用于生成结构化 JSON 响应。 参阅结构化输出。

  • json_schema: object { name, description, schema, strict }

结构化输出配置选项,包含 JSON Schema。

  • name: string

响应格式的名称,须使用 a-z、A-Z、0-9,或包含 下划线和连字符,最长为 64 个字符。

  • description: optional string

响应格式的用途描述,模型据此 判断如何按该格式响应。

  • schema: optional map[unknown]

以 JSON Schema 对象描述的响应格式模式。 JSON Schema 的构建方法参阅此处。

  • strict: optional boolean or null (default: false)

生成输出时是否启用严格模式遵循。 设为 true 时,模型始终严格遵循 schema 字段中定义的模式。strict 为 true 时仅支持 JSON Schema 的子集。更多信息请参阅结构化输出 指南。

  • type: "json_schema"

定义的响应格式类型,固定为 json_schema。

  • "json_schema"

  • ResponseFormatJSONObject object { type }

JSON 对象响应格式,是生成 JSON 响应的较早方式。 对于支持的模型,建议使用 json_schema。注意: 须在系统消息或用户消息中指示模型生成 JSON, 模型才会生成 JSON。

  • type: "json_object"

定义的响应格式类型,固定为 json_object。

  • "json_object"

  • seed: optional integer (default: 42)

采样时用于初始化随机性的种子值。

  • temperature: optional number (default: 1)

较高的 temperature 会增加输出的随机性。

  • tools: optional array of ChatCompletionFunctionTool

模型可以调用的工具列表。目前工具仅支持函数。通过此项提供模型可为其生成 JSON 输入的函数列表,最多支持 128 个函数。

  • function: FunctionDefinition

  • name: string

要调用的函数名称,须使用 a-z、A-Z、0-9,或包含下划线和连字符,最长为 64 个字符。

  • description: optional string

函数功能的描述,模型据此选择何时以及如何调用该函数。

  • parameters: optional FunctionParameters

函数接受的参数,以 JSON Schema 对象描述。示例参阅指南,格式说明参阅 JSON Schema 参考。

省略 parameters 表示定义参数列表为空的函数。

  • strict: optional boolean or null (default: false)

生成函数调用时是否启用严格模式遵循。设为 true 时,模型严格遵循 parameters 字段中定义的模式。strict 为 true 时仅支持 JSON Schema 的子集。结构化输出的更多信息参阅函数调用指南。

  • type: "function"

工具类型,目前仅支持 function。

  • "function"

  • top_p: optional number (default: 1)

用于核采样的参数,是 temperature 的替代方案;1.0 表示包含所有词元。

  • ResponsesRunDataSource object { source, type, input_messages, 2 more }

描述模型采样配置的 ResponsesRunDataSource 对象。

  • source: EvalJSONLFileContentSource { content, type } or EvalJSONLFileIDSource { id, type } or EvalResponsesSource { type, created_after, created_before, 8 more }

决定本次运行数据源中 item 命名空间的内容。

  • EvalJSONLFileContentSource object { content, type }

  • content: array of object { item, sample }

JSONL 文件的内容。

  • item: map[unknown]

  • sample: optional map[unknown]

  • type: "file_content" (default: "file_content")

JSONL 来源的类型,固定为 file_content。

  • "file_content"

  • EvalJSONLFileIDSource object { id, type }

  • id: string

文件标识。

  • type: "file_id" (default: "file_id")

JSONL 来源的类型,固定为 file_id。

  • "file_id"

  • EvalResponsesSource object { type, created_after, created_before, 8 more }

描述运行数据源配置的 EvalResponsesSource 对象。

  • type: "responses"

运行数据源类型,固定为 responses。

  • "responses"

  • created_after: optional integer or null

仅包含在此时间戳之后创建的条目,含边界。此查询参数用于选择响应。

minimum: 0

  • created_before: optional integer or null

仅包含在此时间戳之前创建的条目,含边界。此查询参数用于选择响应。

minimum: 0

  • instructions_search: optional string or null

可选的字符串,用于搜索 'instructions' 字段。此查询参数用于选择响应。

  • metadata: optional unknown or null

响应的元数据筛选条件。此查询参数用于选择响应。

  • model: optional string or null

要查找其响应的模型名称。此查询参数用于选择响应。

  • reasoning_effort: optional ReasoningEffort or null (default: "medium")

限制推理模型的推理强度。当前支持 none、minimal、low、medium、high、xhigh 和 max。 降低推理强度可能加快响应,并减少响应中用于 推理的词元数。并非所有推理模型都支持每个 取值。各模型的支持情况请参阅 推理指南 中的说明。

  • temperature: optional number or null

采样温度。此查询参数用于选择响应。

  • tools: optional array of string or null

工具名称列表。此查询参数用于选择响应。

  • top_p: optional number or null

核采样参数。此查询参数用于选择响应。

  • users: optional array of string or null

用户标识列表。此查询参数用于选择响应。

  • type: "responses" (default: "responses")

运行数据源类型,固定为 responses。

  • "responses"

  • input_messages: optional InputMessagesTemplate { template, type } or InputMessagesItemReference { item_reference, type }

从模型采样时使用,规定传给模型的消息结构。可以引用预先构建的轨迹,例如 item.input_trajectory,也可以使用包含 item 命名空间变量引用的模板。

  • InputMessagesTemplate object { template, type }

  • template: array of ChatMessage { content, role } or EvalMessageObject { content, role, type }

构成提示词或上下文的聊天消息列表,可以包含对 item 命名空间的变量引用,例如 {{item.name}}。

  • ChatMessage object { content, role }

  • content: string

消息内容。

  • role: string

消息角色,例如 "system"、"assistant"、"user"。

  • EvalMessageObject object { content, role, type }

输入模型的消息,其角色表示指令遵循的 优先级。以 developer 或 system 角色给出的指令 优先于 user 角色给出的指令。 assistant 角色的消息被视为模型在此前 交互中生成的内容。

  • content: string or ResponseInputText or OutputText { text, type } or 3 more

模型输入,可以包含模板字符串。支持输入文本、输出文本、输入图像和输入音频,可提供单个条目或条目数组。

  • TextInput = string

输入模型的文本。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • OutputText object { text, type }

模型输出的文本。

  • text: string

模型输出的文本内容。

  • type: "output_text"

输出文本类型,固定为 output_text。

  • "output_text"

  • InputImage object { image_url, type, detail }

用于 EvalItem 内容数组中的图像输入块。

  • image_url: string

输入图像的 URL。

format: uri

  • type: "input_image"

输入图像类型,固定为 input_image。

  • "input_image"

  • detail: optional string

发送给模型的图像细节级别,可选 high、low 或 auto,默认为 auto。

  • ResponseInputAudio object { input_audio, type }

输入模型的音频。

  • GraderInputs = array of string or ResponseInputText or OutputText { text, type } or 2 more

输入列表,每项可以是输入文本、输出文本、输入 图像或输入音频对象。

  • role: "user" or "assistant" or "system" or "developer"

输入消息的角色,可选 user、assistant、system 或 developer.

  • "user"

  • "assistant"

  • "system"

  • "developer"

  • type: optional "message"

输入消息类型,固定为 message。

  • "message"

  • type: "template"

输入消息类型,固定为 template。

  • "template"

  • InputMessagesItemReference object { item_reference, type }

  • item_reference: string

对 item 命名空间中变量的引用,例如 "item.name"。

  • type: "item_reference"

输入消息类型,固定为 item_reference。

  • "item_reference"

  • model: optional string

用于生成补全内容的模型名称,例如 "o3-mini"。

  • sampling_params: optional object { max_completion_tokens, reasoning_effort, seed, 4 more }

  • max_completion_tokens: optional integer

生成输出的最大词元数。

  • reasoning_effort: optional ReasoningEffort or null (default: "medium")

限制推理模型的推理强度。当前支持 none、minimal、low、medium、high、xhigh 和 max。 降低推理强度可能加快响应,并减少响应中用于 推理的词元数。并非所有推理模型都支持每个 取值。各模型的支持情况请参阅 推理指南 中的说明。

  • seed: optional integer (default: 42)

采样时用于初始化随机性的种子值。

  • temperature: optional number (default: 1)

较高的 temperature 会增加输出的随机性。

  • text: optional object { format }

模型文本响应的配置选项,可以是纯 文本或结构化 JSON 数据。更多信息:

  • format: optional ResponseFormatTextConfig

指定模型必须输出的格式的对象。

配置 { "type": "json_schema" } 会启用结构化输出, 确保模型遵循你提供的 JSON Schema。更多信息参阅 结构化输出指南。

默认格式为 { "type": "text" },没有额外选项。

不建议用于 gpt-4o 及后续模型:

设为 { "type": "json_object" } 会启用旧版 JSON 模式, 确保模型生成有效的 JSON。对于支持的模型,优先使用 json_schema 格式。

  • ResponseFormatText object { type }

默认响应格式,用于生成文本响应。

  • ResponseFormatTextJSONSchemaConfig object { name, schema, type, 2 more }

JSON Schema 响应格式,用于生成结构化 JSON 响应。 参阅结构化输出。

  • name: string

响应格式的名称,须使用 a-z、A-Z、0-9,或包含 下划线和连字符,最长为 64 个字符。

  • schema: map[unknown]

以 JSON Schema 对象描述的响应格式模式。 JSON Schema 的构建方法参阅此处。

  • type: "json_schema"

定义的响应格式类型,固定为 json_schema。

  • "json_schema"

  • description: optional string

响应格式的用途描述,模型据此 判断如何按该格式响应。

  • strict: optional boolean or null (default: false)

生成输出时是否启用严格模式遵循。 设为 true 时,模型始终严格遵循 schema 字段中定义的模式。strict 为 true 时仅支持 JSON Schema 的子集。更多信息请参阅结构化输出 指南。

  • ResponseFormatJSONObject object { type }

JSON 对象响应格式,是生成 JSON 响应的较早方式。 对于支持的模型,建议使用 json_schema。注意: 须在系统消息或用户消息中指示模型生成 JSON, 模型才会生成 JSON。

  • tools: optional array of Function { name, parameters, strict, 6 more } or FileSearch { type, vector_store_ids, filters, 2 more } or Computer { type } or 13 more

模型生成响应时可以调用的工具数组。你 可以通过 tool_choice 参数指定要使用的工具。

可向模型提供以下两类工具:

  • 内置工具:由 OpenAI 提供,用于扩展 模型能力,例如网页搜索 或文件搜索。更多信息参阅 内置工具。
  • 函数调用(自定义工具):由你定义的函数, 使模型可以调用你自己的代码。更多信息参阅 函数调用。

  • Function object { name, parameters, strict, 6 more }

定义模型可以选择调用的自有代码函数。参阅函数调用。

  • name: string

要调用的函数名称。

  • parameters: map[unknown] or null

描述函数参数的 JSON Schema 对象。

  • strict: boolean or null

是否对此函数工具强制执行严格参数校验。

  • type: "function" (default: "function")

函数工具类型,固定为 function。

  • "function"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

  • "direct"

  • "programmatic"

  • async: optional boolean

  • defer_loading: optional boolean

此函数是否延迟加载并通过工具搜索加载。

  • description: optional string or null

函数描述,模型据此判断是否调用该函数。

  • output_schema: optional map[unknown] or null

描述此函数字符串输出中编码的 JSON 值的 JSON Schema 对象。

  • FileSearch object { type, vector_store_ids, filters, 2 more }

搜索已上传文件中相关内容的工具。参阅文件搜索工具。

  • type: "file_search" (default: "file_search")

文件搜索工具类型,固定为 file_search。

  • "file_search"

  • vector_store_ids: array of string

要搜索的向量存储 ID 列表。

  • filters: optional ComparisonFilter or CompoundFilter or null

要应用的筛选条件。

  • ComparisonFilter object { key, type, value }

使用指定比较运算,将某个属性键与给定值比较的筛选条件。

  • key: string

要与值比较的属性键。

  • type: "eq" or "ne" or "gt" or 5 more (default: "eq")

指定比较运算符:eq、ne、gt、gte、lt、lte、in、nin。

  • eq:等于
  • ne:不等于
  • gt:大于
  • gte:大于或等于
  • lt:小于
  • lte:小于或等于
  • in:属于
  • nin:不属于

  • "eq"

  • "ne"

  • "gt"

  • "gte"

  • "lt"

  • "lte"

  • "in"

  • "nin"

  • value: string or number or boolean or array of string or number

用于与属性键比较的值,支持字符串、数字或布尔类型。

  • string

  • number

  • boolean

  • array of string or number

  • string

  • number

  • CompoundFilter object { filters, type }

使用 and 或 or 组合多个筛选条件。

  • filters: array of ComparisonFilter or CompoundFilter

要组合的筛选条件数组,条目可以是 ComparisonFilter 或 CompoundFilter。

  • ComparisonFilter object { key, type, value }

使用指定比较运算,将某个属性键与给定值比较的筛选条件。

  • CompoundFilter object { filters, type }

使用 and 或 or 组合多个筛选条件。

  • type: "and" or "or"

运算类型:and 或 or。

  • "and"

  • "or"

  • max_num_results: optional integer

返回结果数量上限,须介于 1–50 之间,含边界。

  • ranking_options: optional object { hybrid_search, ranker, score_threshold }

搜索结果的排序选项。

  • hybrid_search: optional object { embedding_weight, text_weight }

启用混合搜索时,控制倒数排名融合如何平衡语义嵌入匹配与稀疏关键词匹配的权重。

  • embedding_weight: number

嵌入在倒数排名融合中的权重。

  • text_weight: number

文本在倒数排名融合中的权重。

  • ranker: optional "auto" or "default-2024-11-15"

文件搜索所用的排序器。

  • "auto"

  • "default-2024-11-15"

  • score_threshold: optional number

文件搜索的分数阈值,为 0–1 之间的数字。越接近 1,越倾向于只返回最相关的结果,但返回数量可能减少。

  • Computer object { type }

控制虚拟计算机的工具。参阅计算机工具。

  • type: "computer" (default: "computer")

计算机工具类型,固定为 computer。

  • "computer"

  • ComputerUsePreview object { display_height, display_width, environment, type }

控制虚拟计算机的工具。参阅计算机工具。

  • display_height: integer

计算机显示区域的高度。

  • display_width: integer

计算机显示区域的宽度。

  • environment: "windows" or "mac" or "linux" or 2 more

要控制的计算机环境类型。

  • "windows"

  • "mac"

  • "linux"

  • "ubuntu"

  • "browser"

  • type: "computer_use_preview" (default: "computer_use_preview")

计算机使用工具类型,固定为 computer_use_preview。

  • "computer_use_preview"

  • WebSearch object { type, external_web_access, filters, 2 more }

在互联网上搜索与提示词相关的信息来源。参阅 网络搜索工具时。

  • type: "web_search" or "web_search_2025_08_26" (default: "web_search")

网页搜索工具类型,可选 web_search 或 web_search_2025_08_26。

  • "web_search"

  • "web_search_2025_08_26"

  • external_web_access: optional boolean (default: true)

是否允许网页搜索实时访问互联网。省略时默认为 true。设为 false 时,网页搜索工具以离线或仅缓存模式运行,不会抓取新的外部内容。

  • filters: optional object { allowed_domains } or null

搜索的筛选条件。

  • allowed_domains: optional array of string or null (default: [])

搜索允许的域名。未提供时允许所有域名。 也允许访问所提供域名的子域名。

示例:["pubmed.ncbi.nlm.nih.gov"]

  • search_context_size: optional "low" or "medium" or "high" (default: "medium")

对搜索占用上下文窗口空间大小的总体指导,可选 low、medium 或 high,默认为 medium。

  • "low"

  • "medium"

  • "high"

  • user_location: optional object { city, country, region, 2 more } or null

用户的大致位置。省略或设为 null 时,默认为 美国。若要避免此默认值,可传入不包含位置字段的 {"type": "approximate"}。 若要本地化结果,须提供相应位置字段。

  • city: optional string or null

用户所在城市的自由文本,例如 San Francisco。

  • country: optional string or null

用户所在国家/地区的两字母 ISO 代码,例如 US。

  • region: optional string or null

用户所在地区的自由文本,例如 California。

  • timezone: optional string or null

用户所在的 IANA 时区,例如 America/Los_Angeles。

  • type: optional "approximate" (default: "approximate")

位置估算类型,固定为 approximate。

  • "approximate"

  • Mcp object { server_label, type, allowed_callers, 9 more }

通过远程模型上下文协议(MCP)服务器, 向模型提供额外工具。了解 MCP。

  • server_label: string

此 MCP 服务器的标签,用于在工具调用中标识服务器。

  • type: "mcp"

MCP 工具类型,固定为 mcp。

  • "mcp"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • allowed_tools: optional array of string or McpToolFilter { read_only, tool_names } or null

允许的工具名称列表或筛选对象。

  • McpAllowedTools = array of string

允许的工具名称组成的字符串数组。

  • McpToolFilter object { read_only, tool_names }

用于指定允许哪些工具的筛选对象。

  • read_only: optional boolean

表示工具会修改数据还是只读。如果 MCP 服务器标注了 readOnlyHint, 就会与此筛选条件匹配。

  • tool_names: optional array of string

允许的工具名称列表。

  • authorization: optional string

可用于远程 MCP 服务器的 OAuth 访问令牌,既可 配合自定义 MCP 服务器 URL,也可配合服务连接器。你的应用 须处理 OAuth 授权流程,并在此提供令牌。

  • connector_id: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 5 more

服务连接器的标识,例如 ChatGPT 中提供的连接器。须提供 server_url、connector_id 或 tunnel_id 中的一项。更多 服务连接器信息参阅此处。

对于 2026 年 9 月 1 日之后发布的模型,此字段已弃用。 使用 server_url 连接远程 MCP 服务器,或使用 tunnel_id 通过安全 MCP 隧道连接。

当前支持的 connector_id 值如下:

  • Dropbox:connector_dropbox
  • Gmail:connector_gmail
  • Google 日历:connector_googlecalendar
  • Google 云端硬盘:connector_googledrive
  • Microsoft Teams:connector_microsoftteams
  • Outlook 日历:connector_outlookcalendar
  • Outlook 邮箱:connector_outlookemail
  • SharePoint:connector_sharepoint

  • "connector_dropbox"

  • "connector_gmail"

  • "connector_googlecalendar"

  • "connector_googledrive"

  • "connector_microsoftteams"

  • "connector_outlookcalendar"

  • "connector_outlookemail"

  • "connector_sharepoint"

  • defer_loading: optional boolean

此 MCP 工具是否延迟加载并通过工具搜索发现。

  • headers: optional map[string] or null

可选的发送给 MCP 服务器的 HTTP 请求头,用于认证 或其他用途。

  • require_approval: optional McpToolApprovalFilter { always, never } or "always" or "never" or null (default: "always")

指定 MCP 服务器的哪些工具需要批准。

  • McpToolApprovalFilter object { always, never }

指定 MCP 服务器的哪些工具需要批准。可以是 always、never,或与需要批准的工具关联的 筛选对象。

  • always: optional object { read_only, tool_names }

用于指定允许哪些工具的筛选对象。

  • read_only: optional boolean

表示工具会修改数据还是只读。如果 MCP 服务器标注了 readOnlyHint, 就会与此筛选条件匹配。

  • tool_names: optional array of string

允许的工具名称列表。

  • never: optional object { read_only, tool_names }

用于指定允许哪些工具的筛选对象。

  • read_only: optional boolean

表示工具会修改数据还是只读。如果 MCP 服务器标注了 readOnlyHint, 就会与此筛选条件匹配。

  • tool_names: optional array of string

允许的工具名称列表。

  • McpToolApprovalSetting = "always" or "never"

为所有工具指定统一的批准策略,可选 always 或 never。设为 always 时,所有工具均需要批准; 设为 never 时,所有工具均不需要批准。

  • "always"

  • "never"

  • server_description: optional string

MCP 服务器的可选描述,用于提供更多上下文。

  • server_url: optional string

MCP 服务器的 URL。须提供 server_url、connector_id 或 tunnel_id 中的一项。

format: uri

  • tunnel_id: optional string

用来替代直接服务器 URL 的安全 MCP 隧道 ID。须提供 server_url、connector_id 或 tunnel_id 中的一项。

pattern: ^tunnel_[a-z0-9]{32}$

  • CodeInterpreter object { container, type, allowed_callers }

运行 Python 代码以帮助生成提示词响应的工具。

  • container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }

代码解释器容器,可以是容器 ID,也可以是 指定代码可用的已上传文件 ID 的对象,同时可提供 可选的 memory_limit 设置。

  • string

容器 ID。

  • CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }

代码解释器容器配置,可以指定运行代码时所处理的文件 ID。

  • type: "auto" (default: "auto")

固定为 auto。

  • "auto"

  • file_ids: optional array of string

可选的已上传文件列表,这些文件将提供给代码使用。

maxItems: 50

  • memory_limit: optional "1g" or "4g" or "16g" or "64g" or null

代码解释器容器的内存上限。

  • "1g"

  • "4g"

  • "16g"

  • "64g"

  • network_policy: optional ContainerNetworkPolicyDisabled or ContainerNetworkPolicyAllowlist

容器的网络访问策略。

  • ContainerNetworkPolicyDisabled object { type }

  • type: "disabled" (default: "disabled")

禁用出站网络访问,固定为 disabled。

  • "disabled"

  • ContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }

  • allowed_domains: array of string

type 为 allowlist 时允许访问的域名列表。

minItems: 1

  • type: "allowlist" (default: "allowlist")

仅允许对指定域名发起出站网络访问,固定为 allowlist。

  • "allowlist"

  • domain_secrets: optional array of ContainerNetworkPolicyDomainSecret

可选的仅用于允许访问域名的域名级密钥。

minItems: 1

  • domain: string

密钥关联的域名。

minLength: 1

  • name: string

要为该域名注入的密钥名称。

minLength: 1

  • value: string

要为该域名注入的密钥值。

minLength: 1, maxLength: 10485760

  • type: "code_interpreter"

代码解释器工具类型,固定为 code_interpreter。

  • "code_interpreter"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • ProgrammaticToolCalling object { type }

  • type: "programmatic_tool_calling" (default: "programmatic_tool_calling")

工具类型,固定为 programmatic_tool_calling。

  • "programmatic_tool_calling"

  • ImageGeneration object { type, action, background, 13 more }

使用 GPT 图像模型生成图像的工具。

  • type: "image_generation"

图像生成工具类型,固定为 image_generation。

  • "image_generation"

  • action: optional "generate" or "edit" or "auto"

生成新图像还是编辑已有图像,默认为 auto。

  • "generate"

  • "edit"

  • "auto"

  • background: optional "transparent" or "opaque" or "auto" (default: "auto")

生成图像的背景,可选 transparent、opaque, 或 auto。gpt-image-2.5-sunburst 和 gpt-image-2.5-flare,包括 对应的 2026-09-08 快照,支持 opaque 和 transparent 背景。受支持的 GPT Image 模型可以使用透明 背景。对于 gpt-image-2 和 gpt-image-2-2026-04-21,此功能处于 预览阶段。使用 transparent 时,须将输出格式设为 png 或 webp。 默认为 auto。

  • "transparent"

  • "opaque"

  • "auto"

  • complexity: optional "low" or "medium" or "high"

用于规划图像的计算投入,与渲染质量分开设置。 覆盖外层响应用于图像生成的 reasoning.effort。 省略时,继承外层受支持的推理强度,或使用 图像模型配置的默认值。 对于 SVG 输出,此项控制参考图像,而不是 SVG 生成模型的 推理。

  • "low"

  • "medium"

  • "high"

  • frame_count: optional integer (default: 9)

GIF 帧数,要求 output_format 为 gif,默认为 9。

minimum: 2, maximum: 16

  • frame_duration_ms: optional integer (default: 200)

每个 GIF 帧的时长,单位为毫秒,取整到 10 毫秒。 要求 output_format 为 gif,默认为 200。

minimum: 20, maximum: 2000

  • input_fidelity: optional "high" or "low" or null

控制模型为匹配输入图像风格和特征(尤其是面部特征)投入的程度。gpt-image-1.5 支持 high 和 low,gpt-image-1-mini 仅支持 low。使用 gpt-image-2 时应省略此参数。支持该参数的模型默认为 low。

  • "high"

  • "low"

  • input_image_mask: optional object { file_id, image_url }

可选的局部重绘蒙版,包含 image_url (可选字符串)和 file_id(可选字符串)。

  • file_id: optional string

蒙版图像的文件 ID。

  • image_url: optional string

采用 Base64 编码的蒙版图像。

  • model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-2" or 9 more

用于图像生成的模型,可选 gpt-image-1-mini、 gpt-image-1.5, gpt-image-2, gpt-image-2-2026-04-21、gpt-image-2.5-sunburst、 gpt-image-2.5-sunburst-2026-09-08、gpt-image-2.5-flare、 gpt-image-2.5-flare-2026-09-08, gpt-image-2.6-sunburst, gpt-image-2.6-flare 或 chatgpt-image-latest。默认值: gpt-image-2.6-sunburst.

gpt-image-1 已于 2026 年 10 月 23 日停用,请使用 gpt-image-2.5-sunburst 或 gpt-image-2.5-flare。

  • string

  • "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-2" or 9 more

用于图像生成的模型,可选 gpt-image-1-mini、 gpt-image-1.5, gpt-image-2, gpt-image-2-2026-04-21、gpt-image-2.5-sunburst、 gpt-image-2.5-sunburst-2026-09-08、gpt-image-2.5-flare、 gpt-image-2.5-flare-2026-09-08, gpt-image-2.6-sunburst, gpt-image-2.6-flare 或 chatgpt-image-latest。默认值: gpt-image-2.6-sunburst.

gpt-image-1 已于 2026 年 10 月 23 日停用,请使用 gpt-image-2.5-sunburst 或 gpt-image-2.5-flare。

  • "gpt-image-1"

  • "gpt-image-1-mini"

  • "gpt-image-2"

  • "gpt-image-2-2026-04-21"

  • "gpt-image-2.5-sunburst"

  • "gpt-image-2.5-sunburst-2026-09-08"

  • "gpt-image-2.5-flare"

  • "gpt-image-2.5-flare-2026-09-08"

  • "gpt-image-2.6-sunburst"

  • "gpt-image-2.6-flare"

  • "gpt-image-1.5"

  • "chatgpt-image-latest"

  • moderation: optional "auto" or "low" (default: "auto")

生成图像的审核级别,默认为 auto。

  • "auto"

  • "low"

  • output_compression: optional integer (default: 100)

输出图像的压缩级别,默认为 100。

minimum: 0, maximum: 100

  • output_format: optional "png" or "webp" or "jpeg" or 2 more (default: "png")

输出图像格式,可选 png、webp、jpeg、 gif 或 svg,默认为 png。GIF 和 SVG 输出要求模型 支持所选格式。GIF 输出不支持 部分图像流式传输,即 partial_images 大于 0, 也不支持 input_image_mask 或自定义 output_compression。 GIF 输出仍可以流式发送 Responses 生命周期事件。

  • "png"

  • "webp"

  • "jpeg"

  • "gif"

  • "svg"

  • partial_images: optional integer (default: 0)

流式模式中生成的部分图像数量,范围为 0(默认值)到 3。

minimum: 0, maximum: 3

  • quality: optional "low" or "medium" or "high" or 3 more (default: "auto")

生成图像的质量。GPT 图像模型支持 low、 medium 和 high。gpt-image-2.5-sunburst 和 gpt-image-2.5-flare, 包括对应的 2026-09-08 快照,还支持 xhigh 和 max。 默认为 auto。

  • "low"

  • "medium"

  • "high"

  • "xhigh"

  • "max"

  • "auto"

  • size: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "auto" (default: "auto")

生成图像的尺寸。gpt-image-2、gpt-image-2-2026-04-21、gpt-image-2.5-sunburst、gpt-image-2.5-sunburst-2026-09-08、gpt-image-2.5-flare 和 gpt-image-2.5-flare-2026-09-08 支持以 WIDTHxHEIGHT 字符串指定任意分辨率,例如 1536x864。宽和高均须能被 16 整除,宽高比须在 1:3 至 3:1 之间。高于 2560x1440 的分辨率属于实验功能,支持的最高分辨率为 3840x2160。尺寸还须符合模型当前的像素数与边长限制。GPT Image 模型支持标准尺寸 1024x1024、1536x1024 和 1024x1536;允许自动尺寸的模型支持 auto。

  • string

  • "1024x1024" or "1024x1536" or "1536x1024" or "auto"

生成图像的尺寸。gpt-image-2、gpt-image-2-2026-04-21、gpt-image-2.5-sunburst、gpt-image-2.5-sunburst-2026-09-08、gpt-image-2.5-flare 和 gpt-image-2.5-flare-2026-09-08 支持以 WIDTHxHEIGHT 字符串指定任意分辨率,例如 1536x864。宽和高均须能被 16 整除,宽高比须在 1:3 至 3:1 之间。高于 2560x1440 的分辨率属于实验功能,支持的最高分辨率为 3840x2160。尺寸还须符合模型当前的像素数与边长限制。GPT Image 模型支持标准尺寸 1024x1024、1536x1024 和 1024x1536;允许自动尺寸的模型支持 auto。

  • "1024x1024"

  • "1024x1536"

  • "1536x1024"

  • "auto"

  • svg: optional object { model, reasoning }

SVG 生成模型的设置,要求 output_format 为 svg。 启用 SVG 模型选择时,省略此对象会使用 外层响应模型。否则使用默认 SVG 生成模型,且 不能显式覆盖模型。

  • model: optional string

minLength: 1

  • reasoning: optional object { effort } or null

SVG 编写的推理强度。省略时,Images 和 Responses 均使用编写模型的默认值。

  • effort: optional "none" or "minimal" or "low" or 4 more

控制模型为此次请求投入的推理强度。

  • "none"

  • "minimal"

  • "low"

  • "medium"

  • "high"

  • "xhigh"

  • "max"

  • LocalShell object { type }

允许模型在本地环境执行 shell 命令的工具。

  • type: "local_shell" (default: "local_shell")

本地 shell 工具类型,固定为 local_shell。

  • "local_shell"

  • Shell object { type, allowed_callers, environment }

允许模型执行 shell 命令的工具。

  • type: "shell" (default: "shell")

shell 工具类型,固定为 shell。

  • "shell"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • environment: optional ContainerAuto or LocalEnvironment or ContainerReference or null

  • ContainerAuto object { type, file_ids, memory_limit, 2 more }

  • type: "container_auto" (default: "container_auto")

为此请求自动创建容器。

  • "container_auto"

  • file_ids: optional array of string

可选的已上传文件列表,这些文件将提供给代码使用。

maxItems: 50

  • memory_limit: optional "1g" or "4g" or "16g" or "64g" or null

容器的内存上限。

  • "1g"

  • "4g"

  • "16g"

  • "64g"

  • network_policy: optional ContainerNetworkPolicyDisabled or ContainerNetworkPolicyAllowlist

容器的网络访问策略。

  • ContainerNetworkPolicyDisabled object { type }

  • ContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }

  • skills: optional array of SkillReference or InlineSkill

可选的技能列表,通过 ID 或内联数据引用技能。

maxItems: 200

  • SkillReference object { skill_id, type, version }

  • skill_id: string

引用的技能 ID。

minLength: 1, maxLength: 64

  • type: "skill_reference" (default: "skill_reference")

引用通过 /v1/skills 接口创建的技能。

  • "skill_reference"

  • version: optional string

可选的技能版本。使用正整数或 'latest',省略时使用默认版本。

  • InlineSkill object { description, name, source, type }

  • description: string

技能描述。

  • name: string

技能名称。

  • source: InlineSkillSource

内联技能载荷。

  • data: string

采用 Base64 编码的技能 ZIP 包。

minLength: 1, maxLength: 70254592

  • media_type: "application/zip" (default: "application/zip")

内联技能载荷的媒体类型,必须为 application/zip。

  • "application/zip"

  • type: "base64" (default: "base64")

内联技能来源的类型,必须为 base64。

  • "base64"

  • type: "inline" (default: "inline")

为此请求定义内联技能。

  • "inline"

  • LocalEnvironment object { type, skills }

  • type: "local" (default: "local")

使用本地计算机环境。

  • "local"

  • skills: optional array of LocalSkill

可选的技能列表。

maxItems: 200

  • description: string

技能描述。

  • name: string

技能名称。

  • path: string

包含该技能的目录路径。

  • ContainerReference object { container_id, type }

  • container_id: string

引用的容器 ID。

  • type: "container_reference" (default: "container_reference")

引用通过 /v1/containers 接口创建的容器。

  • "container_reference"

  • Custom object { name, type, allowed_callers, 4 more }

使用指定格式处理输入的自定义工具。参阅自定义工具。

  • name: string

自定义工具的名称,用于在工具调用中标识它。

  • type: "custom" (default: "custom")

自定义工具类型,固定为 custom。

  • "custom"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • async: optional boolean

工具响应是否可以异步返回,而非在下一次创建响应时立即返回。

  • defer_loading: optional boolean

此工具是否应延迟加载并通过工具搜索发现。

  • description: optional string

自定义工具的可选描述,用于提供更多上下文。

  • format: optional CustomToolInputFormat

自定义工具的输入格式,默认为无约束文本。

  • Text object { type }

无约束的自由文本。

  • type: "text" (default: "text")

无约束文本格式,固定为 text。

  • "text"

  • Grammar object { definition, syntax, type }

用户定义的语法。

  • definition: string

语法定义。

  • syntax: "lark" or "regex"

语法定义的语法类型,可选 lark 或 regex。

  • "lark"

  • "regex"

  • type: "grammar" (default: "grammar")

语法格式,固定为 grammar。

  • "grammar"

  • Namespace object { description, name, tools, type }

将函数工具或自定义工具归入共享命名空间。

  • description: string

展示给模型的命名空间描述。

  • name: string

工具调用使用的命名空间名称,例如 crm。

minLength: 1

  • tools: array of Function { name, type, allowed_callers, 6 more } or Custom { name, type, allowed_callers, 4 more }

此命名空间内可用的函数工具或自定义工具。

minItems: 1

  • Function object { name, type, allowed_callers, 6 more }

  • name: string

pattern: ^[a-zA-Z0-9_-]+$, minLength: 1, maxLength: 128

  • type: "function" (default: "function")

  • "function"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • async: optional boolean

工具响应是否可以异步返回,而非在下一次创建响应时立即返回。

  • defer_loading: optional boolean

此函数是否应延迟加载并通过工具搜索发现。

  • description: optional string or null

  • output_schema: optional map[unknown] or null

描述此函数工具字符串输出中编码的 JSON 值的 JSON Schema,不用于描述内容数组输出。

  • parameters: optional unknown or null

  • strict: optional boolean or null

是否强制执行严格参数校验。省略时,模式兼容的情况下 Responses 会尝试严格校验,否则退回非严格校验。

  • Custom object { name, type, allowed_callers, 4 more }

使用指定格式处理输入的自定义工具。参阅自定义工具。

  • name: string

自定义工具的名称,用于在工具调用中标识它。

  • type: "custom" (default: "custom")

自定义工具类型,固定为 custom。

  • "custom"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • async: optional boolean

工具响应是否可以异步返回,而非在下一次创建响应时立即返回。

  • defer_loading: optional boolean

此工具是否应延迟加载并通过工具搜索发现。

  • description: optional string

自定义工具的可选描述,用于提供更多上下文。

  • format: optional CustomToolInputFormat

自定义工具的输入格式,默认为无约束文本。

  • type: "namespace" (default: "namespace")

工具类型,固定为 namespace。

  • "namespace"

  • ToolSearch object { type, description, execution, parameters }

用于延迟加载工具的托管工具搜索或自带工具(BYOT)搜索配置。

  • type: "tool_search" (default: "tool_search")

工具类型,固定为 tool_search。

  • "tool_search"

  • description: optional string or null

客户端执行的工具搜索工具展示给模型的描述。

  • execution: optional "server" or "client"

工具搜索由服务端还是客户端执行。

  • "server"

  • "client"

  • parameters: optional unknown or null

客户端执行的工具搜索工具的参数模式。

  • WebSearchPreview object { type, search_content_types, search_context_size, user_location }

搜索网页以获取可用于响应的相关结果的工具。参阅网页搜索工具。

  • type: "web_search_preview" or "web_search_preview_2025_03_11" (default: "web_search_preview")

网页搜索工具类型,可选 web_search_preview 或 web_search_preview_2025_03_11。

  • "web_search_preview"

  • "web_search_preview_2025_03_11"

  • search_content_types: optional array of "text" or "image"

  • "text"

  • "image"

  • search_context_size: optional "low" or "medium" or "high"

对搜索占用上下文窗口空间大小的总体指导,可选 low、medium 或 high,默认为 medium。

  • "low"

  • "medium"

  • "high"

  • user_location: optional object { type, city, country, 2 more } or null

用户的大致位置。省略或设为 null 时默认为美国。若要避免此默认值,可传入不包含位置字段的 {"type": "approximate"}。若要本地化结果,须提供相应位置字段。

  • type: "approximate" (default: "approximate")

位置估算类型,固定为 approximate。

  • "approximate"

  • city: optional string or null

用户所在城市的自由文本,例如 San Francisco。

  • country: optional string or null

用户所在国家/地区的两字母 ISO 代码,例如 US。

  • region: optional string or null

用户所在地区的自由文本,例如 California。

  • timezone: optional string or null

用户所在的 IANA 时区,例如 America/Los_Angeles。

  • ApplyPatch object { type, allowed_callers }

允许助手使用统一差异格式创建、删除或更新文件。

  • type: "apply_patch" (default: "apply_patch")

工具类型,固定为 apply_patch。

  • "apply_patch"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • top_p: optional number (default: 1)

用于核采样的参数,是 temperature 的替代方案;1.0 表示包含所有词元。

  • error: EvalAPIError or null

表示 Eval API 错误响应的对象。

  • code: string

错误代码。

  • message: string

错误消息。

  • eval_id: string

关联评测的标识。

  • metadata: Metadata or null

可附加到对象的元数据,最多包含 16 组键值对,可 以结构化方式存储对象的额外信息, 并通过 API 或控制台查询对象。

键为最多 64 个字符的字符串,值为 最多 512 个字符的字符串。

  • model: string or null

被评测的模型,如适用。

  • name: string or null

评测运行名称。

  • object: "eval.run" (default: "eval.run")

对象类型,固定为 "eval.run"。

  • "eval.run"

  • per_model_usage: array of object { cached_tokens, completion_tokens, invocation_count, 3 more } or null

评测运行期间各模型的用量统计。

  • cached_tokens: integer

从缓存读取的词元数。

  • completion_tokens: integer

生成的补全词元数。

  • invocation_count: integer

调用次数。

  • model_name: string

模型名称。

  • prompt_tokens: integer

使用的提示词词元数。

  • total_tokens: integer

使用的总词元数。

  • per_testing_criteria_results: array of object { failed, passed, testing_criteria } or null

评测运行中各测试标准的结果。

  • failed: integer

未通过此标准的测试数量。

  • passed: integer

通过此标准的测试数量。

  • testing_criteria: string

测试标准的描述。

  • report_url: string

在控制台界面中呈现评测运行报告的 URL。

format: uri

  • result_counts: object { errored, failed, passed, total }

汇总评测运行结果的计数器。

  • errored: integer

因错误而失败的输出条目数量。

  • failed: integer

未通过评测的输出条目数量。

  • passed: integer

通过评测的输出条目数量。

  • total: integer

已执行的输出条目总数。

  • status: string

评测运行状态。

  • first_id: string

data 数组中第一个评测运行的标识。

  • has_more: boolean

是否还有更多可用评测。

  • last_id: string

data 数组中最后一个评测运行的标识。

  • object: "list" (default: "list")

对象类型,固定为 "list"。

  • "list"

示例

## 设置 OPENAI_API_KEY,并将评测 ID 和运行 ID 替换为实际值。
curl https://api.openai.com/v1/evals/$EVAL_ID/runs \
    -H "Authorization: Bearer $OPENAI_API_KEY"

200 响应示例

{
  "data": [
    {
      "id": "id",
      "created_at": 0,
      "data_source": {
        "source": {
          "content": [
            {
              "item": {
                "foo": "bar"
              },
              "sample": {
                "foo": "bar"
              }
            }
          ],
          "type": "file_content"
        },
        "type": "jsonl"
      },
      "error": {
        "code": "code",
        "message": "message"
      },
      "eval_id": "eval_id",
      "metadata": {
        "foo": "string"
      },
      "model": "model",
      "name": "name",
      "object": "eval.run",
      "per_model_usage": [
        {
          "cached_tokens": 0,
          "completion_tokens": 0,
          "invocation_count": 0,
          "model_name": "model_name",
          "prompt_tokens": 0,
          "total_tokens": 0
        }
      ],
      "per_testing_criteria_results": [
        {
          "failed": 0,
          "passed": 0,
          "testing_criteria": "testing_criteria"
        }
      ],
      "report_url": "https://example.com",
      "result_counts": {
        "errored": 0,
        "failed": 0,
        "passed": 0,
        "total": 0
      },
      "status": "status"
    }
  ],
  "first_id": "first_id",
  "has_more": true,
  "last_id": "last_id",
  "object": "list"
}

示例

## 设置 OPENAI_API_KEY,并将评测 ID 和运行 ID 替换为实际值。
curl https://api.openai.com/v1/evals/egroup_67abd54d9b0081909a86353f6fb9317a/runs \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json"

响应示例

{
  "object": "list",
  "data": [
    {
      "object": "eval.run",
      "id": "evalrun_67e0c7d31560819090d60c0780591042",
      "eval_id": "eval_67e0c726d560819083f19a957c4c640b",
      "report_url": "https://platform.openai.com/evaluations/eval_67e0c726d560819083f19a957c4c640b",
      "status": "completed",
      "model": "o3-mini",
      "name": "bulk_with_negative_examples_o3-mini",
      "created_at": 1742784467,
      "result_counts": {
        "total": 1,
        "errored": 0,
        "failed": 0,
        "passed": 1
      },
      "per_model_usage": [
        {
          "model_name": "o3-mini",
          "invocation_count": 1,
          "prompt_tokens": 563,
          "completion_tokens": 874,
          "total_tokens": 1437,
          "cached_tokens": 0
        }
      ],
      "per_testing_criteria_results": [
        {
          "testing_criteria": "Push Notification Summary Grader-1808cd0b-eeec-4e0b-a519-337e79f4f5d1",
          "passed": 1,
          "failed": 0
        }
      ],
      "data_source": {
        "type": "completions",
        "source": {
          "type": "file_content",
          "content": [
            {
              "item": {
                "notifications": "\n- Sarah 发来新消息:\"稍后能给我打个电话吗?\"\n- 你的包裹已送达!\n- 限时优惠:未来 2 小时内电子产品八折!\n"
              }
            }
          ]
        },
        "input_messages": {
          "type": "template",
          "template": [
            {
              "type": "message",
              "role": "developer",
              "content": {
                "type": "input_text",
                "text": "\n\n\n\n你是一名乐于助人的助手,接收一组推送通知,并将其汇总为简短摘要。\n推送通知将以下列形式提供:\n<push_notifications>\n...notificationlist...\n</push_notifications>\n\n只返回摘要,不添加其他内容。\n\n\n摘要须简洁明快。\n\n\n好的摘要示例:\n<push_notifications>\n- 交通提醒:主街发生事故。- 包裹配送中:预计下午 5 点前送达。- 新好友推荐:与 Emma 建立联系。\n</push_notifications>\n<summary>\n交通提醒、包裹预计下午 5 点前送达、新好友推荐(Emily)。\n</summary>\n\n\n不好的摘要示例:\n<push_notifications>\n- 交通提醒:主街发生事故。- 包裹配送中:预计下午 5 点前送达。- 新好友推荐:与 Emma 建立联系。\n</push_notifications>\n<summary>\n主街发生了交通事故。你的包裹将在下午 5 点前送达,系统向你推荐的新好友是 Emily。\n</summary>\n"
              }
            },
            {
              "type": "message",
              "role": "user",
              "content": {
                "type": "input_text",
                "text": "<push_notifications>{{item.notifications}}</push_notifications>"
              }
            }
          ]
        },
        "model": "o3-mini"
      },
      "error": null,
      "metadata": {}
    }
  ],
  "first_id": "evalrun_67e0c7d31560819090d60c0780591042",
  "last_id": "evalrun_67e0c7d31560819090d60c0780591042",
  "has_more": true
}

获取评测运行

get /evals/{eval_id}/runs/{run_id}

按 ID 获取评测运行。

路径参数

  • eval_id: string

要获取其运行列表的评测的 ID。

  • run_id: string

要获取的运行的 ID。

返回值

  • id: string

评测运行的唯一标识。

  • created_at: integer

评测运行创建时的 Unix 时间戳,单位为秒。

format: unixtime

  • data_source: CreateEvalJSONLRunDataSource or CreateEvalCompletionsRunDataSource or ResponsesRunDataSource { source, type, input_messages, 2 more }

本次运行的数据源信息。

  • CreateEvalJSONLRunDataSource object { source, type }

JsonlRunDataSource 对象,指定与该评测匹配的 JSONL 文件。

  • source: EvalJSONLFileContentSource { content, type } or EvalJSONLFileIDSource { id, type }

决定数据源中 item 命名空间的内容。

  • EvalJSONLFileContentSource object { content, type }

  • content: array of object { item, sample }

JSONL 文件的内容。

  • item: map[unknown]

  • sample: optional map[unknown]

  • type: "file_content" (default: "file_content")

JSONL 来源的类型,固定为 file_content。

  • "file_content"

  • EvalJSONLFileIDSource object { id, type }

  • id: string

文件标识。

  • type: "file_id" (default: "file_id")

JSONL 来源的类型,固定为 file_id。

  • "file_id"

  • type: "jsonl" (default: "jsonl")

数据源类型,固定为 jsonl。

  • "jsonl"

  • CreateEvalCompletionsRunDataSource object { source, type, input_messages, 2 more }

描述模型采样配置的 CompletionsRunDataSource 对象。

  • source: EvalJSONLFileContentSource { content, type } or EvalJSONLFileIDSource { id, type } or StoredCompletionsRunDataSource { type, created_after, created_before, 3 more }

决定本次运行数据源中 item 命名空间的内容。

  • EvalJSONLFileContentSource object { content, type }

  • content: array of object { item, sample }

JSONL 文件的内容。

  • item: map[unknown]

  • sample: optional map[unknown]

  • type: "file_content" (default: "file_content")

JSONL 来源的类型,固定为 file_content。

  • "file_content"

  • EvalJSONLFileIDSource object { id, type }

  • id: string

文件标识。

  • type: "file_id" (default: "file_id")

JSONL 来源的类型,固定为 file_id。

  • "file_id"

  • StoredCompletionsRunDataSource object { type, created_after, created_before, 3 more }

描述一组筛选条件的 StoredCompletionsRunDataSource 配置。

  • type: "stored_completions" (default: "stored_completions")

来源类型,固定为 stored_completions。

  • "stored_completions"

  • created_after: optional integer or null

可选的 Unix 时间戳,用于筛选在此时间之后创建的条目。

  • created_before: optional integer or null

可选的 Unix 时间戳,用于筛选在此时间之前创建的条目。

  • limit: optional integer or null

可选的返回条目数量上限。

  • metadata: optional Metadata or null

可附加到对象的元数据,最多包含 16 组键值对,可 以结构化方式存储对象的额外信息, 并通过 API 或控制台查询对象。

键为最多 64 个字符的字符串,值为 最多 512 个字符的字符串。

  • model: optional string or null

可选的模型筛选条件,例如 'gpt-6-astra'。

  • type: "completions" (default: "completions")

运行数据源类型,固定为 completions。

  • "completions"

  • input_messages: optional TemplateInputMessages { template, type } or ItemReferenceInputMessages { item_reference, type }

从模型采样时使用,规定传给模型的消息结构。可以引用预先构建的轨迹,例如 item.input_trajectory,也可以使用包含 item 命名空间变量引用的模板。

  • TemplateInputMessages object { template, type }

  • template: array of EasyInputMessage or EvalMessageObject { content, role, type }

构成提示词或上下文的聊天消息列表,可以包含对 item 命名空间的变量引用,例如 {{item.name}}。

  • EasyInputMessage object { content, role, phase, type }

输入模型的消息,其角色表示指令遵循的 优先级。以 developer 或 system 角色给出的指令 优先于 user 角色给出的指令。 assistant 角色的消息被视为模型在此前 交互中生成的内容。

  • content: string or ResponseInputMessageContentList

用于生成响应的文本、图像或音频输入。 也可以包含此前的助手响应。

  • TextInput = string

输入模型的文本。

  • ResponseInputMessageContentList = array of ResponseInputContent

输入模型的一个或多个条目的列表,可以包含不同 内容类型。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • text: string

输入模型的文本。

  • type: "input_text" (default: "input_text")

输入条目类型,固定为 input_text。

  • "input_text"

  • prompt_cache_breakpoint: optional object { mode, ttl }

标记可复用提示词前缀的精确结束位置。省略 ttl 时,断点继承请求中的 prompt_cache_options.ttl;该边界不会按词元块取整。

  • mode: "explicit" (default: "explicit")

断点模式,固定为 explicit。

  • "explicit"

  • ttl: optional "30m" or "12h"

此缓存断点的最短存续时间,默认为请求的 TTL。

  • "30m"

  • "12h"

  • ResponseInputImage object { detail, type, file_id, 2 more }

输入模型的图像。参阅图像输入。

  • detail: ImageDetail

发送给模型的图像细节级别,可选 high、low、auto 或 original,默认为 auto。

  • "low"

  • "high"

  • "auto"

  • "original"

  • type: "input_image" (default: "input_image")

输入条目类型,固定为 input_image。

  • "input_image"

  • file_id: optional string or null

要发送给模型的文件 ID。

  • image_url: optional string or null

要发送给模型的图像 URL,可以是完整 URL,或包含 Base64 编码图像的 data URL。

format: uri

  • prompt_cache_breakpoint: optional object { mode, ttl }

标记可复用提示词前缀的精确结束位置。省略 ttl 时,断点继承请求中的 prompt_cache_options.ttl;该边界不会按词元块取整。

  • mode: "explicit" (default: "explicit")

断点模式,固定为 explicit。

  • "explicit"

  • ttl: optional "30m" or "12h"

此缓存断点的最短存续时间,默认为请求的 TTL。

  • "30m"

  • "12h"

  • ResponseInputFile object { type, detail, file_data, 4 more }

输入模型的文件。

  • type: "input_file" (default: "input_file")

输入条目类型,固定为 input_file。

  • "input_file"

  • detail: optional "auto" or "low" or "high"

发送给模型的文件细节级别。使用 auto 由系统选择;对于 GPT-5.6 及后续模型,auto 使用高质量渲染,可能增加输入词元用量。使用 low 进行成本较低的渲染,或使用 high 以更高质量渲染文件。默认为 auto。

  • "auto"

  • "low"

  • "high"

  • file_data: optional string

要发送给模型的文件内容。

  • file_id: optional string or null

要发送给模型的文件 ID。

  • file_url: optional string

要发送给模型的文件 URL。

format: uri

  • filename: optional string

要发送给模型的文件名。

  • prompt_cache_breakpoint: optional object { mode, ttl }

标记可复用提示词前缀的精确结束位置。省略 ttl 时,断点继承请求中的 prompt_cache_options.ttl;该边界不会按词元块取整。

  • mode: "explicit" (default: "explicit")

断点模式,固定为 explicit。

  • "explicit"

  • ttl: optional "30m" or "12h"

此缓存断点的最短存续时间,默认为请求的 TTL。

  • "30m"

  • "12h"

  • role: "user" or "assistant" or "system" or "developer"

输入消息的角色,可选 user、assistant、system 或 developer.

  • "user"

  • "assistant"

  • "system"

  • "developer"

  • phase: optional "commentary" or "final_answer" or null

将 assistant 消息标记为中间说明(commentary)或最终答案(final_answer)。 对于 gpt-5.3-codex 及后续此类模型,发送后续请求时,须保留并重新发送 所有助手消息的 phase;丢弃它可能降低表现。用户消息不使用此字段。

  • "commentary"

  • "final_answer"

  • type: optional "message"

输入消息类型,固定为 message。

  • "message"

  • EvalMessageObject object { content, role, type }

输入模型的消息,其角色表示指令遵循的 优先级。以 developer 或 system 角色给出的指令 优先于 user 角色给出的指令。 assistant 角色的消息被视为模型在此前 交互中生成的内容。

  • content: string or ResponseInputText or OutputText { text, type } or 3 more

模型输入,可以包含模板字符串。支持输入文本、输出文本、输入图像和输入音频,可提供单个条目或条目数组。

  • TextInput = string

输入模型的文本。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • OutputText object { text, type }

模型输出的文本。

  • text: string

模型输出的文本内容。

  • type: "output_text"

输出文本类型,固定为 output_text。

  • "output_text"

  • InputImage object { image_url, type, detail }

用于 EvalItem 内容数组中的图像输入块。

  • image_url: string

输入图像的 URL。

format: uri

  • type: "input_image"

输入图像类型,固定为 input_image。

  • "input_image"

  • detail: optional string

发送给模型的图像细节级别,可选 high、low 或 auto,默认为 auto。

  • ResponseInputAudio object { input_audio, type }

输入模型的音频。

  • input_audio: object { data, format }

  • data: string

采用 Base64 编码的音频数据。

  • format: "mp3" or "wav"

音频数据格式,当前支持 mp3 和 wav.

  • "mp3"

  • "wav"

  • type: "input_audio"

输入条目类型,固定为 input_audio。

  • "input_audio"

  • GraderInputs = array of string or ResponseInputText or OutputText { text, type } or 2 more

输入列表,每项可以是输入文本、输出文本、输入 图像或输入音频对象。

  • TextInput = string

输入模型的文本。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • OutputText object { text, type }

模型输出的文本。

  • text: string

模型输出的文本内容。

  • type: "output_text"

输出文本类型,固定为 output_text。

  • "output_text"

  • InputImage object { image_url, type, detail }

用于 EvalItem 内容数组中的图像输入块。

  • image_url: string

输入图像的 URL。

format: uri

  • type: "input_image"

输入图像类型,固定为 input_image。

  • "input_image"

  • detail: optional string

发送给模型的图像细节级别,可选 high、low 或 auto,默认为 auto。

  • ResponseInputAudio object { input_audio, type }

输入模型的音频。

  • role: "user" or "assistant" or "system" or "developer"

输入消息的角色,可选 user、assistant、system 或 developer.

  • "user"

  • "assistant"

  • "system"

  • "developer"

  • type: optional "message"

输入消息类型,固定为 message。

  • "message"

  • type: "template"

输入消息类型,固定为 template。

  • "template"

  • ItemReferenceInputMessages object { item_reference, type }

  • item_reference: string

对 item 命名空间中变量的引用,例如 "item.input_trajectory"。

  • type: "item_reference"

输入消息类型,固定为 item_reference。

  • "item_reference"

  • model: optional string

用于生成补全内容的模型名称,例如 "o3-mini"。

  • sampling_params: optional object { max_completion_tokens, reasoning_effort, response_format, 4 more }

  • max_completion_tokens: optional integer

生成输出的最大词元数。

  • reasoning_effort: optional ReasoningEffort or null (default: "medium")

限制推理模型的推理强度。当前支持 none、minimal、low、medium、high、xhigh 和 max。 降低推理强度可能加快响应,并减少响应中用于 推理的词元数。并非所有推理模型都支持每个 取值。各模型的支持情况请参阅 推理指南 中的说明。

  • "none"

  • "minimal"

  • "low"

  • "medium"

  • "high"

  • "xhigh"

  • "max"

  • response_format: optional ResponseFormatText or ResponseFormatJSONSchema or ResponseFormatJSONObject

指定模型必须输出的格式的对象。

设为 { "type": "json_schema", "json_schema": {...} } 会启用 结构化输出,确保模型遵循你提供的 JSON 模式。更多信息请参阅结构化输出 指南。

设为 { "type": "json_object" } 会启用旧版 JSON 模式, 确保模型生成有效的 JSON。对于支持的模型,优先使用 json_schema 格式。

  • ResponseFormatText object { type }

默认响应格式,用于生成文本响应。

  • type: "text"

定义的响应格式类型,固定为 text。

  • "text"

  • ResponseFormatJSONSchema object { json_schema, type }

JSON Schema 响应格式,用于生成结构化 JSON 响应。 参阅结构化输出。

  • json_schema: object { name, description, schema, strict }

结构化输出配置选项,包含 JSON Schema。

  • name: string

响应格式的名称,须使用 a-z、A-Z、0-9,或包含 下划线和连字符,最长为 64 个字符。

  • description: optional string

响应格式的用途描述,模型据此 判断如何按该格式响应。

  • schema: optional map[unknown]

以 JSON Schema 对象描述的响应格式模式。 JSON Schema 的构建方法参阅此处。

  • strict: optional boolean or null (default: false)

生成输出时是否启用严格模式遵循。 设为 true 时,模型始终严格遵循 schema 字段中定义的模式。strict 为 true 时仅支持 JSON Schema 的子集。更多信息请参阅结构化输出 指南。

  • type: "json_schema"

定义的响应格式类型,固定为 json_schema。

  • "json_schema"

  • ResponseFormatJSONObject object { type }

JSON 对象响应格式,是生成 JSON 响应的较早方式。 对于支持的模型,建议使用 json_schema。注意: 须在系统消息或用户消息中指示模型生成 JSON, 模型才会生成 JSON。

  • type: "json_object"

定义的响应格式类型,固定为 json_object。

  • "json_object"

  • seed: optional integer (default: 42)

采样时用于初始化随机性的种子值。

  • temperature: optional number (default: 1)

较高的 temperature 会增加输出的随机性。

  • tools: optional array of ChatCompletionFunctionTool

模型可以调用的工具列表。目前工具仅支持函数。通过此项提供模型可为其生成 JSON 输入的函数列表,最多支持 128 个函数。

  • function: FunctionDefinition

  • name: string

要调用的函数名称,须使用 a-z、A-Z、0-9,或包含下划线和连字符,最长为 64 个字符。

  • description: optional string

函数功能的描述,模型据此选择何时以及如何调用该函数。

  • parameters: optional FunctionParameters

函数接受的参数,以 JSON Schema 对象描述。示例参阅指南,格式说明参阅 JSON Schema 参考。

省略 parameters 表示定义参数列表为空的函数。

  • strict: optional boolean or null (default: false)

生成函数调用时是否启用严格模式遵循。设为 true 时,模型严格遵循 parameters 字段中定义的模式。strict 为 true 时仅支持 JSON Schema 的子集。结构化输出的更多信息参阅函数调用指南。

  • type: "function"

工具类型,目前仅支持 function。

  • "function"

  • top_p: optional number (default: 1)

用于核采样的参数,是 temperature 的替代方案;1.0 表示包含所有词元。

  • ResponsesRunDataSource object { source, type, input_messages, 2 more }

描述模型采样配置的 ResponsesRunDataSource 对象。

  • source: EvalJSONLFileContentSource { content, type } or EvalJSONLFileIDSource { id, type } or EvalResponsesSource { type, created_after, created_before, 8 more }

决定本次运行数据源中 item 命名空间的内容。

  • EvalJSONLFileContentSource object { content, type }

  • content: array of object { item, sample }

JSONL 文件的内容。

  • item: map[unknown]

  • sample: optional map[unknown]

  • type: "file_content" (default: "file_content")

JSONL 来源的类型,固定为 file_content。

  • "file_content"

  • EvalJSONLFileIDSource object { id, type }

  • id: string

文件标识。

  • type: "file_id" (default: "file_id")

JSONL 来源的类型,固定为 file_id。

  • "file_id"

  • EvalResponsesSource object { type, created_after, created_before, 8 more }

描述运行数据源配置的 EvalResponsesSource 对象。

  • type: "responses"

运行数据源类型,固定为 responses。

  • "responses"

  • created_after: optional integer or null

仅包含在此时间戳之后创建的条目,含边界。此查询参数用于选择响应。

minimum: 0

  • created_before: optional integer or null

仅包含在此时间戳之前创建的条目,含边界。此查询参数用于选择响应。

minimum: 0

  • instructions_search: optional string or null

可选的字符串,用于搜索 'instructions' 字段。此查询参数用于选择响应。

  • metadata: optional unknown or null

响应的元数据筛选条件。此查询参数用于选择响应。

  • model: optional string or null

要查找其响应的模型名称。此查询参数用于选择响应。

  • reasoning_effort: optional ReasoningEffort or null (default: "medium")

限制推理模型的推理强度。当前支持 none、minimal、low、medium、high、xhigh 和 max。 降低推理强度可能加快响应,并减少响应中用于 推理的词元数。并非所有推理模型都支持每个 取值。各模型的支持情况请参阅 推理指南 中的说明。

  • temperature: optional number or null

采样温度。此查询参数用于选择响应。

  • tools: optional array of string or null

工具名称列表。此查询参数用于选择响应。

  • top_p: optional number or null

核采样参数。此查询参数用于选择响应。

  • users: optional array of string or null

用户标识列表。此查询参数用于选择响应。

  • type: "responses" (default: "responses")

运行数据源类型,固定为 responses。

  • "responses"

  • input_messages: optional InputMessagesTemplate { template, type } or InputMessagesItemReference { item_reference, type }

从模型采样时使用,规定传给模型的消息结构。可以引用预先构建的轨迹,例如 item.input_trajectory,也可以使用包含 item 命名空间变量引用的模板。

  • InputMessagesTemplate object { template, type }

  • template: array of ChatMessage { content, role } or EvalMessageObject { content, role, type }

构成提示词或上下文的聊天消息列表,可以包含对 item 命名空间的变量引用,例如 {{item.name}}。

  • ChatMessage object { content, role }

  • content: string

消息内容。

  • role: string

消息角色,例如 "system"、"assistant"、"user"。

  • EvalMessageObject object { content, role, type }

输入模型的消息,其角色表示指令遵循的 优先级。以 developer 或 system 角色给出的指令 优先于 user 角色给出的指令。 assistant 角色的消息被视为模型在此前 交互中生成的内容。

  • content: string or ResponseInputText or OutputText { text, type } or 3 more

模型输入,可以包含模板字符串。支持输入文本、输出文本、输入图像和输入音频,可提供单个条目或条目数组。

  • TextInput = string

输入模型的文本。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • OutputText object { text, type }

模型输出的文本。

  • text: string

模型输出的文本内容。

  • type: "output_text"

输出文本类型,固定为 output_text。

  • "output_text"

  • InputImage object { image_url, type, detail }

用于 EvalItem 内容数组中的图像输入块。

  • image_url: string

输入图像的 URL。

format: uri

  • type: "input_image"

输入图像类型,固定为 input_image。

  • "input_image"

  • detail: optional string

发送给模型的图像细节级别,可选 high、low 或 auto,默认为 auto。

  • ResponseInputAudio object { input_audio, type }

输入模型的音频。

  • GraderInputs = array of string or ResponseInputText or OutputText { text, type } or 2 more

输入列表,每项可以是输入文本、输出文本、输入 图像或输入音频对象。

  • role: "user" or "assistant" or "system" or "developer"

输入消息的角色,可选 user、assistant、system 或 developer.

  • "user"

  • "assistant"

  • "system"

  • "developer"

  • type: optional "message"

输入消息类型,固定为 message。

  • "message"

  • type: "template"

输入消息类型,固定为 template。

  • "template"

  • InputMessagesItemReference object { item_reference, type }

  • item_reference: string

对 item 命名空间中变量的引用,例如 "item.name"。

  • type: "item_reference"

输入消息类型,固定为 item_reference。

  • "item_reference"

  • model: optional string

用于生成补全内容的模型名称,例如 "o3-mini"。

  • sampling_params: optional object { max_completion_tokens, reasoning_effort, seed, 4 more }

  • max_completion_tokens: optional integer

生成输出的最大词元数。

  • reasoning_effort: optional ReasoningEffort or null (default: "medium")

限制推理模型的推理强度。当前支持 none、minimal、low、medium、high、xhigh 和 max。 降低推理强度可能加快响应,并减少响应中用于 推理的词元数。并非所有推理模型都支持每个 取值。各模型的支持情况请参阅 推理指南 中的说明。

  • seed: optional integer (default: 42)

采样时用于初始化随机性的种子值。

  • temperature: optional number (default: 1)

较高的 temperature 会增加输出的随机性。

  • text: optional object { format }

模型文本响应的配置选项,可以是纯 文本或结构化 JSON 数据。更多信息:

  • format: optional ResponseFormatTextConfig

指定模型必须输出的格式的对象。

配置 { "type": "json_schema" } 会启用结构化输出, 确保模型遵循你提供的 JSON Schema。更多信息参阅 结构化输出指南。

默认格式为 { "type": "text" },没有额外选项。

不建议用于 gpt-4o 及后续模型:

设为 { "type": "json_object" } 会启用旧版 JSON 模式, 确保模型生成有效的 JSON。对于支持的模型,优先使用 json_schema 格式。

  • ResponseFormatText object { type }

默认响应格式,用于生成文本响应。

  • ResponseFormatTextJSONSchemaConfig object { name, schema, type, 2 more }

JSON Schema 响应格式,用于生成结构化 JSON 响应。 参阅结构化输出。

  • name: string

响应格式的名称,须使用 a-z、A-Z、0-9,或包含 下划线和连字符,最长为 64 个字符。

  • schema: map[unknown]

以 JSON Schema 对象描述的响应格式模式。 JSON Schema 的构建方法参阅此处。

  • type: "json_schema"

定义的响应格式类型,固定为 json_schema。

  • "json_schema"

  • description: optional string

响应格式的用途描述,模型据此 判断如何按该格式响应。

  • strict: optional boolean or null (default: false)

生成输出时是否启用严格模式遵循。 设为 true 时,模型始终严格遵循 schema 字段中定义的模式。strict 为 true 时仅支持 JSON Schema 的子集。更多信息请参阅结构化输出 指南。

  • ResponseFormatJSONObject object { type }

JSON 对象响应格式,是生成 JSON 响应的较早方式。 对于支持的模型,建议使用 json_schema。注意: 须在系统消息或用户消息中指示模型生成 JSON, 模型才会生成 JSON。

  • tools: optional array of Function { name, parameters, strict, 6 more } or FileSearch { type, vector_store_ids, filters, 2 more } or Computer { type } or 13 more

模型生成响应时可以调用的工具数组。你 可以通过 tool_choice 参数指定要使用的工具。

可向模型提供以下两类工具:

  • 内置工具:由 OpenAI 提供,用于扩展 模型能力,例如网页搜索 或文件搜索。更多信息参阅 内置工具。
  • 函数调用(自定义工具):由你定义的函数, 使模型可以调用你自己的代码。更多信息参阅 函数调用。

  • Function object { name, parameters, strict, 6 more }

定义模型可以选择调用的自有代码函数。参阅函数调用。

  • name: string

要调用的函数名称。

  • parameters: map[unknown] or null

描述函数参数的 JSON Schema 对象。

  • strict: boolean or null

是否对此函数工具强制执行严格参数校验。

  • type: "function" (default: "function")

函数工具类型,固定为 function。

  • "function"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

  • "direct"

  • "programmatic"

  • async: optional boolean

  • defer_loading: optional boolean

此函数是否延迟加载并通过工具搜索加载。

  • description: optional string or null

函数描述,模型据此判断是否调用该函数。

  • output_schema: optional map[unknown] or null

描述此函数字符串输出中编码的 JSON 值的 JSON Schema 对象。

  • FileSearch object { type, vector_store_ids, filters, 2 more }

搜索已上传文件中相关内容的工具。参阅文件搜索工具。

  • type: "file_search" (default: "file_search")

文件搜索工具类型,固定为 file_search。

  • "file_search"

  • vector_store_ids: array of string

要搜索的向量存储 ID 列表。

  • filters: optional ComparisonFilter or CompoundFilter or null

要应用的筛选条件。

  • ComparisonFilter object { key, type, value }

使用指定比较运算,将某个属性键与给定值比较的筛选条件。

  • key: string

要与值比较的属性键。

  • type: "eq" or "ne" or "gt" or 5 more (default: "eq")

指定比较运算符:eq、ne、gt、gte、lt、lte、in、nin。

  • eq:等于
  • ne:不等于
  • gt:大于
  • gte:大于或等于
  • lt:小于
  • lte:小于或等于
  • in:属于
  • nin:不属于

  • "eq"

  • "ne"

  • "gt"

  • "gte"

  • "lt"

  • "lte"

  • "in"

  • "nin"

  • value: string or number or boolean or array of string or number

用于与属性键比较的值,支持字符串、数字或布尔类型。

  • string

  • number

  • boolean

  • array of string or number

  • string

  • number

  • CompoundFilter object { filters, type }

使用 and 或 or 组合多个筛选条件。

  • filters: array of ComparisonFilter or CompoundFilter

要组合的筛选条件数组,条目可以是 ComparisonFilter 或 CompoundFilter。

  • ComparisonFilter object { key, type, value }

使用指定比较运算,将某个属性键与给定值比较的筛选条件。

  • CompoundFilter object { filters, type }

使用 and 或 or 组合多个筛选条件。

  • type: "and" or "or"

运算类型:and 或 or。

  • "and"

  • "or"

  • max_num_results: optional integer

返回结果数量上限,须介于 1–50 之间,含边界。

  • ranking_options: optional object { hybrid_search, ranker, score_threshold }

搜索结果的排序选项。

  • hybrid_search: optional object { embedding_weight, text_weight }

启用混合搜索时,控制倒数排名融合如何平衡语义嵌入匹配与稀疏关键词匹配的权重。

  • embedding_weight: number

嵌入在倒数排名融合中的权重。

  • text_weight: number

文本在倒数排名融合中的权重。

  • ranker: optional "auto" or "default-2024-11-15"

文件搜索所用的排序器。

  • "auto"

  • "default-2024-11-15"

  • score_threshold: optional number

文件搜索的分数阈值,为 0–1 之间的数字。越接近 1,越倾向于只返回最相关的结果,但返回数量可能减少。

  • Computer object { type }

控制虚拟计算机的工具。参阅计算机工具。

  • type: "computer" (default: "computer")

计算机工具类型,固定为 computer。

  • "computer"

  • ComputerUsePreview object { display_height, display_width, environment, type }

控制虚拟计算机的工具。参阅计算机工具。

  • display_height: integer

计算机显示区域的高度。

  • display_width: integer

计算机显示区域的宽度。

  • environment: "windows" or "mac" or "linux" or 2 more

要控制的计算机环境类型。

  • "windows"

  • "mac"

  • "linux"

  • "ubuntu"

  • "browser"

  • type: "computer_use_preview" (default: "computer_use_preview")

计算机使用工具类型,固定为 computer_use_preview。

  • "computer_use_preview"

  • WebSearch object { type, external_web_access, filters, 2 more }

在互联网上搜索与提示词相关的信息来源。参阅 网络搜索工具时。

  • type: "web_search" or "web_search_2025_08_26" (default: "web_search")

网页搜索工具类型,可选 web_search 或 web_search_2025_08_26。

  • "web_search"

  • "web_search_2025_08_26"

  • external_web_access: optional boolean (default: true)

是否允许网页搜索实时访问互联网。省略时默认为 true。设为 false 时,网页搜索工具以离线或仅缓存模式运行,不会抓取新的外部内容。

  • filters: optional object { allowed_domains } or null

搜索的筛选条件。

  • allowed_domains: optional array of string or null (default: [])

搜索允许的域名。未提供时允许所有域名。 也允许访问所提供域名的子域名。

示例:["pubmed.ncbi.nlm.nih.gov"]

  • search_context_size: optional "low" or "medium" or "high" (default: "medium")

对搜索占用上下文窗口空间大小的总体指导,可选 low、medium 或 high,默认为 medium。

  • "low"

  • "medium"

  • "high"

  • user_location: optional object { city, country, region, 2 more } or null

用户的大致位置。省略或设为 null 时,默认为 美国。若要避免此默认值,可传入不包含位置字段的 {"type": "approximate"}。 若要本地化结果,须提供相应位置字段。

  • city: optional string or null

用户所在城市的自由文本,例如 San Francisco。

  • country: optional string or null

用户所在国家/地区的两字母 ISO 代码,例如 US。

  • region: optional string or null

用户所在地区的自由文本,例如 California。

  • timezone: optional string or null

用户所在的 IANA 时区,例如 America/Los_Angeles。

  • type: optional "approximate" (default: "approximate")

位置估算类型,固定为 approximate。

  • "approximate"

  • Mcp object { server_label, type, allowed_callers, 9 more }

通过远程模型上下文协议(MCP)服务器, 向模型提供额外工具。了解 MCP。

  • server_label: string

此 MCP 服务器的标签,用于在工具调用中标识服务器。

  • type: "mcp"

MCP 工具类型,固定为 mcp。

  • "mcp"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • allowed_tools: optional array of string or McpToolFilter { read_only, tool_names } or null

允许的工具名称列表或筛选对象。

  • McpAllowedTools = array of string

允许的工具名称组成的字符串数组。

  • McpToolFilter object { read_only, tool_names }

用于指定允许哪些工具的筛选对象。

  • read_only: optional boolean

表示工具会修改数据还是只读。如果 MCP 服务器标注了 readOnlyHint, 就会与此筛选条件匹配。

  • tool_names: optional array of string

允许的工具名称列表。

  • authorization: optional string

可用于远程 MCP 服务器的 OAuth 访问令牌,既可 配合自定义 MCP 服务器 URL,也可配合服务连接器。你的应用 须处理 OAuth 授权流程,并在此提供令牌。

  • connector_id: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 5 more

服务连接器的标识,例如 ChatGPT 中提供的连接器。须提供 server_url、connector_id 或 tunnel_id 中的一项。更多 服务连接器信息参阅此处。

对于 2026 年 9 月 1 日之后发布的模型,此字段已弃用。 使用 server_url 连接远程 MCP 服务器,或使用 tunnel_id 通过安全 MCP 隧道连接。

当前支持的 connector_id 值如下:

  • Dropbox:connector_dropbox
  • Gmail:connector_gmail
  • Google 日历:connector_googlecalendar
  • Google 云端硬盘:connector_googledrive
  • Microsoft Teams:connector_microsoftteams
  • Outlook 日历:connector_outlookcalendar
  • Outlook 邮箱:connector_outlookemail
  • SharePoint:connector_sharepoint

  • "connector_dropbox"

  • "connector_gmail"

  • "connector_googlecalendar"

  • "connector_googledrive"

  • "connector_microsoftteams"

  • "connector_outlookcalendar"

  • "connector_outlookemail"

  • "connector_sharepoint"

  • defer_loading: optional boolean

此 MCP 工具是否延迟加载并通过工具搜索发现。

  • headers: optional map[string] or null

可选的发送给 MCP 服务器的 HTTP 请求头,用于认证 或其他用途。

  • require_approval: optional McpToolApprovalFilter { always, never } or "always" or "never" or null (default: "always")

指定 MCP 服务器的哪些工具需要批准。

  • McpToolApprovalFilter object { always, never }

指定 MCP 服务器的哪些工具需要批准。可以是 always、never,或与需要批准的工具关联的 筛选对象。

  • always: optional object { read_only, tool_names }

用于指定允许哪些工具的筛选对象。

  • read_only: optional boolean

表示工具会修改数据还是只读。如果 MCP 服务器标注了 readOnlyHint, 就会与此筛选条件匹配。

  • tool_names: optional array of string

允许的工具名称列表。

  • never: optional object { read_only, tool_names }

用于指定允许哪些工具的筛选对象。

  • read_only: optional boolean

表示工具会修改数据还是只读。如果 MCP 服务器标注了 readOnlyHint, 就会与此筛选条件匹配。

  • tool_names: optional array of string

允许的工具名称列表。

  • McpToolApprovalSetting = "always" or "never"

为所有工具指定统一的批准策略,可选 always 或 never。设为 always 时,所有工具均需要批准; 设为 never 时,所有工具均不需要批准。

  • "always"

  • "never"

  • server_description: optional string

MCP 服务器的可选描述,用于提供更多上下文。

  • server_url: optional string

MCP 服务器的 URL。须提供 server_url、connector_id 或 tunnel_id 中的一项。

format: uri

  • tunnel_id: optional string

用来替代直接服务器 URL 的安全 MCP 隧道 ID。须提供 server_url、connector_id 或 tunnel_id 中的一项。

pattern: ^tunnel_[a-z0-9]{32}$

  • CodeInterpreter object { container, type, allowed_callers }

运行 Python 代码以帮助生成提示词响应的工具。

  • container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }

代码解释器容器,可以是容器 ID,也可以是 指定代码可用的已上传文件 ID 的对象,同时可提供 可选的 memory_limit 设置。

  • string

容器 ID。

  • CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }

代码解释器容器配置,可以指定运行代码时所处理的文件 ID。

  • type: "auto" (default: "auto")

固定为 auto。

  • "auto"

  • file_ids: optional array of string

可选的已上传文件列表,这些文件将提供给代码使用。

maxItems: 50

  • memory_limit: optional "1g" or "4g" or "16g" or "64g" or null

代码解释器容器的内存上限。

  • "1g"

  • "4g"

  • "16g"

  • "64g"

  • network_policy: optional ContainerNetworkPolicyDisabled or ContainerNetworkPolicyAllowlist

容器的网络访问策略。

  • ContainerNetworkPolicyDisabled object { type }

  • type: "disabled" (default: "disabled")

禁用出站网络访问,固定为 disabled。

  • "disabled"

  • ContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }

  • allowed_domains: array of string

type 为 allowlist 时允许访问的域名列表。

minItems: 1

  • type: "allowlist" (default: "allowlist")

仅允许对指定域名发起出站网络访问,固定为 allowlist。

  • "allowlist"

  • domain_secrets: optional array of ContainerNetworkPolicyDomainSecret

可选的仅用于允许访问域名的域名级密钥。

minItems: 1

  • domain: string

密钥关联的域名。

minLength: 1

  • name: string

要为该域名注入的密钥名称。

minLength: 1

  • value: string

要为该域名注入的密钥值。

minLength: 1, maxLength: 10485760

  • type: "code_interpreter"

代码解释器工具类型,固定为 code_interpreter。

  • "code_interpreter"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • ProgrammaticToolCalling object { type }

  • type: "programmatic_tool_calling" (default: "programmatic_tool_calling")

工具类型,固定为 programmatic_tool_calling。

  • "programmatic_tool_calling"

  • ImageGeneration object { type, action, background, 13 more }

使用 GPT 图像模型生成图像的工具。

  • type: "image_generation"

图像生成工具类型,固定为 image_generation。

  • "image_generation"

  • action: optional "generate" or "edit" or "auto"

生成新图像还是编辑已有图像,默认为 auto。

  • "generate"

  • "edit"

  • "auto"

  • background: optional "transparent" or "opaque" or "auto" (default: "auto")

生成图像的背景,可选 transparent、opaque, 或 auto。gpt-image-2.5-sunburst 和 gpt-image-2.5-flare,包括 对应的 2026-09-08 快照,支持 opaque 和 transparent 背景。受支持的 GPT Image 模型可以使用透明 背景。对于 gpt-image-2 和 gpt-image-2-2026-04-21,此功能处于 预览阶段。使用 transparent 时,须将输出格式设为 png 或 webp。 默认为 auto。

  • "transparent"

  • "opaque"

  • "auto"

  • complexity: optional "low" or "medium" or "high"

用于规划图像的计算投入,与渲染质量分开设置。 覆盖外层响应用于图像生成的 reasoning.effort。 省略时,继承外层受支持的推理强度,或使用 图像模型配置的默认值。 对于 SVG 输出,此项控制参考图像,而不是 SVG 生成模型的 推理。

  • "low"

  • "medium"

  • "high"

  • frame_count: optional integer (default: 9)

GIF 帧数,要求 output_format 为 gif,默认为 9。

minimum: 2, maximum: 16

  • frame_duration_ms: optional integer (default: 200)

每个 GIF 帧的时长,单位为毫秒,取整到 10 毫秒。 要求 output_format 为 gif,默认为 200。

minimum: 20, maximum: 2000

  • input_fidelity: optional "high" or "low" or null

控制模型为匹配输入图像风格和特征(尤其是面部特征)投入的程度。gpt-image-1.5 支持 high 和 low,gpt-image-1-mini 仅支持 low。使用 gpt-image-2 时应省略此参数。支持该参数的模型默认为 low。

  • "high"

  • "low"

  • input_image_mask: optional object { file_id, image_url }

可选的局部重绘蒙版,包含 image_url (可选字符串)和 file_id(可选字符串)。

  • file_id: optional string

蒙版图像的文件 ID。

  • image_url: optional string

采用 Base64 编码的蒙版图像。

  • model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-2" or 9 more

用于图像生成的模型,可选 gpt-image-1-mini、 gpt-image-1.5, gpt-image-2, gpt-image-2-2026-04-21、gpt-image-2.5-sunburst、 gpt-image-2.5-sunburst-2026-09-08、gpt-image-2.5-flare、 gpt-image-2.5-flare-2026-09-08, gpt-image-2.6-sunburst, gpt-image-2.6-flare 或 chatgpt-image-latest。默认值: gpt-image-2.6-sunburst.

gpt-image-1 已于 2026 年 10 月 23 日停用,请使用 gpt-image-2.5-sunburst 或 gpt-image-2.5-flare。

  • string

  • "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-2" or 9 more

用于图像生成的模型,可选 gpt-image-1-mini、 gpt-image-1.5, gpt-image-2, gpt-image-2-2026-04-21、gpt-image-2.5-sunburst、 gpt-image-2.5-sunburst-2026-09-08、gpt-image-2.5-flare、 gpt-image-2.5-flare-2026-09-08, gpt-image-2.6-sunburst, gpt-image-2.6-flare 或 chatgpt-image-latest。默认值: gpt-image-2.6-sunburst.

gpt-image-1 已于 2026 年 10 月 23 日停用,请使用 gpt-image-2.5-sunburst 或 gpt-image-2.5-flare。

  • "gpt-image-1"

  • "gpt-image-1-mini"

  • "gpt-image-2"

  • "gpt-image-2-2026-04-21"

  • "gpt-image-2.5-sunburst"

  • "gpt-image-2.5-sunburst-2026-09-08"

  • "gpt-image-2.5-flare"

  • "gpt-image-2.5-flare-2026-09-08"

  • "gpt-image-2.6-sunburst"

  • "gpt-image-2.6-flare"

  • "gpt-image-1.5"

  • "chatgpt-image-latest"

  • moderation: optional "auto" or "low" (default: "auto")

生成图像的审核级别,默认为 auto。

  • "auto"

  • "low"

  • output_compression: optional integer (default: 100)

输出图像的压缩级别,默认为 100。

minimum: 0, maximum: 100

  • output_format: optional "png" or "webp" or "jpeg" or 2 more (default: "png")

输出图像格式,可选 png、webp、jpeg、 gif 或 svg,默认为 png。GIF 和 SVG 输出要求模型 支持所选格式。GIF 输出不支持 部分图像流式传输,即 partial_images 大于 0, 也不支持 input_image_mask 或自定义 output_compression。 GIF 输出仍可以流式发送 Responses 生命周期事件。

  • "png"

  • "webp"

  • "jpeg"

  • "gif"

  • "svg"

  • partial_images: optional integer (default: 0)

流式模式中生成的部分图像数量,范围为 0(默认值)到 3。

minimum: 0, maximum: 3

  • quality: optional "low" or "medium" or "high" or 3 more (default: "auto")

生成图像的质量。GPT 图像模型支持 low、 medium 和 high。gpt-image-2.5-sunburst 和 gpt-image-2.5-flare, 包括对应的 2026-09-08 快照,还支持 xhigh 和 max。 默认为 auto。

  • "low"

  • "medium"

  • "high"

  • "xhigh"

  • "max"

  • "auto"

  • size: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "auto" (default: "auto")

生成图像的尺寸。gpt-image-2、gpt-image-2-2026-04-21、gpt-image-2.5-sunburst、gpt-image-2.5-sunburst-2026-09-08、gpt-image-2.5-flare 和 gpt-image-2.5-flare-2026-09-08 支持以 WIDTHxHEIGHT 字符串指定任意分辨率,例如 1536x864。宽和高均须能被 16 整除,宽高比须在 1:3 至 3:1 之间。高于 2560x1440 的分辨率属于实验功能,支持的最高分辨率为 3840x2160。尺寸还须符合模型当前的像素数与边长限制。GPT Image 模型支持标准尺寸 1024x1024、1536x1024 和 1024x1536;允许自动尺寸的模型支持 auto。

  • string

  • "1024x1024" or "1024x1536" or "1536x1024" or "auto"

生成图像的尺寸。gpt-image-2、gpt-image-2-2026-04-21、gpt-image-2.5-sunburst、gpt-image-2.5-sunburst-2026-09-08、gpt-image-2.5-flare 和 gpt-image-2.5-flare-2026-09-08 支持以 WIDTHxHEIGHT 字符串指定任意分辨率,例如 1536x864。宽和高均须能被 16 整除,宽高比须在 1:3 至 3:1 之间。高于 2560x1440 的分辨率属于实验功能,支持的最高分辨率为 3840x2160。尺寸还须符合模型当前的像素数与边长限制。GPT Image 模型支持标准尺寸 1024x1024、1536x1024 和 1024x1536;允许自动尺寸的模型支持 auto。

  • "1024x1024"

  • "1024x1536"

  • "1536x1024"

  • "auto"

  • svg: optional object { model, reasoning }

SVG 生成模型的设置,要求 output_format 为 svg。 启用 SVG 模型选择时,省略此对象会使用 外层响应模型。否则使用默认 SVG 生成模型,且 不能显式覆盖模型。

  • model: optional string

minLength: 1

  • reasoning: optional object { effort } or null

SVG 编写的推理强度。省略时,Images 和 Responses 均使用编写模型的默认值。

  • effort: optional "none" or "minimal" or "low" or 4 more

控制模型为此次请求投入的推理强度。

  • "none"

  • "minimal"

  • "low"

  • "medium"

  • "high"

  • "xhigh"

  • "max"

  • LocalShell object { type }

允许模型在本地环境执行 shell 命令的工具。

  • type: "local_shell" (default: "local_shell")

本地 shell 工具类型,固定为 local_shell。

  • "local_shell"

  • Shell object { type, allowed_callers, environment }

允许模型执行 shell 命令的工具。

  • type: "shell" (default: "shell")

shell 工具类型,固定为 shell。

  • "shell"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • environment: optional ContainerAuto or LocalEnvironment or ContainerReference or null

  • ContainerAuto object { type, file_ids, memory_limit, 2 more }

  • type: "container_auto" (default: "container_auto")

为此请求自动创建容器。

  • "container_auto"

  • file_ids: optional array of string

可选的已上传文件列表,这些文件将提供给代码使用。

maxItems: 50

  • memory_limit: optional "1g" or "4g" or "16g" or "64g" or null

容器的内存上限。

  • "1g"

  • "4g"

  • "16g"

  • "64g"

  • network_policy: optional ContainerNetworkPolicyDisabled or ContainerNetworkPolicyAllowlist

容器的网络访问策略。

  • ContainerNetworkPolicyDisabled object { type }

  • ContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }

  • skills: optional array of SkillReference or InlineSkill

可选的技能列表,通过 ID 或内联数据引用技能。

maxItems: 200

  • SkillReference object { skill_id, type, version }

  • skill_id: string

引用的技能 ID。

minLength: 1, maxLength: 64

  • type: "skill_reference" (default: "skill_reference")

引用通过 /v1/skills 接口创建的技能。

  • "skill_reference"

  • version: optional string

可选的技能版本。使用正整数或 'latest',省略时使用默认版本。

  • InlineSkill object { description, name, source, type }

  • description: string

技能描述。

  • name: string

技能名称。

  • source: InlineSkillSource

内联技能载荷。

  • data: string

采用 Base64 编码的技能 ZIP 包。

minLength: 1, maxLength: 70254592

  • media_type: "application/zip" (default: "application/zip")

内联技能载荷的媒体类型,必须为 application/zip。

  • "application/zip"

  • type: "base64" (default: "base64")

内联技能来源的类型,必须为 base64。

  • "base64"

  • type: "inline" (default: "inline")

为此请求定义内联技能。

  • "inline"

  • LocalEnvironment object { type, skills }

  • type: "local" (default: "local")

使用本地计算机环境。

  • "local"

  • skills: optional array of LocalSkill

可选的技能列表。

maxItems: 200

  • description: string

技能描述。

  • name: string

技能名称。

  • path: string

包含该技能的目录路径。

  • ContainerReference object { container_id, type }

  • container_id: string

引用的容器 ID。

  • type: "container_reference" (default: "container_reference")

引用通过 /v1/containers 接口创建的容器。

  • "container_reference"

  • Custom object { name, type, allowed_callers, 4 more }

使用指定格式处理输入的自定义工具。参阅自定义工具。

  • name: string

自定义工具的名称,用于在工具调用中标识它。

  • type: "custom" (default: "custom")

自定义工具类型,固定为 custom。

  • "custom"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • async: optional boolean

工具响应是否可以异步返回,而非在下一次创建响应时立即返回。

  • defer_loading: optional boolean

此工具是否应延迟加载并通过工具搜索发现。

  • description: optional string

自定义工具的可选描述,用于提供更多上下文。

  • format: optional CustomToolInputFormat

自定义工具的输入格式,默认为无约束文本。

  • Text object { type }

无约束的自由文本。

  • type: "text" (default: "text")

无约束文本格式,固定为 text。

  • "text"

  • Grammar object { definition, syntax, type }

用户定义的语法。

  • definition: string

语法定义。

  • syntax: "lark" or "regex"

语法定义的语法类型,可选 lark 或 regex。

  • "lark"

  • "regex"

  • type: "grammar" (default: "grammar")

语法格式,固定为 grammar。

  • "grammar"

  • Namespace object { description, name, tools, type }

将函数工具或自定义工具归入共享命名空间。

  • description: string

展示给模型的命名空间描述。

  • name: string

工具调用使用的命名空间名称,例如 crm。

minLength: 1

  • tools: array of Function { name, type, allowed_callers, 6 more } or Custom { name, type, allowed_callers, 4 more }

此命名空间内可用的函数工具或自定义工具。

minItems: 1

  • Function object { name, type, allowed_callers, 6 more }

  • name: string

pattern: ^[a-zA-Z0-9_-]+$, minLength: 1, maxLength: 128

  • type: "function" (default: "function")

  • "function"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • async: optional boolean

工具响应是否可以异步返回,而非在下一次创建响应时立即返回。

  • defer_loading: optional boolean

此函数是否应延迟加载并通过工具搜索发现。

  • description: optional string or null

  • output_schema: optional map[unknown] or null

描述此函数工具字符串输出中编码的 JSON 值的 JSON Schema,不用于描述内容数组输出。

  • parameters: optional unknown or null

  • strict: optional boolean or null

是否强制执行严格参数校验。省略时,模式兼容的情况下 Responses 会尝试严格校验,否则退回非严格校验。

  • Custom object { name, type, allowed_callers, 4 more }

使用指定格式处理输入的自定义工具。参阅自定义工具。

  • name: string

自定义工具的名称,用于在工具调用中标识它。

  • type: "custom" (default: "custom")

自定义工具类型,固定为 custom。

  • "custom"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • async: optional boolean

工具响应是否可以异步返回,而非在下一次创建响应时立即返回。

  • defer_loading: optional boolean

此工具是否应延迟加载并通过工具搜索发现。

  • description: optional string

自定义工具的可选描述,用于提供更多上下文。

  • format: optional CustomToolInputFormat

自定义工具的输入格式,默认为无约束文本。

  • type: "namespace" (default: "namespace")

工具类型,固定为 namespace。

  • "namespace"

  • ToolSearch object { type, description, execution, parameters }

用于延迟加载工具的托管工具搜索或自带工具(BYOT)搜索配置。

  • type: "tool_search" (default: "tool_search")

工具类型,固定为 tool_search。

  • "tool_search"

  • description: optional string or null

客户端执行的工具搜索工具展示给模型的描述。

  • execution: optional "server" or "client"

工具搜索由服务端还是客户端执行。

  • "server"

  • "client"

  • parameters: optional unknown or null

客户端执行的工具搜索工具的参数模式。

  • WebSearchPreview object { type, search_content_types, search_context_size, user_location }

搜索网页以获取可用于响应的相关结果的工具。参阅网页搜索工具。

  • type: "web_search_preview" or "web_search_preview_2025_03_11" (default: "web_search_preview")

网页搜索工具类型,可选 web_search_preview 或 web_search_preview_2025_03_11。

  • "web_search_preview"

  • "web_search_preview_2025_03_11"

  • search_content_types: optional array of "text" or "image"

  • "text"

  • "image"

  • search_context_size: optional "low" or "medium" or "high"

对搜索占用上下文窗口空间大小的总体指导,可选 low、medium 或 high,默认为 medium。

  • "low"

  • "medium"

  • "high"

  • user_location: optional object { type, city, country, 2 more } or null

用户的大致位置。省略或设为 null 时默认为美国。若要避免此默认值,可传入不包含位置字段的 {"type": "approximate"}。若要本地化结果,须提供相应位置字段。

  • type: "approximate" (default: "approximate")

位置估算类型,固定为 approximate。

  • "approximate"

  • city: optional string or null

用户所在城市的自由文本,例如 San Francisco。

  • country: optional string or null

用户所在国家/地区的两字母 ISO 代码,例如 US。

  • region: optional string or null

用户所在地区的自由文本,例如 California。

  • timezone: optional string or null

用户所在的 IANA 时区,例如 America/Los_Angeles。

  • ApplyPatch object { type, allowed_callers }

允许助手使用统一差异格式创建、删除或更新文件。

  • type: "apply_patch" (default: "apply_patch")

工具类型,固定为 apply_patch。

  • "apply_patch"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • top_p: optional number (default: 1)

用于核采样的参数,是 temperature 的替代方案;1.0 表示包含所有词元。

  • error: EvalAPIError or null

表示 Eval API 错误响应的对象。

  • code: string

错误代码。

  • message: string

错误消息。

  • eval_id: string

关联评测的标识。

  • metadata: Metadata or null

可附加到对象的元数据,最多包含 16 组键值对,可 以结构化方式存储对象的额外信息, 并通过 API 或控制台查询对象。

键为最多 64 个字符的字符串,值为 最多 512 个字符的字符串。

  • model: string or null

被评测的模型,如适用。

  • name: string or null

评测运行名称。

  • object: "eval.run" (default: "eval.run")

对象类型,固定为 "eval.run"。

  • "eval.run"

  • per_model_usage: array of object { cached_tokens, completion_tokens, invocation_count, 3 more } or null

评测运行期间各模型的用量统计。

  • cached_tokens: integer

从缓存读取的词元数。

  • completion_tokens: integer

生成的补全词元数。

  • invocation_count: integer

调用次数。

  • model_name: string

模型名称。

  • prompt_tokens: integer

使用的提示词词元数。

  • total_tokens: integer

使用的总词元数。

  • per_testing_criteria_results: array of object { failed, passed, testing_criteria } or null

评测运行中各测试标准的结果。

  • failed: integer

未通过此标准的测试数量。

  • passed: integer

通过此标准的测试数量。

  • testing_criteria: string

测试标准的描述。

  • report_url: string

在控制台界面中呈现评测运行报告的 URL。

format: uri

  • result_counts: object { errored, failed, passed, total }

汇总评测运行结果的计数器。

  • errored: integer

因错误而失败的输出条目数量。

  • failed: integer

未通过评测的输出条目数量。

  • passed: integer

通过评测的输出条目数量。

  • total: integer

已执行的输出条目总数。

  • status: string

评测运行状态。

示例

## 设置 OPENAI_API_KEY,并将评测 ID 和运行 ID 替换为实际值。
curl https://api.openai.com/v1/evals/$EVAL_ID/runs/$RUN_ID \
    -H "Authorization: Bearer $OPENAI_API_KEY"

200 响应示例

{
  "id": "id",
  "created_at": 0,
  "data_source": {
    "source": {
      "content": [
        {
          "item": {
            "foo": "bar"
          },
          "sample": {
            "foo": "bar"
          }
        }
      ],
      "type": "file_content"
    },
    "type": "jsonl"
  },
  "error": {
    "code": "code",
    "message": "message"
  },
  "eval_id": "eval_id",
  "metadata": {
    "foo": "string"
  },
  "model": "model",
  "name": "name",
  "object": "eval.run",
  "per_model_usage": [
    {
      "cached_tokens": 0,
      "completion_tokens": 0,
      "invocation_count": 0,
      "model_name": "model_name",
      "prompt_tokens": 0,
      "total_tokens": 0
    }
  ],
  "per_testing_criteria_results": [
    {
      "failed": 0,
      "passed": 0,
      "testing_criteria": "testing_criteria"
    }
  ],
  "report_url": "https://example.com",
  "result_counts": {
    "errored": 0,
    "failed": 0,
    "passed": 0,
    "total": 0
  },
  "status": "status"
}

示例

## 设置 OPENAI_API_KEY,并将评测 ID 和运行 ID 替换为实际值。
curl https://api.openai.com/v1/evals/eval_67abd54d9b0081909a86353f6fb9317a/runs/evalrun_67abd54d60ec8190832b46859da808f7 \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json"

响应示例

{
  "object": "eval.run",
  "id": "evalrun_67abd54d60ec8190832b46859da808f7",
  "eval_id": "eval_67abd54d9b0081909a86353f6fb9317a",
  "report_url": "https://platform.openai.com/evaluations/eval_67abd54d9b0081909a86353f6fb9317a?run_id=evalrun_67abd54d60ec8190832b46859da808f7",
  "status": "queued",
  "model": "gpt-6-astra",
  "name": "gpt-6-astra",
  "created_at": 1743092069,
  "result_counts": {
    "total": 0,
    "errored": 0,
    "failed": 0,
    "passed": 0
  },
  "per_model_usage": null,
  "per_testing_criteria_results": null,
  "data_source": {
    "type": "completions",
    "source": {
      "type": "file_content",
      "content": [
        {
          "item": {
            "input": "科技公司推出先进的人工智能平台",
            "ground_truth": "Technology"
          }
        },
        {
          "item": {
            "input": "通胀担忧之际,央行提高利率",
            "ground_truth": "Markets"
          }
        },
        {
          "item": {
            "input": "国际峰会讨论应对气候变化的策略",
            "ground_truth": "World"
          }
        },
        {
          "item": {
            "input": "大型零售商公布创纪录的假日销售额",
            "ground_truth": "Business"
          }
        },
        {
          "item": {
            "input": "国家队晋级世界锦标赛决赛",
            "ground_truth": "Sports"
          }
        },
        {
          "item": {
            "input": "利好经济数据公布后股市上涨",
            "ground_truth": "Markets"
          }
        },
        {
          "item": {
            "input": "全球制造商宣布与竞争对手合并",
            "ground_truth": "Business"
          }
        },
        {
          "item": {
            "input": "可再生能源技术取得突破",
            "ground_truth": "Technology"
          }
        },
        {
          "item": {
            "input": "各国领导人签署历史性气候协议",
            "ground_truth": "World"
          }
        },
        {
          "item": {
            "input": "职业运动员在锦标赛中刷新纪录",
            "ground_truth": "Sports"
          }
        },
        {
          "item": {
            "input": "金融机构适应新的监管要求",
            "ground_truth": "Business"
          }
        },
        {
          "item": {
            "input": "科技大会展示人工智能领域的进展",
            "ground_truth": "Technology"
          }
        },
        {
          "item": {
            "input": "全球市场对油价波动作出反应",
            "ground_truth": "Markets"
          }
        },
        {
          "item": {
            "input": "新条约加强国际合作",
            "ground_truth": "World"
          }
        },
        {
          "item": {
            "input": "体育联盟公布新赛季调整后的赛程",
            "ground_truth": "Sports"
          }
        }
      ]
    },
    "input_messages": {
      "type": "template",
      "template": [
        {
          "type": "message",
          "role": "developer",
          "content": {
            "type": "input_text",
            "text": "将给定新闻标题归入以下主题之一:Technology(科技)、Markets(市场)、World(国际)、Business(商业)或 Sports(体育)。\n\n# 步骤\n\n1. 分析新闻标题的内容,理解其主要关注点。\n2. 提取主题,找出关键线索或关键词。\n3. 根据这些线索,从 Technology、Markets、World、Business、Sports 五个选项中选择最合适的类别。\n4. 每个标题只能选择一个类别。\n\n# 输出格式\n\n仅返回所选类别的一个英文单词,例如:\"Technology\"、\"Markets\"、\"World\"、\"Business\" 或 \"Sports\"。\n\n# 示例\n\n**输入**:\"苹果发布搭载先进 AI 功能的新款 iPhone\"  \n**输出**:\"Technology\"\n\n**输入**:\"投资者等待央行决议,全球股市涨跌互现\"  \n**输出**:\"Markets\"\n\n**输入**:\"乌克兰战争:谈判进展最新消息\"  \n**输出**:\"World\"\n\n**输入**:\"微软洽谈以 20 亿美元收购游戏公司\"  \n**输出**:\"Business\"\n\n**输入**:\"曼联赢得英超足球比赛\"  \n**输出**:\"Sports\" \n\n# 注意\n\n- 如果标题似乎符合多个类别,选择最主要的主题。\n- “股票”“公司收购”“比赛”等关键词或短语,以及科技品牌,都可以作为分类线索。\n"
          }
        },
        {
          "type": "message",
          "role": "user",
          "content": {
            "type": "input_text",
            "text": "{{item.input}}"
          }
        }
      ]
    },
    "model": "gpt-6-astra",
    "sampling_params": {
      "max_completions_tokens": 2048
    }
  },
  "error": null,
  "metadata": {}
}

资源类型

创建评测补全运行数据源

  • CreateEvalCompletionsRunDataSource object { source, type, input_messages, 2 more }

描述模型采样配置的 CompletionsRunDataSource 对象。

  • source: EvalJSONLFileContentSource { content, type } or EvalJSONLFileIDSource { id, type } or StoredCompletionsRunDataSource { type, created_after, created_before, 3 more }

决定本次运行数据源中 item 命名空间的内容。

  • EvalJSONLFileContentSource object { content, type }

  • content: array of object { item, sample }

JSONL 文件的内容。

  • item: map[unknown]

  • sample: optional map[unknown]

  • type: "file_content" (default: "file_content")

JSONL 来源的类型,固定为 file_content。

  • "file_content"

  • EvalJSONLFileIDSource object { id, type }

  • id: string

文件标识。

  • type: "file_id" (default: "file_id")

JSONL 来源的类型,固定为 file_id。

  • "file_id"

  • StoredCompletionsRunDataSource object { type, created_after, created_before, 3 more }

描述一组筛选条件的 StoredCompletionsRunDataSource 配置。

  • type: "stored_completions" (default: "stored_completions")

来源类型,固定为 stored_completions。

  • "stored_completions"

  • created_after: optional integer or null

可选的 Unix 时间戳,用于筛选在此时间之后创建的条目。

  • created_before: optional integer or null

可选的 Unix 时间戳,用于筛选在此时间之前创建的条目。

  • limit: optional integer or null

可选的返回条目数量上限。

  • metadata: optional Metadata or null

可附加到对象的元数据,最多包含 16 组键值对,可 以结构化方式存储对象的额外信息, 并通过 API 或控制台查询对象。

键为最多 64 个字符的字符串,值为 最多 512 个字符的字符串。

  • model: optional string or null

可选的模型筛选条件,例如 'gpt-6-astra'。

  • type: "completions" (default: "completions")

运行数据源类型,固定为 completions。

  • "completions"

  • input_messages: optional TemplateInputMessages { template, type } or ItemReferenceInputMessages { item_reference, type }

从模型采样时使用,规定传给模型的消息结构。可以引用预先构建的轨迹,例如 item.input_trajectory,也可以使用包含 item 命名空间变量引用的模板。

  • TemplateInputMessages object { template, type }

  • template: array of EasyInputMessage or EvalMessageObject { content, role, type }

构成提示词或上下文的聊天消息列表,可以包含对 item 命名空间的变量引用,例如 {{item.name}}。

  • EasyInputMessage object { content, role, phase, type }

输入模型的消息,其角色表示指令遵循的 优先级。以 developer 或 system 角色给出的指令 优先于 user 角色给出的指令。 assistant 角色的消息被视为模型在此前 交互中生成的内容。

  • content: string or ResponseInputMessageContentList

用于生成响应的文本、图像或音频输入。 也可以包含此前的助手响应。

  • TextInput = string

输入模型的文本。

  • ResponseInputMessageContentList = array of ResponseInputContent

输入模型的一个或多个条目的列表,可以包含不同 内容类型。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • text: string

输入模型的文本。

  • type: "input_text" (default: "input_text")

输入条目类型,固定为 input_text。

  • "input_text"

  • prompt_cache_breakpoint: optional object { mode, ttl }

标记可复用提示词前缀的精确结束位置。省略 ttl 时,断点继承请求中的 prompt_cache_options.ttl;该边界不会按词元块取整。

  • mode: "explicit" (default: "explicit")

断点模式,固定为 explicit。

  • "explicit"

  • ttl: optional "30m" or "12h"

此缓存断点的最短存续时间,默认为请求的 TTL。

  • "30m"

  • "12h"

  • ResponseInputImage object { detail, type, file_id, 2 more }

输入模型的图像。参阅图像输入。

  • detail: ImageDetail

发送给模型的图像细节级别,可选 high、low、auto 或 original,默认为 auto。

  • "low"

  • "high"

  • "auto"

  • "original"

  • type: "input_image" (default: "input_image")

输入条目类型,固定为 input_image。

  • "input_image"

  • file_id: optional string or null

要发送给模型的文件 ID。

  • image_url: optional string or null

要发送给模型的图像 URL,可以是完整 URL,或包含 Base64 编码图像的 data URL。

format: uri

  • prompt_cache_breakpoint: optional object { mode, ttl }

标记可复用提示词前缀的精确结束位置。省略 ttl 时,断点继承请求中的 prompt_cache_options.ttl;该边界不会按词元块取整。

  • mode: "explicit" (default: "explicit")

断点模式,固定为 explicit。

  • "explicit"

  • ttl: optional "30m" or "12h"

此缓存断点的最短存续时间,默认为请求的 TTL。

  • "30m"

  • "12h"

  • ResponseInputFile object { type, detail, file_data, 4 more }

输入模型的文件。

  • type: "input_file" (default: "input_file")

输入条目类型,固定为 input_file。

  • "input_file"

  • detail: optional "auto" or "low" or "high"

发送给模型的文件细节级别。使用 auto 由系统选择;对于 GPT-5.6 及后续模型,auto 使用高质量渲染,可能增加输入词元用量。使用 low 进行成本较低的渲染,或使用 high 以更高质量渲染文件。默认为 auto。

  • "auto"

  • "low"

  • "high"

  • file_data: optional string

要发送给模型的文件内容。

  • file_id: optional string or null

要发送给模型的文件 ID。

  • file_url: optional string

要发送给模型的文件 URL。

format: uri

  • filename: optional string

要发送给模型的文件名。

  • prompt_cache_breakpoint: optional object { mode, ttl }

标记可复用提示词前缀的精确结束位置。省略 ttl 时,断点继承请求中的 prompt_cache_options.ttl;该边界不会按词元块取整。

  • mode: "explicit" (default: "explicit")

断点模式,固定为 explicit。

  • "explicit"

  • ttl: optional "30m" or "12h"

此缓存断点的最短存续时间,默认为请求的 TTL。

  • "30m"

  • "12h"

  • role: "user" or "assistant" or "system" or "developer"

输入消息的角色,可选 user、assistant、system 或 developer.

  • "user"

  • "assistant"

  • "system"

  • "developer"

  • phase: optional "commentary" or "final_answer" or null

将 assistant 消息标记为中间说明(commentary)或最终答案(final_answer)。 对于 gpt-5.3-codex 及后续此类模型,发送后续请求时,须保留并重新发送 所有助手消息的 phase;丢弃它可能降低表现。用户消息不使用此字段。

  • "commentary"

  • "final_answer"

  • type: optional "message"

输入消息类型,固定为 message。

  • "message"

  • EvalMessageObject object { content, role, type }

输入模型的消息,其角色表示指令遵循的 优先级。以 developer 或 system 角色给出的指令 优先于 user 角色给出的指令。 assistant 角色的消息被视为模型在此前 交互中生成的内容。

  • content: string or ResponseInputText or OutputText { text, type } or 3 more

模型输入,可以包含模板字符串。支持输入文本、输出文本、输入图像和输入音频,可提供单个条目或条目数组。

  • TextInput = string

输入模型的文本。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • OutputText object { text, type }

模型输出的文本。

  • text: string

模型输出的文本内容。

  • type: "output_text"

输出文本类型,固定为 output_text。

  • "output_text"

  • InputImage object { image_url, type, detail }

用于 EvalItem 内容数组中的图像输入块。

  • image_url: string

输入图像的 URL。

format: uri

  • type: "input_image"

输入图像类型,固定为 input_image。

  • "input_image"

  • detail: optional string

发送给模型的图像细节级别,可选 high、low 或 auto,默认为 auto。

  • ResponseInputAudio object { input_audio, type }

输入模型的音频。

  • input_audio: object { data, format }

  • data: string

采用 Base64 编码的音频数据。

  • format: "mp3" or "wav"

音频数据格式,当前支持 mp3 和 wav.

  • "mp3"

  • "wav"

  • type: "input_audio"

输入条目类型,固定为 input_audio。

  • "input_audio"

  • GraderInputs = array of string or ResponseInputText or OutputText { text, type } or 2 more

输入列表,每项可以是输入文本、输出文本、输入 图像或输入音频对象。

  • TextInput = string

输入模型的文本。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • OutputText object { text, type }

模型输出的文本。

  • text: string

模型输出的文本内容。

  • type: "output_text"

输出文本类型,固定为 output_text。

  • "output_text"

  • InputImage object { image_url, type, detail }

用于 EvalItem 内容数组中的图像输入块。

  • image_url: string

输入图像的 URL。

format: uri

  • type: "input_image"

输入图像类型,固定为 input_image。

  • "input_image"

  • detail: optional string

发送给模型的图像细节级别,可选 high、low 或 auto,默认为 auto。

  • ResponseInputAudio object { input_audio, type }

输入模型的音频。

  • role: "user" or "assistant" or "system" or "developer"

输入消息的角色,可选 user、assistant、system 或 developer.

  • "user"

  • "assistant"

  • "system"

  • "developer"

  • type: optional "message"

输入消息类型,固定为 message。

  • "message"

  • type: "template"

输入消息类型,固定为 template。

  • "template"

  • ItemReferenceInputMessages object { item_reference, type }

  • item_reference: string

对 item 命名空间中变量的引用,例如 "item.input_trajectory"。

  • type: "item_reference"

输入消息类型,固定为 item_reference。

  • "item_reference"

  • model: optional string

用于生成补全内容的模型名称,例如 "o3-mini"。

  • sampling_params: optional object { max_completion_tokens, reasoning_effort, response_format, 4 more }

  • max_completion_tokens: optional integer

生成输出的最大词元数。

  • reasoning_effort: optional ReasoningEffort or null (default: "medium")

限制推理模型的推理强度。当前支持 none、minimal、low、medium、high、xhigh 和 max。 降低推理强度可能加快响应,并减少响应中用于 推理的词元数。并非所有推理模型都支持每个 取值。各模型的支持情况请参阅 推理指南 中的说明。

  • "none"

  • "minimal"

  • "low"

  • "medium"

  • "high"

  • "xhigh"

  • "max"

  • response_format: optional ResponseFormatText or ResponseFormatJSONSchema or ResponseFormatJSONObject

指定模型必须输出的格式的对象。

设为 { "type": "json_schema", "json_schema": {...} } 会启用 结构化输出,确保模型遵循你提供的 JSON 模式。更多信息请参阅结构化输出 指南。

设为 { "type": "json_object" } 会启用旧版 JSON 模式, 确保模型生成有效的 JSON。对于支持的模型,优先使用 json_schema 格式。

  • ResponseFormatText object { type }

默认响应格式,用于生成文本响应。

  • type: "text"

定义的响应格式类型,固定为 text。

  • "text"

  • ResponseFormatJSONSchema object { json_schema, type }

JSON Schema 响应格式,用于生成结构化 JSON 响应。 参阅结构化输出。

  • json_schema: object { name, description, schema, strict }

结构化输出配置选项,包含 JSON Schema。

  • name: string

响应格式的名称,须使用 a-z、A-Z、0-9,或包含 下划线和连字符,最长为 64 个字符。

  • description: optional string

响应格式的用途描述,模型据此 判断如何按该格式响应。

  • schema: optional map[unknown]

以 JSON Schema 对象描述的响应格式模式。 JSON Schema 的构建方法参阅此处。

  • strict: optional boolean or null (default: false)

生成输出时是否启用严格模式遵循。 设为 true 时,模型始终严格遵循 schema 字段中定义的模式。strict 为 true 时仅支持 JSON Schema 的子集。更多信息请参阅结构化输出 指南。

  • type: "json_schema"

定义的响应格式类型,固定为 json_schema。

  • "json_schema"

  • ResponseFormatJSONObject object { type }

JSON 对象响应格式,是生成 JSON 响应的较早方式。 对于支持的模型,建议使用 json_schema。注意: 须在系统消息或用户消息中指示模型生成 JSON, 模型才会生成 JSON。

  • type: "json_object"

定义的响应格式类型,固定为 json_object。

  • "json_object"

  • seed: optional integer (default: 42)

采样时用于初始化随机性的种子值。

  • temperature: optional number (default: 1)

较高的 temperature 会增加输出的随机性。

  • tools: optional array of ChatCompletionFunctionTool

模型可以调用的工具列表。目前工具仅支持函数。通过此项提供模型可为其生成 JSON 输入的函数列表,最多支持 128 个函数。

  • function: FunctionDefinition

  • name: string

要调用的函数名称,须使用 a-z、A-Z、0-9,或包含下划线和连字符,最长为 64 个字符。

  • description: optional string

函数功能的描述,模型据此选择何时以及如何调用该函数。

  • parameters: optional FunctionParameters

函数接受的参数,以 JSON Schema 对象描述。示例参阅指南,格式说明参阅 JSON Schema 参考。

省略 parameters 表示定义参数列表为空的函数。

  • strict: optional boolean or null (default: false)

生成函数调用时是否启用严格模式遵循。设为 true 时,模型严格遵循 parameters 字段中定义的模式。strict 为 true 时仅支持 JSON Schema 的子集。结构化输出的更多信息参阅函数调用指南。

  • type: "function"

工具类型,目前仅支持 function。

  • "function"

  • top_p: optional number (default: 1)

用于核采样的参数,是 temperature 的替代方案;1.0 表示包含所有词元。

创建评测 JSONL 运行数据源

  • CreateEvalJSONLRunDataSource object { source, type }

JsonlRunDataSource 对象,指定与该评测匹配的 JSONL 文件。

  • source: EvalJSONLFileContentSource { content, type } or EvalJSONLFileIDSource { id, type }

决定数据源中 item 命名空间的内容。

  • EvalJSONLFileContentSource object { content, type }

  • content: array of object { item, sample }

JSONL 文件的内容。

  • item: map[unknown]

  • sample: optional map[unknown]

  • type: "file_content" (default: "file_content")

JSONL 来源的类型,固定为 file_content。

  • "file_content"

  • EvalJSONLFileIDSource object { id, type }

  • id: string

文件标识。

  • type: "file_id" (default: "file_id")

JSONL 来源的类型,固定为 file_id。

  • "file_id"

  • type: "jsonl" (default: "jsonl")

数据源类型,固定为 jsonl。

  • "jsonl"

Eval API 错误

  • EvalAPIError object { code, message }

表示 Eval API 错误响应的对象。

  • code: string

错误代码。

  • message: string

错误消息。

运行取消响应

  • RunCancelResponse object { id, created_at, data_source, 11 more }

表示评测运行的模式。

  • id: string

评测运行的唯一标识。

  • created_at: integer

评测运行创建时的 Unix 时间戳,单位为秒。

format: unixtime

  • data_source: CreateEvalJSONLRunDataSource or CreateEvalCompletionsRunDataSource or ResponsesRunDataSource { source, type, input_messages, 2 more }

本次运行的数据源信息。

  • CreateEvalJSONLRunDataSource object { source, type }

JsonlRunDataSource 对象,指定与该评测匹配的 JSONL 文件。

  • source: EvalJSONLFileContentSource { content, type } or EvalJSONLFileIDSource { id, type }

决定数据源中 item 命名空间的内容。

  • EvalJSONLFileContentSource object { content, type }

  • content: array of object { item, sample }

JSONL 文件的内容。

  • item: map[unknown]

  • sample: optional map[unknown]

  • type: "file_content" (default: "file_content")

JSONL 来源的类型,固定为 file_content。

  • "file_content"

  • EvalJSONLFileIDSource object { id, type }

  • id: string

文件标识。

  • type: "file_id" (default: "file_id")

JSONL 来源的类型,固定为 file_id。

  • "file_id"

  • type: "jsonl" (default: "jsonl")

数据源类型,固定为 jsonl。

  • "jsonl"

  • CreateEvalCompletionsRunDataSource object { source, type, input_messages, 2 more }

描述模型采样配置的 CompletionsRunDataSource 对象。

  • source: EvalJSONLFileContentSource { content, type } or EvalJSONLFileIDSource { id, type } or StoredCompletionsRunDataSource { type, created_after, created_before, 3 more }

决定本次运行数据源中 item 命名空间的内容。

  • EvalJSONLFileContentSource object { content, type }

  • content: array of object { item, sample }

JSONL 文件的内容。

  • item: map[unknown]

  • sample: optional map[unknown]

  • type: "file_content" (default: "file_content")

JSONL 来源的类型,固定为 file_content。

  • "file_content"

  • EvalJSONLFileIDSource object { id, type }

  • id: string

文件标识。

  • type: "file_id" (default: "file_id")

JSONL 来源的类型,固定为 file_id。

  • "file_id"

  • StoredCompletionsRunDataSource object { type, created_after, created_before, 3 more }

描述一组筛选条件的 StoredCompletionsRunDataSource 配置。

  • type: "stored_completions" (default: "stored_completions")

来源类型,固定为 stored_completions。

  • "stored_completions"

  • created_after: optional integer or null

可选的 Unix 时间戳,用于筛选在此时间之后创建的条目。

  • created_before: optional integer or null

可选的 Unix 时间戳,用于筛选在此时间之前创建的条目。

  • limit: optional integer or null

可选的返回条目数量上限。

  • metadata: optional Metadata or null

可附加到对象的元数据,最多包含 16 组键值对,可 以结构化方式存储对象的额外信息, 并通过 API 或控制台查询对象。

键为最多 64 个字符的字符串,值为 最多 512 个字符的字符串。

  • model: optional string or null

可选的模型筛选条件,例如 'gpt-6-astra'。

  • type: "completions" (default: "completions")

运行数据源类型,固定为 completions。

  • "completions"

  • input_messages: optional TemplateInputMessages { template, type } or ItemReferenceInputMessages { item_reference, type }

从模型采样时使用,规定传给模型的消息结构。可以引用预先构建的轨迹,例如 item.input_trajectory,也可以使用包含 item 命名空间变量引用的模板。

  • TemplateInputMessages object { template, type }

  • template: array of EasyInputMessage or EvalMessageObject { content, role, type }

构成提示词或上下文的聊天消息列表,可以包含对 item 命名空间的变量引用,例如 {{item.name}}。

  • EasyInputMessage object { content, role, phase, type }

输入模型的消息,其角色表示指令遵循的 优先级。以 developer 或 system 角色给出的指令 优先于 user 角色给出的指令。 assistant 角色的消息被视为模型在此前 交互中生成的内容。

  • content: string or ResponseInputMessageContentList

用于生成响应的文本、图像或音频输入。 也可以包含此前的助手响应。

  • TextInput = string

输入模型的文本。

  • ResponseInputMessageContentList = array of ResponseInputContent

输入模型的一个或多个条目的列表,可以包含不同 内容类型。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • text: string

输入模型的文本。

  • type: "input_text" (default: "input_text")

输入条目类型,固定为 input_text。

  • "input_text"

  • prompt_cache_breakpoint: optional object { mode, ttl }

标记可复用提示词前缀的精确结束位置。省略 ttl 时,断点继承请求中的 prompt_cache_options.ttl;该边界不会按词元块取整。

  • mode: "explicit" (default: "explicit")

断点模式,固定为 explicit。

  • "explicit"

  • ttl: optional "30m" or "12h"

此缓存断点的最短存续时间,默认为请求的 TTL。

  • "30m"

  • "12h"

  • ResponseInputImage object { detail, type, file_id, 2 more }

输入模型的图像。参阅图像输入。

  • detail: ImageDetail

发送给模型的图像细节级别,可选 high、low、auto 或 original,默认为 auto。

  • "low"

  • "high"

  • "auto"

  • "original"

  • type: "input_image" (default: "input_image")

输入条目类型,固定为 input_image。

  • "input_image"

  • file_id: optional string or null

要发送给模型的文件 ID。

  • image_url: optional string or null

要发送给模型的图像 URL,可以是完整 URL,或包含 Base64 编码图像的 data URL。

format: uri

  • prompt_cache_breakpoint: optional object { mode, ttl }

标记可复用提示词前缀的精确结束位置。省略 ttl 时,断点继承请求中的 prompt_cache_options.ttl;该边界不会按词元块取整。

  • mode: "explicit" (default: "explicit")

断点模式,固定为 explicit。

  • "explicit"

  • ttl: optional "30m" or "12h"

此缓存断点的最短存续时间,默认为请求的 TTL。

  • "30m"

  • "12h"

  • ResponseInputFile object { type, detail, file_data, 4 more }

输入模型的文件。

  • type: "input_file" (default: "input_file")

输入条目类型,固定为 input_file。

  • "input_file"

  • detail: optional "auto" or "low" or "high"

发送给模型的文件细节级别。使用 auto 由系统选择;对于 GPT-5.6 及后续模型,auto 使用高质量渲染,可能增加输入词元用量。使用 low 进行成本较低的渲染,或使用 high 以更高质量渲染文件。默认为 auto。

  • "auto"

  • "low"

  • "high"

  • file_data: optional string

要发送给模型的文件内容。

  • file_id: optional string or null

要发送给模型的文件 ID。

  • file_url: optional string

要发送给模型的文件 URL。

format: uri

  • filename: optional string

要发送给模型的文件名。

  • prompt_cache_breakpoint: optional object { mode, ttl }

标记可复用提示词前缀的精确结束位置。省略 ttl 时,断点继承请求中的 prompt_cache_options.ttl;该边界不会按词元块取整。

  • mode: "explicit" (default: "explicit")

断点模式,固定为 explicit。

  • "explicit"

  • ttl: optional "30m" or "12h"

此缓存断点的最短存续时间,默认为请求的 TTL。

  • "30m"

  • "12h"

  • role: "user" or "assistant" or "system" or "developer"

输入消息的角色,可选 user、assistant、system 或 developer.

  • "user"

  • "assistant"

  • "system"

  • "developer"

  • phase: optional "commentary" or "final_answer" or null

将 assistant 消息标记为中间说明(commentary)或最终答案(final_answer)。 对于 gpt-5.3-codex 及后续此类模型,发送后续请求时,须保留并重新发送 所有助手消息的 phase;丢弃它可能降低表现。用户消息不使用此字段。

  • "commentary"

  • "final_answer"

  • type: optional "message"

输入消息类型,固定为 message。

  • "message"

  • EvalMessageObject object { content, role, type }

输入模型的消息,其角色表示指令遵循的 优先级。以 developer 或 system 角色给出的指令 优先于 user 角色给出的指令。 assistant 角色的消息被视为模型在此前 交互中生成的内容。

  • content: string or ResponseInputText or OutputText { text, type } or 3 more

模型输入,可以包含模板字符串。支持输入文本、输出文本、输入图像和输入音频,可提供单个条目或条目数组。

  • TextInput = string

输入模型的文本。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • OutputText object { text, type }

模型输出的文本。

  • text: string

模型输出的文本内容。

  • type: "output_text"

输出文本类型,固定为 output_text。

  • "output_text"

  • InputImage object { image_url, type, detail }

用于 EvalItem 内容数组中的图像输入块。

  • image_url: string

输入图像的 URL。

format: uri

  • type: "input_image"

输入图像类型,固定为 input_image。

  • "input_image"

  • detail: optional string

发送给模型的图像细节级别,可选 high、low 或 auto,默认为 auto。

  • ResponseInputAudio object { input_audio, type }

输入模型的音频。

  • input_audio: object { data, format }

  • data: string

采用 Base64 编码的音频数据。

  • format: "mp3" or "wav"

音频数据格式,当前支持 mp3 和 wav.

  • "mp3"

  • "wav"

  • type: "input_audio"

输入条目类型,固定为 input_audio。

  • "input_audio"

  • GraderInputs = array of string or ResponseInputText or OutputText { text, type } or 2 more

输入列表,每项可以是输入文本、输出文本、输入 图像或输入音频对象。

  • TextInput = string

输入模型的文本。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • OutputText object { text, type }

模型输出的文本。

  • text: string

模型输出的文本内容。

  • type: "output_text"

输出文本类型,固定为 output_text。

  • "output_text"

  • InputImage object { image_url, type, detail }

用于 EvalItem 内容数组中的图像输入块。

  • image_url: string

输入图像的 URL。

format: uri

  • type: "input_image"

输入图像类型,固定为 input_image。

  • "input_image"

  • detail: optional string

发送给模型的图像细节级别,可选 high、low 或 auto,默认为 auto。

  • ResponseInputAudio object { input_audio, type }

输入模型的音频。

  • role: "user" or "assistant" or "system" or "developer"

输入消息的角色,可选 user、assistant、system 或 developer.

  • "user"

  • "assistant"

  • "system"

  • "developer"

  • type: optional "message"

输入消息类型,固定为 message。

  • "message"

  • type: "template"

输入消息类型,固定为 template。

  • "template"

  • ItemReferenceInputMessages object { item_reference, type }

  • item_reference: string

对 item 命名空间中变量的引用,例如 "item.input_trajectory"。

  • type: "item_reference"

输入消息类型,固定为 item_reference。

  • "item_reference"

  • model: optional string

用于生成补全内容的模型名称,例如 "o3-mini"。

  • sampling_params: optional object { max_completion_tokens, reasoning_effort, response_format, 4 more }

  • max_completion_tokens: optional integer

生成输出的最大词元数。

  • reasoning_effort: optional ReasoningEffort or null (default: "medium")

限制推理模型的推理强度。当前支持 none、minimal、low、medium、high、xhigh 和 max。 降低推理强度可能加快响应,并减少响应中用于 推理的词元数。并非所有推理模型都支持每个 取值。各模型的支持情况请参阅 推理指南 中的说明。

  • "none"

  • "minimal"

  • "low"

  • "medium"

  • "high"

  • "xhigh"

  • "max"

  • response_format: optional ResponseFormatText or ResponseFormatJSONSchema or ResponseFormatJSONObject

指定模型必须输出的格式的对象。

设为 { "type": "json_schema", "json_schema": {...} } 会启用 结构化输出,确保模型遵循你提供的 JSON 模式。更多信息请参阅结构化输出 指南。

设为 { "type": "json_object" } 会启用旧版 JSON 模式, 确保模型生成有效的 JSON。对于支持的模型,优先使用 json_schema 格式。

  • ResponseFormatText object { type }

默认响应格式,用于生成文本响应。

  • type: "text"

定义的响应格式类型,固定为 text。

  • "text"

  • ResponseFormatJSONSchema object { json_schema, type }

JSON Schema 响应格式,用于生成结构化 JSON 响应。 参阅结构化输出。

  • json_schema: object { name, description, schema, strict }

结构化输出配置选项,包含 JSON Schema。

  • name: string

响应格式的名称,须使用 a-z、A-Z、0-9,或包含 下划线和连字符,最长为 64 个字符。

  • description: optional string

响应格式的用途描述,模型据此 判断如何按该格式响应。

  • schema: optional map[unknown]

以 JSON Schema 对象描述的响应格式模式。 JSON Schema 的构建方法参阅此处。

  • strict: optional boolean or null (default: false)

生成输出时是否启用严格模式遵循。 设为 true 时,模型始终严格遵循 schema 字段中定义的模式。strict 为 true 时仅支持 JSON Schema 的子集。更多信息请参阅结构化输出 指南。

  • type: "json_schema"

定义的响应格式类型,固定为 json_schema。

  • "json_schema"

  • ResponseFormatJSONObject object { type }

JSON 对象响应格式,是生成 JSON 响应的较早方式。 对于支持的模型,建议使用 json_schema。注意: 须在系统消息或用户消息中指示模型生成 JSON, 模型才会生成 JSON。

  • type: "json_object"

定义的响应格式类型,固定为 json_object。

  • "json_object"

  • seed: optional integer (default: 42)

采样时用于初始化随机性的种子值。

  • temperature: optional number (default: 1)

较高的 temperature 会增加输出的随机性。

  • tools: optional array of ChatCompletionFunctionTool

模型可以调用的工具列表。目前工具仅支持函数。通过此项提供模型可为其生成 JSON 输入的函数列表,最多支持 128 个函数。

  • function: FunctionDefinition

  • name: string

要调用的函数名称,须使用 a-z、A-Z、0-9,或包含下划线和连字符,最长为 64 个字符。

  • description: optional string

函数功能的描述,模型据此选择何时以及如何调用该函数。

  • parameters: optional FunctionParameters

函数接受的参数,以 JSON Schema 对象描述。示例参阅指南,格式说明参阅 JSON Schema 参考。

省略 parameters 表示定义参数列表为空的函数。

  • strict: optional boolean or null (default: false)

生成函数调用时是否启用严格模式遵循。设为 true 时,模型严格遵循 parameters 字段中定义的模式。strict 为 true 时仅支持 JSON Schema 的子集。结构化输出的更多信息参阅函数调用指南。

  • type: "function"

工具类型,目前仅支持 function。

  • "function"

  • top_p: optional number (default: 1)

用于核采样的参数,是 temperature 的替代方案;1.0 表示包含所有词元。

  • ResponsesRunDataSource object { source, type, input_messages, 2 more }

描述模型采样配置的 ResponsesRunDataSource 对象。

  • source: EvalJSONLFileContentSource { content, type } or EvalJSONLFileIDSource { id, type } or EvalResponsesSource { type, created_after, created_before, 8 more }

决定本次运行数据源中 item 命名空间的内容。

  • EvalJSONLFileContentSource object { content, type }

  • content: array of object { item, sample }

JSONL 文件的内容。

  • item: map[unknown]

  • sample: optional map[unknown]

  • type: "file_content" (default: "file_content")

JSONL 来源的类型,固定为 file_content。

  • "file_content"

  • EvalJSONLFileIDSource object { id, type }

  • id: string

文件标识。

  • type: "file_id" (default: "file_id")

JSONL 来源的类型,固定为 file_id。

  • "file_id"

  • EvalResponsesSource object { type, created_after, created_before, 8 more }

描述运行数据源配置的 EvalResponsesSource 对象。

  • type: "responses"

运行数据源类型,固定为 responses。

  • "responses"

  • created_after: optional integer or null

仅包含在此时间戳之后创建的条目,含边界。此查询参数用于选择响应。

minimum: 0

  • created_before: optional integer or null

仅包含在此时间戳之前创建的条目,含边界。此查询参数用于选择响应。

minimum: 0

  • instructions_search: optional string or null

可选的字符串,用于搜索 'instructions' 字段。此查询参数用于选择响应。

  • metadata: optional unknown or null

响应的元数据筛选条件。此查询参数用于选择响应。

  • model: optional string or null

要查找其响应的模型名称。此查询参数用于选择响应。

  • reasoning_effort: optional ReasoningEffort or null (default: "medium")

限制推理模型的推理强度。当前支持 none、minimal、low、medium、high、xhigh 和 max。 降低推理强度可能加快响应,并减少响应中用于 推理的词元数。并非所有推理模型都支持每个 取值。各模型的支持情况请参阅 推理指南 中的说明。

  • temperature: optional number or null

采样温度。此查询参数用于选择响应。

  • tools: optional array of string or null

工具名称列表。此查询参数用于选择响应。

  • top_p: optional number or null

核采样参数。此查询参数用于选择响应。

  • users: optional array of string or null

用户标识列表。此查询参数用于选择响应。

  • type: "responses" (default: "responses")

运行数据源类型,固定为 responses。

  • "responses"

  • input_messages: optional InputMessagesTemplate { template, type } or InputMessagesItemReference { item_reference, type }

从模型采样时使用,规定传给模型的消息结构。可以引用预先构建的轨迹,例如 item.input_trajectory,也可以使用包含 item 命名空间变量引用的模板。

  • InputMessagesTemplate object { template, type }

  • template: array of ChatMessage { content, role } or EvalMessageObject { content, role, type }

构成提示词或上下文的聊天消息列表,可以包含对 item 命名空间的变量引用,例如 {{item.name}}。

  • ChatMessage object { content, role }

  • content: string

消息内容。

  • role: string

消息角色,例如 "system"、"assistant"、"user"。

  • EvalMessageObject object { content, role, type }

输入模型的消息,其角色表示指令遵循的 优先级。以 developer 或 system 角色给出的指令 优先于 user 角色给出的指令。 assistant 角色的消息被视为模型在此前 交互中生成的内容。

  • content: string or ResponseInputText or OutputText { text, type } or 3 more

模型输入,可以包含模板字符串。支持输入文本、输出文本、输入图像和输入音频,可提供单个条目或条目数组。

  • TextInput = string

输入模型的文本。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • OutputText object { text, type }

模型输出的文本。

  • text: string

模型输出的文本内容。

  • type: "output_text"

输出文本类型,固定为 output_text。

  • "output_text"

  • InputImage object { image_url, type, detail }

用于 EvalItem 内容数组中的图像输入块。

  • image_url: string

输入图像的 URL。

format: uri

  • type: "input_image"

输入图像类型,固定为 input_image。

  • "input_image"

  • detail: optional string

发送给模型的图像细节级别,可选 high、low 或 auto,默认为 auto。

  • ResponseInputAudio object { input_audio, type }

输入模型的音频。

  • GraderInputs = array of string or ResponseInputText or OutputText { text, type } or 2 more

输入列表,每项可以是输入文本、输出文本、输入 图像或输入音频对象。

  • role: "user" or "assistant" or "system" or "developer"

输入消息的角色,可选 user、assistant、system 或 developer.

  • "user"

  • "assistant"

  • "system"

  • "developer"

  • type: optional "message"

输入消息类型,固定为 message。

  • "message"

  • type: "template"

输入消息类型,固定为 template。

  • "template"

  • InputMessagesItemReference object { item_reference, type }

  • item_reference: string

对 item 命名空间中变量的引用,例如 "item.name"。

  • type: "item_reference"

输入消息类型,固定为 item_reference。

  • "item_reference"

  • model: optional string

用于生成补全内容的模型名称,例如 "o3-mini"。

  • sampling_params: optional object { max_completion_tokens, reasoning_effort, seed, 4 more }

  • max_completion_tokens: optional integer

生成输出的最大词元数。

  • reasoning_effort: optional ReasoningEffort or null (default: "medium")

限制推理模型的推理强度。当前支持 none、minimal、low、medium、high、xhigh 和 max。 降低推理强度可能加快响应,并减少响应中用于 推理的词元数。并非所有推理模型都支持每个 取值。各模型的支持情况请参阅 推理指南 中的说明。

  • seed: optional integer (default: 42)

采样时用于初始化随机性的种子值。

  • temperature: optional number (default: 1)

较高的 temperature 会增加输出的随机性。

  • text: optional object { format }

模型文本响应的配置选项,可以是纯 文本或结构化 JSON 数据。更多信息:

  • format: optional ResponseFormatTextConfig

指定模型必须输出的格式的对象。

配置 { "type": "json_schema" } 会启用结构化输出, 确保模型遵循你提供的 JSON Schema。更多信息参阅 结构化输出指南。

默认格式为 { "type": "text" },没有额外选项。

不建议用于 gpt-4o 及后续模型:

设为 { "type": "json_object" } 会启用旧版 JSON 模式, 确保模型生成有效的 JSON。对于支持的模型,优先使用 json_schema 格式。

  • ResponseFormatText object { type }

默认响应格式,用于生成文本响应。

  • ResponseFormatTextJSONSchemaConfig object { name, schema, type, 2 more }

JSON Schema 响应格式,用于生成结构化 JSON 响应。 参阅结构化输出。

  • name: string

响应格式的名称,须使用 a-z、A-Z、0-9,或包含 下划线和连字符,最长为 64 个字符。

  • schema: map[unknown]

以 JSON Schema 对象描述的响应格式模式。 JSON Schema 的构建方法参阅此处。

  • type: "json_schema"

定义的响应格式类型,固定为 json_schema。

  • "json_schema"

  • description: optional string

响应格式的用途描述,模型据此 判断如何按该格式响应。

  • strict: optional boolean or null (default: false)

生成输出时是否启用严格模式遵循。 设为 true 时,模型始终严格遵循 schema 字段中定义的模式。strict 为 true 时仅支持 JSON Schema 的子集。更多信息请参阅结构化输出 指南。

  • ResponseFormatJSONObject object { type }

JSON 对象响应格式,是生成 JSON 响应的较早方式。 对于支持的模型,建议使用 json_schema。注意: 须在系统消息或用户消息中指示模型生成 JSON, 模型才会生成 JSON。

  • tools: optional array of Function { name, parameters, strict, 6 more } or FileSearch { type, vector_store_ids, filters, 2 more } or Computer { type } or 13 more

模型生成响应时可以调用的工具数组。你 可以通过 tool_choice 参数指定要使用的工具。

可向模型提供以下两类工具:

  • 内置工具:由 OpenAI 提供,用于扩展 模型能力,例如网页搜索 或文件搜索。更多信息参阅 内置工具。
  • 函数调用(自定义工具):由你定义的函数, 使模型可以调用你自己的代码。更多信息参阅 函数调用。

  • Function object { name, parameters, strict, 6 more }

定义模型可以选择调用的自有代码函数。参阅函数调用。

  • name: string

要调用的函数名称。

  • parameters: map[unknown] or null

描述函数参数的 JSON Schema 对象。

  • strict: boolean or null

是否对此函数工具强制执行严格参数校验。

  • type: "function" (default: "function")

函数工具类型,固定为 function。

  • "function"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

  • "direct"

  • "programmatic"

  • async: optional boolean

  • defer_loading: optional boolean

此函数是否延迟加载并通过工具搜索加载。

  • description: optional string or null

函数描述,模型据此判断是否调用该函数。

  • output_schema: optional map[unknown] or null

描述此函数字符串输出中编码的 JSON 值的 JSON Schema 对象。

  • FileSearch object { type, vector_store_ids, filters, 2 more }

搜索已上传文件中相关内容的工具。参阅文件搜索工具。

  • type: "file_search" (default: "file_search")

文件搜索工具类型,固定为 file_search。

  • "file_search"

  • vector_store_ids: array of string

要搜索的向量存储 ID 列表。

  • filters: optional ComparisonFilter or CompoundFilter or null

要应用的筛选条件。

  • ComparisonFilter object { key, type, value }

使用指定比较运算,将某个属性键与给定值比较的筛选条件。

  • key: string

要与值比较的属性键。

  • type: "eq" or "ne" or "gt" or 5 more (default: "eq")

指定比较运算符:eq、ne、gt、gte、lt、lte、in、nin。

  • eq:等于
  • ne:不等于
  • gt:大于
  • gte:大于或等于
  • lt:小于
  • lte:小于或等于
  • in:属于
  • nin:不属于

  • "eq"

  • "ne"

  • "gt"

  • "gte"

  • "lt"

  • "lte"

  • "in"

  • "nin"

  • value: string or number or boolean or array of string or number

用于与属性键比较的值,支持字符串、数字或布尔类型。

  • string

  • number

  • boolean

  • array of string or number

  • string

  • number

  • CompoundFilter object { filters, type }

使用 and 或 or 组合多个筛选条件。

  • filters: array of ComparisonFilter or CompoundFilter

要组合的筛选条件数组,条目可以是 ComparisonFilter 或 CompoundFilter。

  • ComparisonFilter object { key, type, value }

使用指定比较运算,将某个属性键与给定值比较的筛选条件。

  • CompoundFilter object { filters, type }

使用 and 或 or 组合多个筛选条件。

  • type: "and" or "or"

运算类型:and 或 or。

  • "and"

  • "or"

  • max_num_results: optional integer

返回结果数量上限,须介于 1–50 之间,含边界。

  • ranking_options: optional object { hybrid_search, ranker, score_threshold }

搜索结果的排序选项。

  • hybrid_search: optional object { embedding_weight, text_weight }

启用混合搜索时,控制倒数排名融合如何平衡语义嵌入匹配与稀疏关键词匹配的权重。

  • embedding_weight: number

嵌入在倒数排名融合中的权重。

  • text_weight: number

文本在倒数排名融合中的权重。

  • ranker: optional "auto" or "default-2024-11-15"

文件搜索所用的排序器。

  • "auto"

  • "default-2024-11-15"

  • score_threshold: optional number

文件搜索的分数阈值,为 0–1 之间的数字。越接近 1,越倾向于只返回最相关的结果,但返回数量可能减少。

  • Computer object { type }

控制虚拟计算机的工具。参阅计算机工具。

  • type: "computer" (default: "computer")

计算机工具类型,固定为 computer。

  • "computer"

  • ComputerUsePreview object { display_height, display_width, environment, type }

控制虚拟计算机的工具。参阅计算机工具。

  • display_height: integer

计算机显示区域的高度。

  • display_width: integer

计算机显示区域的宽度。

  • environment: "windows" or "mac" or "linux" or 2 more

要控制的计算机环境类型。

  • "windows"

  • "mac"

  • "linux"

  • "ubuntu"

  • "browser"

  • type: "computer_use_preview" (default: "computer_use_preview")

计算机使用工具类型,固定为 computer_use_preview。

  • "computer_use_preview"

  • WebSearch object { type, external_web_access, filters, 2 more }

在互联网上搜索与提示词相关的信息来源。参阅 网络搜索工具时。

  • type: "web_search" or "web_search_2025_08_26" (default: "web_search")

网页搜索工具类型,可选 web_search 或 web_search_2025_08_26。

  • "web_search"

  • "web_search_2025_08_26"

  • external_web_access: optional boolean (default: true)

是否允许网页搜索实时访问互联网。省略时默认为 true。设为 false 时,网页搜索工具以离线或仅缓存模式运行,不会抓取新的外部内容。

  • filters: optional object { allowed_domains } or null

搜索的筛选条件。

  • allowed_domains: optional array of string or null (default: [])

搜索允许的域名。未提供时允许所有域名。 也允许访问所提供域名的子域名。

示例:["pubmed.ncbi.nlm.nih.gov"]

  • search_context_size: optional "low" or "medium" or "high" (default: "medium")

对搜索占用上下文窗口空间大小的总体指导,可选 low、medium 或 high,默认为 medium。

  • "low"

  • "medium"

  • "high"

  • user_location: optional object { city, country, region, 2 more } or null

用户的大致位置。省略或设为 null 时,默认为 美国。若要避免此默认值,可传入不包含位置字段的 {"type": "approximate"}。 若要本地化结果,须提供相应位置字段。

  • city: optional string or null

用户所在城市的自由文本,例如 San Francisco。

  • country: optional string or null

用户所在国家/地区的两字母 ISO 代码,例如 US。

  • region: optional string or null

用户所在地区的自由文本,例如 California。

  • timezone: optional string or null

用户所在的 IANA 时区,例如 America/Los_Angeles。

  • type: optional "approximate" (default: "approximate")

位置估算类型,固定为 approximate。

  • "approximate"

  • Mcp object { server_label, type, allowed_callers, 9 more }

通过远程模型上下文协议(MCP)服务器, 向模型提供额外工具。了解 MCP。

  • server_label: string

此 MCP 服务器的标签,用于在工具调用中标识服务器。

  • type: "mcp"

MCP 工具类型,固定为 mcp。

  • "mcp"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • allowed_tools: optional array of string or McpToolFilter { read_only, tool_names } or null

允许的工具名称列表或筛选对象。

  • McpAllowedTools = array of string

允许的工具名称组成的字符串数组。

  • McpToolFilter object { read_only, tool_names }

用于指定允许哪些工具的筛选对象。

  • read_only: optional boolean

表示工具会修改数据还是只读。如果 MCP 服务器标注了 readOnlyHint, 就会与此筛选条件匹配。

  • tool_names: optional array of string

允许的工具名称列表。

  • authorization: optional string

可用于远程 MCP 服务器的 OAuth 访问令牌,既可 配合自定义 MCP 服务器 URL,也可配合服务连接器。你的应用 须处理 OAuth 授权流程,并在此提供令牌。

  • connector_id: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 5 more

服务连接器的标识,例如 ChatGPT 中提供的连接器。须提供 server_url、connector_id 或 tunnel_id 中的一项。更多 服务连接器信息参阅此处。

对于 2026 年 9 月 1 日之后发布的模型,此字段已弃用。 使用 server_url 连接远程 MCP 服务器,或使用 tunnel_id 通过安全 MCP 隧道连接。

当前支持的 connector_id 值如下:

  • Dropbox:connector_dropbox
  • Gmail:connector_gmail
  • Google 日历:connector_googlecalendar
  • Google 云端硬盘:connector_googledrive
  • Microsoft Teams:connector_microsoftteams
  • Outlook 日历:connector_outlookcalendar
  • Outlook 邮箱:connector_outlookemail
  • SharePoint:connector_sharepoint

  • "connector_dropbox"

  • "connector_gmail"

  • "connector_googlecalendar"

  • "connector_googledrive"

  • "connector_microsoftteams"

  • "connector_outlookcalendar"

  • "connector_outlookemail"

  • "connector_sharepoint"

  • defer_loading: optional boolean

此 MCP 工具是否延迟加载并通过工具搜索发现。

  • headers: optional map[string] or null

可选的发送给 MCP 服务器的 HTTP 请求头,用于认证 或其他用途。

  • require_approval: optional McpToolApprovalFilter { always, never } or "always" or "never" or null (default: "always")

指定 MCP 服务器的哪些工具需要批准。

  • McpToolApprovalFilter object { always, never }

指定 MCP 服务器的哪些工具需要批准。可以是 always、never,或与需要批准的工具关联的 筛选对象。

  • always: optional object { read_only, tool_names }

用于指定允许哪些工具的筛选对象。

  • read_only: optional boolean

表示工具会修改数据还是只读。如果 MCP 服务器标注了 readOnlyHint, 就会与此筛选条件匹配。

  • tool_names: optional array of string

允许的工具名称列表。

  • never: optional object { read_only, tool_names }

用于指定允许哪些工具的筛选对象。

  • read_only: optional boolean

表示工具会修改数据还是只读。如果 MCP 服务器标注了 readOnlyHint, 就会与此筛选条件匹配。

  • tool_names: optional array of string

允许的工具名称列表。

  • McpToolApprovalSetting = "always" or "never"

为所有工具指定统一的批准策略,可选 always 或 never。设为 always 时,所有工具均需要批准; 设为 never 时,所有工具均不需要批准。

  • "always"

  • "never"

  • server_description: optional string

MCP 服务器的可选描述,用于提供更多上下文。

  • server_url: optional string

MCP 服务器的 URL。须提供 server_url、connector_id 或 tunnel_id 中的一项。

format: uri

  • tunnel_id: optional string

用来替代直接服务器 URL 的安全 MCP 隧道 ID。须提供 server_url、connector_id 或 tunnel_id 中的一项。

pattern: ^tunnel_[a-z0-9]{32}$

  • CodeInterpreter object { container, type, allowed_callers }

运行 Python 代码以帮助生成提示词响应的工具。

  • container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }

代码解释器容器,可以是容器 ID,也可以是 指定代码可用的已上传文件 ID 的对象,同时可提供 可选的 memory_limit 设置。

  • string

容器 ID。

  • CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }

代码解释器容器配置,可以指定运行代码时所处理的文件 ID。

  • type: "auto" (default: "auto")

固定为 auto。

  • "auto"

  • file_ids: optional array of string

可选的已上传文件列表,这些文件将提供给代码使用。

maxItems: 50

  • memory_limit: optional "1g" or "4g" or "16g" or "64g" or null

代码解释器容器的内存上限。

  • "1g"

  • "4g"

  • "16g"

  • "64g"

  • network_policy: optional ContainerNetworkPolicyDisabled or ContainerNetworkPolicyAllowlist

容器的网络访问策略。

  • ContainerNetworkPolicyDisabled object { type }

  • type: "disabled" (default: "disabled")

禁用出站网络访问,固定为 disabled。

  • "disabled"

  • ContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }

  • allowed_domains: array of string

type 为 allowlist 时允许访问的域名列表。

minItems: 1

  • type: "allowlist" (default: "allowlist")

仅允许对指定域名发起出站网络访问,固定为 allowlist。

  • "allowlist"

  • domain_secrets: optional array of ContainerNetworkPolicyDomainSecret

可选的仅用于允许访问域名的域名级密钥。

minItems: 1

  • domain: string

密钥关联的域名。

minLength: 1

  • name: string

要为该域名注入的密钥名称。

minLength: 1

  • value: string

要为该域名注入的密钥值。

minLength: 1, maxLength: 10485760

  • type: "code_interpreter"

代码解释器工具类型,固定为 code_interpreter。

  • "code_interpreter"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • ProgrammaticToolCalling object { type }

  • type: "programmatic_tool_calling" (default: "programmatic_tool_calling")

工具类型,固定为 programmatic_tool_calling。

  • "programmatic_tool_calling"

  • ImageGeneration object { type, action, background, 13 more }

使用 GPT 图像模型生成图像的工具。

  • type: "image_generation"

图像生成工具类型,固定为 image_generation。

  • "image_generation"

  • action: optional "generate" or "edit" or "auto"

生成新图像还是编辑已有图像,默认为 auto。

  • "generate"

  • "edit"

  • "auto"

  • background: optional "transparent" or "opaque" or "auto" (default: "auto")

生成图像的背景,可选 transparent、opaque, 或 auto。gpt-image-2.5-sunburst 和 gpt-image-2.5-flare,包括 对应的 2026-09-08 快照,支持 opaque 和 transparent 背景。受支持的 GPT Image 模型可以使用透明 背景。对于 gpt-image-2 和 gpt-image-2-2026-04-21,此功能处于 预览阶段。使用 transparent 时,须将输出格式设为 png 或 webp。 默认为 auto。

  • "transparent"

  • "opaque"

  • "auto"

  • complexity: optional "low" or "medium" or "high"

用于规划图像的计算投入,与渲染质量分开设置。 覆盖外层响应用于图像生成的 reasoning.effort。 省略时,继承外层受支持的推理强度,或使用 图像模型配置的默认值。 对于 SVG 输出,此项控制参考图像,而不是 SVG 生成模型的 推理。

  • "low"

  • "medium"

  • "high"

  • frame_count: optional integer (default: 9)

GIF 帧数,要求 output_format 为 gif,默认为 9。

minimum: 2, maximum: 16

  • frame_duration_ms: optional integer (default: 200)

每个 GIF 帧的时长,单位为毫秒,取整到 10 毫秒。 要求 output_format 为 gif,默认为 200。

minimum: 20, maximum: 2000

  • input_fidelity: optional "high" or "low" or null

控制模型为匹配输入图像风格和特征(尤其是面部特征)投入的程度。gpt-image-1.5 支持 high 和 low,gpt-image-1-mini 仅支持 low。使用 gpt-image-2 时应省略此参数。支持该参数的模型默认为 low。

  • "high"

  • "low"

  • input_image_mask: optional object { file_id, image_url }

可选的局部重绘蒙版,包含 image_url (可选字符串)和 file_id(可选字符串)。

  • file_id: optional string

蒙版图像的文件 ID。

  • image_url: optional string

采用 Base64 编码的蒙版图像。

  • model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-2" or 9 more

用于图像生成的模型,可选 gpt-image-1-mini、 gpt-image-1.5, gpt-image-2, gpt-image-2-2026-04-21、gpt-image-2.5-sunburst、 gpt-image-2.5-sunburst-2026-09-08、gpt-image-2.5-flare、 gpt-image-2.5-flare-2026-09-08, gpt-image-2.6-sunburst, gpt-image-2.6-flare 或 chatgpt-image-latest。默认值: gpt-image-2.6-sunburst.

gpt-image-1 已于 2026 年 10 月 23 日停用,请使用 gpt-image-2.5-sunburst 或 gpt-image-2.5-flare。

  • string

  • "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-2" or 9 more

用于图像生成的模型,可选 gpt-image-1-mini、 gpt-image-1.5, gpt-image-2, gpt-image-2-2026-04-21、gpt-image-2.5-sunburst、 gpt-image-2.5-sunburst-2026-09-08、gpt-image-2.5-flare、 gpt-image-2.5-flare-2026-09-08, gpt-image-2.6-sunburst, gpt-image-2.6-flare 或 chatgpt-image-latest。默认值: gpt-image-2.6-sunburst.

gpt-image-1 已于 2026 年 10 月 23 日停用,请使用 gpt-image-2.5-sunburst 或 gpt-image-2.5-flare。

  • "gpt-image-1"

  • "gpt-image-1-mini"

  • "gpt-image-2"

  • "gpt-image-2-2026-04-21"

  • "gpt-image-2.5-sunburst"

  • "gpt-image-2.5-sunburst-2026-09-08"

  • "gpt-image-2.5-flare"

  • "gpt-image-2.5-flare-2026-09-08"

  • "gpt-image-2.6-sunburst"

  • "gpt-image-2.6-flare"

  • "gpt-image-1.5"

  • "chatgpt-image-latest"

  • moderation: optional "auto" or "low" (default: "auto")

生成图像的审核级别,默认为 auto。

  • "auto"

  • "low"

  • output_compression: optional integer (default: 100)

输出图像的压缩级别,默认为 100。

minimum: 0, maximum: 100

  • output_format: optional "png" or "webp" or "jpeg" or 2 more (default: "png")

输出图像格式,可选 png、webp、jpeg、 gif 或 svg,默认为 png。GIF 和 SVG 输出要求模型 支持所选格式。GIF 输出不支持 部分图像流式传输,即 partial_images 大于 0, 也不支持 input_image_mask 或自定义 output_compression。 GIF 输出仍可以流式发送 Responses 生命周期事件。

  • "png"

  • "webp"

  • "jpeg"

  • "gif"

  • "svg"

  • partial_images: optional integer (default: 0)

流式模式中生成的部分图像数量,范围为 0(默认值)到 3。

minimum: 0, maximum: 3

  • quality: optional "low" or "medium" or "high" or 3 more (default: "auto")

生成图像的质量。GPT 图像模型支持 low、 medium 和 high。gpt-image-2.5-sunburst 和 gpt-image-2.5-flare, 包括对应的 2026-09-08 快照,还支持 xhigh 和 max。 默认为 auto。

  • "low"

  • "medium"

  • "high"

  • "xhigh"

  • "max"

  • "auto"

  • size: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "auto" (default: "auto")

生成图像的尺寸。gpt-image-2、gpt-image-2-2026-04-21、gpt-image-2.5-sunburst、gpt-image-2.5-sunburst-2026-09-08、gpt-image-2.5-flare 和 gpt-image-2.5-flare-2026-09-08 支持以 WIDTHxHEIGHT 字符串指定任意分辨率,例如 1536x864。宽和高均须能被 16 整除,宽高比须在 1:3 至 3:1 之间。高于 2560x1440 的分辨率属于实验功能,支持的最高分辨率为 3840x2160。尺寸还须符合模型当前的像素数与边长限制。GPT Image 模型支持标准尺寸 1024x1024、1536x1024 和 1024x1536;允许自动尺寸的模型支持 auto。

  • string

  • "1024x1024" or "1024x1536" or "1536x1024" or "auto"

生成图像的尺寸。gpt-image-2、gpt-image-2-2026-04-21、gpt-image-2.5-sunburst、gpt-image-2.5-sunburst-2026-09-08、gpt-image-2.5-flare 和 gpt-image-2.5-flare-2026-09-08 支持以 WIDTHxHEIGHT 字符串指定任意分辨率,例如 1536x864。宽和高均须能被 16 整除,宽高比须在 1:3 至 3:1 之间。高于 2560x1440 的分辨率属于实验功能,支持的最高分辨率为 3840x2160。尺寸还须符合模型当前的像素数与边长限制。GPT Image 模型支持标准尺寸 1024x1024、1536x1024 和 1024x1536;允许自动尺寸的模型支持 auto。

  • "1024x1024"

  • "1024x1536"

  • "1536x1024"

  • "auto"

  • svg: optional object { model, reasoning }

SVG 生成模型的设置,要求 output_format 为 svg。 启用 SVG 模型选择时,省略此对象会使用 外层响应模型。否则使用默认 SVG 生成模型,且 不能显式覆盖模型。

  • model: optional string

minLength: 1

  • reasoning: optional object { effort } or null

SVG 编写的推理强度。省略时,Images 和 Responses 均使用编写模型的默认值。

  • effort: optional "none" or "minimal" or "low" or 4 more

控制模型为此次请求投入的推理强度。

  • "none"

  • "minimal"

  • "low"

  • "medium"

  • "high"

  • "xhigh"

  • "max"

  • LocalShell object { type }

允许模型在本地环境执行 shell 命令的工具。

  • type: "local_shell" (default: "local_shell")

本地 shell 工具类型,固定为 local_shell。

  • "local_shell"

  • Shell object { type, allowed_callers, environment }

允许模型执行 shell 命令的工具。

  • type: "shell" (default: "shell")

shell 工具类型,固定为 shell。

  • "shell"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • environment: optional ContainerAuto or LocalEnvironment or ContainerReference or null

  • ContainerAuto object { type, file_ids, memory_limit, 2 more }

  • type: "container_auto" (default: "container_auto")

为此请求自动创建容器。

  • "container_auto"

  • file_ids: optional array of string

可选的已上传文件列表,这些文件将提供给代码使用。

maxItems: 50

  • memory_limit: optional "1g" or "4g" or "16g" or "64g" or null

容器的内存上限。

  • "1g"

  • "4g"

  • "16g"

  • "64g"

  • network_policy: optional ContainerNetworkPolicyDisabled or ContainerNetworkPolicyAllowlist

容器的网络访问策略。

  • ContainerNetworkPolicyDisabled object { type }

  • ContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }

  • skills: optional array of SkillReference or InlineSkill

可选的技能列表,通过 ID 或内联数据引用技能。

maxItems: 200

  • SkillReference object { skill_id, type, version }

  • skill_id: string

引用的技能 ID。

minLength: 1, maxLength: 64

  • type: "skill_reference" (default: "skill_reference")

引用通过 /v1/skills 接口创建的技能。

  • "skill_reference"

  • version: optional string

可选的技能版本。使用正整数或 'latest',省略时使用默认版本。

  • InlineSkill object { description, name, source, type }

  • description: string

技能描述。

  • name: string

技能名称。

  • source: InlineSkillSource

内联技能载荷。

  • data: string

采用 Base64 编码的技能 ZIP 包。

minLength: 1, maxLength: 70254592

  • media_type: "application/zip" (default: "application/zip")

内联技能载荷的媒体类型,必须为 application/zip。

  • "application/zip"

  • type: "base64" (default: "base64")

内联技能来源的类型,必须为 base64。

  • "base64"

  • type: "inline" (default: "inline")

为此请求定义内联技能。

  • "inline"

  • LocalEnvironment object { type, skills }

  • type: "local" (default: "local")

使用本地计算机环境。

  • "local"

  • skills: optional array of LocalSkill

可选的技能列表。

maxItems: 200

  • description: string

技能描述。

  • name: string

技能名称。

  • path: string

包含该技能的目录路径。

  • ContainerReference object { container_id, type }

  • container_id: string

引用的容器 ID。

  • type: "container_reference" (default: "container_reference")

引用通过 /v1/containers 接口创建的容器。

  • "container_reference"

  • Custom object { name, type, allowed_callers, 4 more }

使用指定格式处理输入的自定义工具。参阅自定义工具。

  • name: string

自定义工具的名称,用于在工具调用中标识它。

  • type: "custom" (default: "custom")

自定义工具类型,固定为 custom。

  • "custom"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • async: optional boolean

工具响应是否可以异步返回,而非在下一次创建响应时立即返回。

  • defer_loading: optional boolean

此工具是否应延迟加载并通过工具搜索发现。

  • description: optional string

自定义工具的可选描述,用于提供更多上下文。

  • format: optional CustomToolInputFormat

自定义工具的输入格式,默认为无约束文本。

  • Text object { type }

无约束的自由文本。

  • type: "text" (default: "text")

无约束文本格式,固定为 text。

  • "text"

  • Grammar object { definition, syntax, type }

用户定义的语法。

  • definition: string

语法定义。

  • syntax: "lark" or "regex"

语法定义的语法类型,可选 lark 或 regex。

  • "lark"

  • "regex"

  • type: "grammar" (default: "grammar")

语法格式,固定为 grammar。

  • "grammar"

  • Namespace object { description, name, tools, type }

将函数工具或自定义工具归入共享命名空间。

  • description: string

展示给模型的命名空间描述。

  • name: string

工具调用使用的命名空间名称,例如 crm。

minLength: 1

  • tools: array of Function { name, type, allowed_callers, 6 more } or Custom { name, type, allowed_callers, 4 more }

此命名空间内可用的函数工具或自定义工具。

minItems: 1

  • Function object { name, type, allowed_callers, 6 more }

  • name: string

pattern: ^[a-zA-Z0-9_-]+$, minLength: 1, maxLength: 128

  • type: "function" (default: "function")

  • "function"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • async: optional boolean

工具响应是否可以异步返回,而非在下一次创建响应时立即返回。

  • defer_loading: optional boolean

此函数是否应延迟加载并通过工具搜索发现。

  • description: optional string or null

  • output_schema: optional map[unknown] or null

描述此函数工具字符串输出中编码的 JSON 值的 JSON Schema,不用于描述内容数组输出。

  • parameters: optional unknown or null

  • strict: optional boolean or null

是否强制执行严格参数校验。省略时,模式兼容的情况下 Responses 会尝试严格校验,否则退回非严格校验。

  • Custom object { name, type, allowed_callers, 4 more }

使用指定格式处理输入的自定义工具。参阅自定义工具。

  • name: string

自定义工具的名称,用于在工具调用中标识它。

  • type: "custom" (default: "custom")

自定义工具类型,固定为 custom。

  • "custom"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • async: optional boolean

工具响应是否可以异步返回,而非在下一次创建响应时立即返回。

  • defer_loading: optional boolean

此工具是否应延迟加载并通过工具搜索发现。

  • description: optional string

自定义工具的可选描述,用于提供更多上下文。

  • format: optional CustomToolInputFormat

自定义工具的输入格式,默认为无约束文本。

  • type: "namespace" (default: "namespace")

工具类型,固定为 namespace。

  • "namespace"

  • ToolSearch object { type, description, execution, parameters }

用于延迟加载工具的托管工具搜索或自带工具(BYOT)搜索配置。

  • type: "tool_search" (default: "tool_search")

工具类型,固定为 tool_search。

  • "tool_search"

  • description: optional string or null

客户端执行的工具搜索工具展示给模型的描述。

  • execution: optional "server" or "client"

工具搜索由服务端还是客户端执行。

  • "server"

  • "client"

  • parameters: optional unknown or null

客户端执行的工具搜索工具的参数模式。

  • WebSearchPreview object { type, search_content_types, search_context_size, user_location }

搜索网页以获取可用于响应的相关结果的工具。参阅网页搜索工具。

  • type: "web_search_preview" or "web_search_preview_2025_03_11" (default: "web_search_preview")

网页搜索工具类型,可选 web_search_preview 或 web_search_preview_2025_03_11。

  • "web_search_preview"

  • "web_search_preview_2025_03_11"

  • search_content_types: optional array of "text" or "image"

  • "text"

  • "image"

  • search_context_size: optional "low" or "medium" or "high"

对搜索占用上下文窗口空间大小的总体指导,可选 low、medium 或 high,默认为 medium。

  • "low"

  • "medium"

  • "high"

  • user_location: optional object { type, city, country, 2 more } or null

用户的大致位置。省略或设为 null 时默认为美国。若要避免此默认值,可传入不包含位置字段的 {"type": "approximate"}。若要本地化结果,须提供相应位置字段。

  • type: "approximate" (default: "approximate")

位置估算类型,固定为 approximate。

  • "approximate"

  • city: optional string or null

用户所在城市的自由文本,例如 San Francisco。

  • country: optional string or null

用户所在国家/地区的两字母 ISO 代码,例如 US。

  • region: optional string or null

用户所在地区的自由文本,例如 California。

  • timezone: optional string or null

用户所在的 IANA 时区,例如 America/Los_Angeles。

  • ApplyPatch object { type, allowed_callers }

允许助手使用统一差异格式创建、删除或更新文件。

  • type: "apply_patch" (default: "apply_patch")

工具类型,固定为 apply_patch。

  • "apply_patch"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • top_p: optional number (default: 1)

用于核采样的参数,是 temperature 的替代方案;1.0 表示包含所有词元。

  • error: EvalAPIError or null

表示 Eval API 错误响应的对象。

  • code: string

错误代码。

  • message: string

错误消息。

  • eval_id: string

关联评测的标识。

  • metadata: Metadata or null

可附加到对象的元数据,最多包含 16 组键值对,可 以结构化方式存储对象的额外信息, 并通过 API 或控制台查询对象。

键为最多 64 个字符的字符串,值为 最多 512 个字符的字符串。

  • model: string or null

被评测的模型,如适用。

  • name: string or null

评测运行名称。

  • object: "eval.run" (default: "eval.run")

对象类型,固定为 "eval.run"。

  • "eval.run"

  • per_model_usage: array of object { cached_tokens, completion_tokens, invocation_count, 3 more } or null

评测运行期间各模型的用量统计。

  • cached_tokens: integer

从缓存读取的词元数。

  • completion_tokens: integer

生成的补全词元数。

  • invocation_count: integer

调用次数。

  • model_name: string

模型名称。

  • prompt_tokens: integer

使用的提示词词元数。

  • total_tokens: integer

使用的总词元数。

  • per_testing_criteria_results: array of object { failed, passed, testing_criteria } or null

评测运行中各测试标准的结果。

  • failed: integer

未通过此标准的测试数量。

  • passed: integer

通过此标准的测试数量。

  • testing_criteria: string

测试标准的描述。

  • report_url: string

在控制台界面中呈现评测运行报告的 URL。

format: uri

  • result_counts: object { errored, failed, passed, total }

汇总评测运行结果的计数器。

  • errored: integer

因错误而失败的输出条目数量。

  • failed: integer

未通过评测的输出条目数量。

  • passed: integer

通过评测的输出条目数量。

  • total: integer

已执行的输出条目总数。

  • status: string

评测运行状态。

运行创建响应

  • RunCreateResponse object { id, created_at, data_source, 11 more }

表示评测运行的模式。

  • id: string

评测运行的唯一标识。

  • created_at: integer

评测运行创建时的 Unix 时间戳,单位为秒。

format: unixtime

  • data_source: CreateEvalJSONLRunDataSource or CreateEvalCompletionsRunDataSource or ResponsesRunDataSource { source, type, input_messages, 2 more }

本次运行的数据源信息。

  • CreateEvalJSONLRunDataSource object { source, type }

JsonlRunDataSource 对象,指定与该评测匹配的 JSONL 文件。

  • source: EvalJSONLFileContentSource { content, type } or EvalJSONLFileIDSource { id, type }

决定数据源中 item 命名空间的内容。

  • EvalJSONLFileContentSource object { content, type }

  • content: array of object { item, sample }

JSONL 文件的内容。

  • item: map[unknown]

  • sample: optional map[unknown]

  • type: "file_content" (default: "file_content")

JSONL 来源的类型,固定为 file_content。

  • "file_content"

  • EvalJSONLFileIDSource object { id, type }

  • id: string

文件标识。

  • type: "file_id" (default: "file_id")

JSONL 来源的类型,固定为 file_id。

  • "file_id"

  • type: "jsonl" (default: "jsonl")

数据源类型,固定为 jsonl。

  • "jsonl"

  • CreateEvalCompletionsRunDataSource object { source, type, input_messages, 2 more }

描述模型采样配置的 CompletionsRunDataSource 对象。

  • source: EvalJSONLFileContentSource { content, type } or EvalJSONLFileIDSource { id, type } or StoredCompletionsRunDataSource { type, created_after, created_before, 3 more }

决定本次运行数据源中 item 命名空间的内容。

  • EvalJSONLFileContentSource object { content, type }

  • content: array of object { item, sample }

JSONL 文件的内容。

  • item: map[unknown]

  • sample: optional map[unknown]

  • type: "file_content" (default: "file_content")

JSONL 来源的类型,固定为 file_content。

  • "file_content"

  • EvalJSONLFileIDSource object { id, type }

  • id: string

文件标识。

  • type: "file_id" (default: "file_id")

JSONL 来源的类型,固定为 file_id。

  • "file_id"

  • StoredCompletionsRunDataSource object { type, created_after, created_before, 3 more }

描述一组筛选条件的 StoredCompletionsRunDataSource 配置。

  • type: "stored_completions" (default: "stored_completions")

来源类型,固定为 stored_completions。

  • "stored_completions"

  • created_after: optional integer or null

可选的 Unix 时间戳,用于筛选在此时间之后创建的条目。

  • created_before: optional integer or null

可选的 Unix 时间戳,用于筛选在此时间之前创建的条目。

  • limit: optional integer or null

可选的返回条目数量上限。

  • metadata: optional Metadata or null

可附加到对象的元数据,最多包含 16 组键值对,可 以结构化方式存储对象的额外信息, 并通过 API 或控制台查询对象。

键为最多 64 个字符的字符串,值为 最多 512 个字符的字符串。

  • model: optional string or null

可选的模型筛选条件,例如 'gpt-6-astra'。

  • type: "completions" (default: "completions")

运行数据源类型,固定为 completions。

  • "completions"

  • input_messages: optional TemplateInputMessages { template, type } or ItemReferenceInputMessages { item_reference, type }

从模型采样时使用,规定传给模型的消息结构。可以引用预先构建的轨迹,例如 item.input_trajectory,也可以使用包含 item 命名空间变量引用的模板。

  • TemplateInputMessages object { template, type }

  • template: array of EasyInputMessage or EvalMessageObject { content, role, type }

构成提示词或上下文的聊天消息列表,可以包含对 item 命名空间的变量引用,例如 {{item.name}}。

  • EasyInputMessage object { content, role, phase, type }

输入模型的消息,其角色表示指令遵循的 优先级。以 developer 或 system 角色给出的指令 优先于 user 角色给出的指令。 assistant 角色的消息被视为模型在此前 交互中生成的内容。

  • content: string or ResponseInputMessageContentList

用于生成响应的文本、图像或音频输入。 也可以包含此前的助手响应。

  • TextInput = string

输入模型的文本。

  • ResponseInputMessageContentList = array of ResponseInputContent

输入模型的一个或多个条目的列表,可以包含不同 内容类型。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • text: string

输入模型的文本。

  • type: "input_text" (default: "input_text")

输入条目类型,固定为 input_text。

  • "input_text"

  • prompt_cache_breakpoint: optional object { mode, ttl }

标记可复用提示词前缀的精确结束位置。省略 ttl 时,断点继承请求中的 prompt_cache_options.ttl;该边界不会按词元块取整。

  • mode: "explicit" (default: "explicit")

断点模式,固定为 explicit。

  • "explicit"

  • ttl: optional "30m" or "12h"

此缓存断点的最短存续时间,默认为请求的 TTL。

  • "30m"

  • "12h"

  • ResponseInputImage object { detail, type, file_id, 2 more }

输入模型的图像。参阅图像输入。

  • detail: ImageDetail

发送给模型的图像细节级别,可选 high、low、auto 或 original,默认为 auto。

  • "low"

  • "high"

  • "auto"

  • "original"

  • type: "input_image" (default: "input_image")

输入条目类型,固定为 input_image。

  • "input_image"

  • file_id: optional string or null

要发送给模型的文件 ID。

  • image_url: optional string or null

要发送给模型的图像 URL,可以是完整 URL,或包含 Base64 编码图像的 data URL。

format: uri

  • prompt_cache_breakpoint: optional object { mode, ttl }

标记可复用提示词前缀的精确结束位置。省略 ttl 时,断点继承请求中的 prompt_cache_options.ttl;该边界不会按词元块取整。

  • mode: "explicit" (default: "explicit")

断点模式,固定为 explicit。

  • "explicit"

  • ttl: optional "30m" or "12h"

此缓存断点的最短存续时间,默认为请求的 TTL。

  • "30m"

  • "12h"

  • ResponseInputFile object { type, detail, file_data, 4 more }

输入模型的文件。

  • type: "input_file" (default: "input_file")

输入条目类型,固定为 input_file。

  • "input_file"

  • detail: optional "auto" or "low" or "high"

发送给模型的文件细节级别。使用 auto 由系统选择;对于 GPT-5.6 及后续模型,auto 使用高质量渲染,可能增加输入词元用量。使用 low 进行成本较低的渲染,或使用 high 以更高质量渲染文件。默认为 auto。

  • "auto"

  • "low"

  • "high"

  • file_data: optional string

要发送给模型的文件内容。

  • file_id: optional string or null

要发送给模型的文件 ID。

  • file_url: optional string

要发送给模型的文件 URL。

format: uri

  • filename: optional string

要发送给模型的文件名。

  • prompt_cache_breakpoint: optional object { mode, ttl }

标记可复用提示词前缀的精确结束位置。省略 ttl 时,断点继承请求中的 prompt_cache_options.ttl;该边界不会按词元块取整。

  • mode: "explicit" (default: "explicit")

断点模式,固定为 explicit。

  • "explicit"

  • ttl: optional "30m" or "12h"

此缓存断点的最短存续时间,默认为请求的 TTL。

  • "30m"

  • "12h"

  • role: "user" or "assistant" or "system" or "developer"

输入消息的角色,可选 user、assistant、system 或 developer.

  • "user"

  • "assistant"

  • "system"

  • "developer"

  • phase: optional "commentary" or "final_answer" or null

将 assistant 消息标记为中间说明(commentary)或最终答案(final_answer)。 对于 gpt-5.3-codex 及后续此类模型,发送后续请求时,须保留并重新发送 所有助手消息的 phase;丢弃它可能降低表现。用户消息不使用此字段。

  • "commentary"

  • "final_answer"

  • type: optional "message"

输入消息类型,固定为 message。

  • "message"

  • EvalMessageObject object { content, role, type }

输入模型的消息,其角色表示指令遵循的 优先级。以 developer 或 system 角色给出的指令 优先于 user 角色给出的指令。 assistant 角色的消息被视为模型在此前 交互中生成的内容。

  • content: string or ResponseInputText or OutputText { text, type } or 3 more

模型输入,可以包含模板字符串。支持输入文本、输出文本、输入图像和输入音频,可提供单个条目或条目数组。

  • TextInput = string

输入模型的文本。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • OutputText object { text, type }

模型输出的文本。

  • text: string

模型输出的文本内容。

  • type: "output_text"

输出文本类型,固定为 output_text。

  • "output_text"

  • InputImage object { image_url, type, detail }

用于 EvalItem 内容数组中的图像输入块。

  • image_url: string

输入图像的 URL。

format: uri

  • type: "input_image"

输入图像类型,固定为 input_image。

  • "input_image"

  • detail: optional string

发送给模型的图像细节级别,可选 high、low 或 auto,默认为 auto。

  • ResponseInputAudio object { input_audio, type }

输入模型的音频。

  • input_audio: object { data, format }

  • data: string

采用 Base64 编码的音频数据。

  • format: "mp3" or "wav"

音频数据格式,当前支持 mp3 和 wav.

  • "mp3"

  • "wav"

  • type: "input_audio"

输入条目类型,固定为 input_audio。

  • "input_audio"

  • GraderInputs = array of string or ResponseInputText or OutputText { text, type } or 2 more

输入列表,每项可以是输入文本、输出文本、输入 图像或输入音频对象。

  • TextInput = string

输入模型的文本。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • OutputText object { text, type }

模型输出的文本。

  • text: string

模型输出的文本内容。

  • type: "output_text"

输出文本类型,固定为 output_text。

  • "output_text"

  • InputImage object { image_url, type, detail }

用于 EvalItem 内容数组中的图像输入块。

  • image_url: string

输入图像的 URL。

format: uri

  • type: "input_image"

输入图像类型,固定为 input_image。

  • "input_image"

  • detail: optional string

发送给模型的图像细节级别,可选 high、low 或 auto,默认为 auto。

  • ResponseInputAudio object { input_audio, type }

输入模型的音频。

  • role: "user" or "assistant" or "system" or "developer"

输入消息的角色,可选 user、assistant、system 或 developer.

  • "user"

  • "assistant"

  • "system"

  • "developer"

  • type: optional "message"

输入消息类型,固定为 message。

  • "message"

  • type: "template"

输入消息类型,固定为 template。

  • "template"

  • ItemReferenceInputMessages object { item_reference, type }

  • item_reference: string

对 item 命名空间中变量的引用,例如 "item.input_trajectory"。

  • type: "item_reference"

输入消息类型,固定为 item_reference。

  • "item_reference"

  • model: optional string

用于生成补全内容的模型名称,例如 "o3-mini"。

  • sampling_params: optional object { max_completion_tokens, reasoning_effort, response_format, 4 more }

  • max_completion_tokens: optional integer

生成输出的最大词元数。

  • reasoning_effort: optional ReasoningEffort or null (default: "medium")

限制推理模型的推理强度。当前支持 none、minimal、low、medium、high、xhigh 和 max。 降低推理强度可能加快响应,并减少响应中用于 推理的词元数。并非所有推理模型都支持每个 取值。各模型的支持情况请参阅 推理指南 中的说明。

  • "none"

  • "minimal"

  • "low"

  • "medium"

  • "high"

  • "xhigh"

  • "max"

  • response_format: optional ResponseFormatText or ResponseFormatJSONSchema or ResponseFormatJSONObject

指定模型必须输出的格式的对象。

设为 { "type": "json_schema", "json_schema": {...} } 会启用 结构化输出,确保模型遵循你提供的 JSON 模式。更多信息请参阅结构化输出 指南。

设为 { "type": "json_object" } 会启用旧版 JSON 模式, 确保模型生成有效的 JSON。对于支持的模型,优先使用 json_schema 格式。

  • ResponseFormatText object { type }

默认响应格式,用于生成文本响应。

  • type: "text"

定义的响应格式类型,固定为 text。

  • "text"

  • ResponseFormatJSONSchema object { json_schema, type }

JSON Schema 响应格式,用于生成结构化 JSON 响应。 参阅结构化输出。

  • json_schema: object { name, description, schema, strict }

结构化输出配置选项,包含 JSON Schema。

  • name: string

响应格式的名称,须使用 a-z、A-Z、0-9,或包含 下划线和连字符,最长为 64 个字符。

  • description: optional string

响应格式的用途描述,模型据此 判断如何按该格式响应。

  • schema: optional map[unknown]

以 JSON Schema 对象描述的响应格式模式。 JSON Schema 的构建方法参阅此处。

  • strict: optional boolean or null (default: false)

生成输出时是否启用严格模式遵循。 设为 true 时,模型始终严格遵循 schema 字段中定义的模式。strict 为 true 时仅支持 JSON Schema 的子集。更多信息请参阅结构化输出 指南。

  • type: "json_schema"

定义的响应格式类型,固定为 json_schema。

  • "json_schema"

  • ResponseFormatJSONObject object { type }

JSON 对象响应格式,是生成 JSON 响应的较早方式。 对于支持的模型,建议使用 json_schema。注意: 须在系统消息或用户消息中指示模型生成 JSON, 模型才会生成 JSON。

  • type: "json_object"

定义的响应格式类型,固定为 json_object。

  • "json_object"

  • seed: optional integer (default: 42)

采样时用于初始化随机性的种子值。

  • temperature: optional number (default: 1)

较高的 temperature 会增加输出的随机性。

  • tools: optional array of ChatCompletionFunctionTool

模型可以调用的工具列表。目前工具仅支持函数。通过此项提供模型可为其生成 JSON 输入的函数列表,最多支持 128 个函数。

  • function: FunctionDefinition

  • name: string

要调用的函数名称,须使用 a-z、A-Z、0-9,或包含下划线和连字符,最长为 64 个字符。

  • description: optional string

函数功能的描述,模型据此选择何时以及如何调用该函数。

  • parameters: optional FunctionParameters

函数接受的参数,以 JSON Schema 对象描述。示例参阅指南,格式说明参阅 JSON Schema 参考。

省略 parameters 表示定义参数列表为空的函数。

  • strict: optional boolean or null (default: false)

生成函数调用时是否启用严格模式遵循。设为 true 时,模型严格遵循 parameters 字段中定义的模式。strict 为 true 时仅支持 JSON Schema 的子集。结构化输出的更多信息参阅函数调用指南。

  • type: "function"

工具类型,目前仅支持 function。

  • "function"

  • top_p: optional number (default: 1)

用于核采样的参数,是 temperature 的替代方案;1.0 表示包含所有词元。

  • ResponsesRunDataSource object { source, type, input_messages, 2 more }

描述模型采样配置的 ResponsesRunDataSource 对象。

  • source: EvalJSONLFileContentSource { content, type } or EvalJSONLFileIDSource { id, type } or EvalResponsesSource { type, created_after, created_before, 8 more }

决定本次运行数据源中 item 命名空间的内容。

  • EvalJSONLFileContentSource object { content, type }

  • content: array of object { item, sample }

JSONL 文件的内容。

  • item: map[unknown]

  • sample: optional map[unknown]

  • type: "file_content" (default: "file_content")

JSONL 来源的类型,固定为 file_content。

  • "file_content"

  • EvalJSONLFileIDSource object { id, type }

  • id: string

文件标识。

  • type: "file_id" (default: "file_id")

JSONL 来源的类型,固定为 file_id。

  • "file_id"

  • EvalResponsesSource object { type, created_after, created_before, 8 more }

描述运行数据源配置的 EvalResponsesSource 对象。

  • type: "responses"

运行数据源类型,固定为 responses。

  • "responses"

  • created_after: optional integer or null

仅包含在此时间戳之后创建的条目,含边界。此查询参数用于选择响应。

minimum: 0

  • created_before: optional integer or null

仅包含在此时间戳之前创建的条目,含边界。此查询参数用于选择响应。

minimum: 0

  • instructions_search: optional string or null

可选的字符串,用于搜索 'instructions' 字段。此查询参数用于选择响应。

  • metadata: optional unknown or null

响应的元数据筛选条件。此查询参数用于选择响应。

  • model: optional string or null

要查找其响应的模型名称。此查询参数用于选择响应。

  • reasoning_effort: optional ReasoningEffort or null (default: "medium")

限制推理模型的推理强度。当前支持 none、minimal、low、medium、high、xhigh 和 max。 降低推理强度可能加快响应,并减少响应中用于 推理的词元数。并非所有推理模型都支持每个 取值。各模型的支持情况请参阅 推理指南 中的说明。

  • temperature: optional number or null

采样温度。此查询参数用于选择响应。

  • tools: optional array of string or null

工具名称列表。此查询参数用于选择响应。

  • top_p: optional number or null

核采样参数。此查询参数用于选择响应。

  • users: optional array of string or null

用户标识列表。此查询参数用于选择响应。

  • type: "responses" (default: "responses")

运行数据源类型,固定为 responses。

  • "responses"

  • input_messages: optional InputMessagesTemplate { template, type } or InputMessagesItemReference { item_reference, type }

从模型采样时使用,规定传给模型的消息结构。可以引用预先构建的轨迹,例如 item.input_trajectory,也可以使用包含 item 命名空间变量引用的模板。

  • InputMessagesTemplate object { template, type }

  • template: array of ChatMessage { content, role } or EvalMessageObject { content, role, type }

构成提示词或上下文的聊天消息列表,可以包含对 item 命名空间的变量引用,例如 {{item.name}}。

  • ChatMessage object { content, role }

  • content: string

消息内容。

  • role: string

消息角色,例如 "system"、"assistant"、"user"。

  • EvalMessageObject object { content, role, type }

输入模型的消息,其角色表示指令遵循的 优先级。以 developer 或 system 角色给出的指令 优先于 user 角色给出的指令。 assistant 角色的消息被视为模型在此前 交互中生成的内容。

  • content: string or ResponseInputText or OutputText { text, type } or 3 more

模型输入,可以包含模板字符串。支持输入文本、输出文本、输入图像和输入音频,可提供单个条目或条目数组。

  • TextInput = string

输入模型的文本。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • OutputText object { text, type }

模型输出的文本。

  • text: string

模型输出的文本内容。

  • type: "output_text"

输出文本类型,固定为 output_text。

  • "output_text"

  • InputImage object { image_url, type, detail }

用于 EvalItem 内容数组中的图像输入块。

  • image_url: string

输入图像的 URL。

format: uri

  • type: "input_image"

输入图像类型,固定为 input_image。

  • "input_image"

  • detail: optional string

发送给模型的图像细节级别,可选 high、low 或 auto,默认为 auto。

  • ResponseInputAudio object { input_audio, type }

输入模型的音频。

  • GraderInputs = array of string or ResponseInputText or OutputText { text, type } or 2 more

输入列表,每项可以是输入文本、输出文本、输入 图像或输入音频对象。

  • role: "user" or "assistant" or "system" or "developer"

输入消息的角色,可选 user、assistant、system 或 developer.

  • "user"

  • "assistant"

  • "system"

  • "developer"

  • type: optional "message"

输入消息类型,固定为 message。

  • "message"

  • type: "template"

输入消息类型,固定为 template。

  • "template"

  • InputMessagesItemReference object { item_reference, type }

  • item_reference: string

对 item 命名空间中变量的引用,例如 "item.name"。

  • type: "item_reference"

输入消息类型,固定为 item_reference。

  • "item_reference"

  • model: optional string

用于生成补全内容的模型名称,例如 "o3-mini"。

  • sampling_params: optional object { max_completion_tokens, reasoning_effort, seed, 4 more }

  • max_completion_tokens: optional integer

生成输出的最大词元数。

  • reasoning_effort: optional ReasoningEffort or null (default: "medium")

限制推理模型的推理强度。当前支持 none、minimal、low、medium、high、xhigh 和 max。 降低推理强度可能加快响应,并减少响应中用于 推理的词元数。并非所有推理模型都支持每个 取值。各模型的支持情况请参阅 推理指南 中的说明。

  • seed: optional integer (default: 42)

采样时用于初始化随机性的种子值。

  • temperature: optional number (default: 1)

较高的 temperature 会增加输出的随机性。

  • text: optional object { format }

模型文本响应的配置选项,可以是纯 文本或结构化 JSON 数据。更多信息:

  • format: optional ResponseFormatTextConfig

指定模型必须输出的格式的对象。

配置 { "type": "json_schema" } 会启用结构化输出, 确保模型遵循你提供的 JSON Schema。更多信息参阅 结构化输出指南。

默认格式为 { "type": "text" },没有额外选项。

不建议用于 gpt-4o 及后续模型:

设为 { "type": "json_object" } 会启用旧版 JSON 模式, 确保模型生成有效的 JSON。对于支持的模型,优先使用 json_schema 格式。

  • ResponseFormatText object { type }

默认响应格式,用于生成文本响应。

  • ResponseFormatTextJSONSchemaConfig object { name, schema, type, 2 more }

JSON Schema 响应格式,用于生成结构化 JSON 响应。 参阅结构化输出。

  • name: string

响应格式的名称,须使用 a-z、A-Z、0-9,或包含 下划线和连字符,最长为 64 个字符。

  • schema: map[unknown]

以 JSON Schema 对象描述的响应格式模式。 JSON Schema 的构建方法参阅此处。

  • type: "json_schema"

定义的响应格式类型,固定为 json_schema。

  • "json_schema"

  • description: optional string

响应格式的用途描述,模型据此 判断如何按该格式响应。

  • strict: optional boolean or null (default: false)

生成输出时是否启用严格模式遵循。 设为 true 时,模型始终严格遵循 schema 字段中定义的模式。strict 为 true 时仅支持 JSON Schema 的子集。更多信息请参阅结构化输出 指南。

  • ResponseFormatJSONObject object { type }

JSON 对象响应格式,是生成 JSON 响应的较早方式。 对于支持的模型,建议使用 json_schema。注意: 须在系统消息或用户消息中指示模型生成 JSON, 模型才会生成 JSON。

  • tools: optional array of Function { name, parameters, strict, 6 more } or FileSearch { type, vector_store_ids, filters, 2 more } or Computer { type } or 13 more

模型生成响应时可以调用的工具数组。你 可以通过 tool_choice 参数指定要使用的工具。

可向模型提供以下两类工具:

  • 内置工具:由 OpenAI 提供,用于扩展 模型能力,例如网页搜索 或文件搜索。更多信息参阅 内置工具。
  • 函数调用(自定义工具):由你定义的函数, 使模型可以调用你自己的代码。更多信息参阅 函数调用。

  • Function object { name, parameters, strict, 6 more }

定义模型可以选择调用的自有代码函数。参阅函数调用。

  • name: string

要调用的函数名称。

  • parameters: map[unknown] or null

描述函数参数的 JSON Schema 对象。

  • strict: boolean or null

是否对此函数工具强制执行严格参数校验。

  • type: "function" (default: "function")

函数工具类型,固定为 function。

  • "function"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

  • "direct"

  • "programmatic"

  • async: optional boolean

  • defer_loading: optional boolean

此函数是否延迟加载并通过工具搜索加载。

  • description: optional string or null

函数描述,模型据此判断是否调用该函数。

  • output_schema: optional map[unknown] or null

描述此函数字符串输出中编码的 JSON 值的 JSON Schema 对象。

  • FileSearch object { type, vector_store_ids, filters, 2 more }

搜索已上传文件中相关内容的工具。参阅文件搜索工具。

  • type: "file_search" (default: "file_search")

文件搜索工具类型,固定为 file_search。

  • "file_search"

  • vector_store_ids: array of string

要搜索的向量存储 ID 列表。

  • filters: optional ComparisonFilter or CompoundFilter or null

要应用的筛选条件。

  • ComparisonFilter object { key, type, value }

使用指定比较运算,将某个属性键与给定值比较的筛选条件。

  • key: string

要与值比较的属性键。

  • type: "eq" or "ne" or "gt" or 5 more (default: "eq")

指定比较运算符:eq、ne、gt、gte、lt、lte、in、nin。

  • eq:等于
  • ne:不等于
  • gt:大于
  • gte:大于或等于
  • lt:小于
  • lte:小于或等于
  • in:属于
  • nin:不属于

  • "eq"

  • "ne"

  • "gt"

  • "gte"

  • "lt"

  • "lte"

  • "in"

  • "nin"

  • value: string or number or boolean or array of string or number

用于与属性键比较的值,支持字符串、数字或布尔类型。

  • string

  • number

  • boolean

  • array of string or number

  • string

  • number

  • CompoundFilter object { filters, type }

使用 and 或 or 组合多个筛选条件。

  • filters: array of ComparisonFilter or CompoundFilter

要组合的筛选条件数组,条目可以是 ComparisonFilter 或 CompoundFilter。

  • ComparisonFilter object { key, type, value }

使用指定比较运算,将某个属性键与给定值比较的筛选条件。

  • CompoundFilter object { filters, type }

使用 and 或 or 组合多个筛选条件。

  • type: "and" or "or"

运算类型:and 或 or。

  • "and"

  • "or"

  • max_num_results: optional integer

返回结果数量上限,须介于 1–50 之间,含边界。

  • ranking_options: optional object { hybrid_search, ranker, score_threshold }

搜索结果的排序选项。

  • hybrid_search: optional object { embedding_weight, text_weight }

启用混合搜索时,控制倒数排名融合如何平衡语义嵌入匹配与稀疏关键词匹配的权重。

  • embedding_weight: number

嵌入在倒数排名融合中的权重。

  • text_weight: number

文本在倒数排名融合中的权重。

  • ranker: optional "auto" or "default-2024-11-15"

文件搜索所用的排序器。

  • "auto"

  • "default-2024-11-15"

  • score_threshold: optional number

文件搜索的分数阈值,为 0–1 之间的数字。越接近 1,越倾向于只返回最相关的结果,但返回数量可能减少。

  • Computer object { type }

控制虚拟计算机的工具。参阅计算机工具。

  • type: "computer" (default: "computer")

计算机工具类型,固定为 computer。

  • "computer"

  • ComputerUsePreview object { display_height, display_width, environment, type }

控制虚拟计算机的工具。参阅计算机工具。

  • display_height: integer

计算机显示区域的高度。

  • display_width: integer

计算机显示区域的宽度。

  • environment: "windows" or "mac" or "linux" or 2 more

要控制的计算机环境类型。

  • "windows"

  • "mac"

  • "linux"

  • "ubuntu"

  • "browser"

  • type: "computer_use_preview" (default: "computer_use_preview")

计算机使用工具类型,固定为 computer_use_preview。

  • "computer_use_preview"

  • WebSearch object { type, external_web_access, filters, 2 more }

在互联网上搜索与提示词相关的信息来源。参阅 网络搜索工具时。

  • type: "web_search" or "web_search_2025_08_26" (default: "web_search")

网页搜索工具类型,可选 web_search 或 web_search_2025_08_26。

  • "web_search"

  • "web_search_2025_08_26"

  • external_web_access: optional boolean (default: true)

是否允许网页搜索实时访问互联网。省略时默认为 true。设为 false 时,网页搜索工具以离线或仅缓存模式运行,不会抓取新的外部内容。

  • filters: optional object { allowed_domains } or null

搜索的筛选条件。

  • allowed_domains: optional array of string or null (default: [])

搜索允许的域名。未提供时允许所有域名。 也允许访问所提供域名的子域名。

示例:["pubmed.ncbi.nlm.nih.gov"]

  • search_context_size: optional "low" or "medium" or "high" (default: "medium")

对搜索占用上下文窗口空间大小的总体指导,可选 low、medium 或 high,默认为 medium。

  • "low"

  • "medium"

  • "high"

  • user_location: optional object { city, country, region, 2 more } or null

用户的大致位置。省略或设为 null 时,默认为 美国。若要避免此默认值,可传入不包含位置字段的 {"type": "approximate"}。 若要本地化结果,须提供相应位置字段。

  • city: optional string or null

用户所在城市的自由文本,例如 San Francisco。

  • country: optional string or null

用户所在国家/地区的两字母 ISO 代码,例如 US。

  • region: optional string or null

用户所在地区的自由文本,例如 California。

  • timezone: optional string or null

用户所在的 IANA 时区,例如 America/Los_Angeles。

  • type: optional "approximate" (default: "approximate")

位置估算类型,固定为 approximate。

  • "approximate"

  • Mcp object { server_label, type, allowed_callers, 9 more }

通过远程模型上下文协议(MCP)服务器, 向模型提供额外工具。了解 MCP。

  • server_label: string

此 MCP 服务器的标签,用于在工具调用中标识服务器。

  • type: "mcp"

MCP 工具类型,固定为 mcp。

  • "mcp"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • allowed_tools: optional array of string or McpToolFilter { read_only, tool_names } or null

允许的工具名称列表或筛选对象。

  • McpAllowedTools = array of string

允许的工具名称组成的字符串数组。

  • McpToolFilter object { read_only, tool_names }

用于指定允许哪些工具的筛选对象。

  • read_only: optional boolean

表示工具会修改数据还是只读。如果 MCP 服务器标注了 readOnlyHint, 就会与此筛选条件匹配。

  • tool_names: optional array of string

允许的工具名称列表。

  • authorization: optional string

可用于远程 MCP 服务器的 OAuth 访问令牌,既可 配合自定义 MCP 服务器 URL,也可配合服务连接器。你的应用 须处理 OAuth 授权流程,并在此提供令牌。

  • connector_id: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 5 more

服务连接器的标识,例如 ChatGPT 中提供的连接器。须提供 server_url、connector_id 或 tunnel_id 中的一项。更多 服务连接器信息参阅此处。

对于 2026 年 9 月 1 日之后发布的模型,此字段已弃用。 使用 server_url 连接远程 MCP 服务器,或使用 tunnel_id 通过安全 MCP 隧道连接。

当前支持的 connector_id 值如下:

  • Dropbox:connector_dropbox
  • Gmail:connector_gmail
  • Google 日历:connector_googlecalendar
  • Google 云端硬盘:connector_googledrive
  • Microsoft Teams:connector_microsoftteams
  • Outlook 日历:connector_outlookcalendar
  • Outlook 邮箱:connector_outlookemail
  • SharePoint:connector_sharepoint

  • "connector_dropbox"

  • "connector_gmail"

  • "connector_googlecalendar"

  • "connector_googledrive"

  • "connector_microsoftteams"

  • "connector_outlookcalendar"

  • "connector_outlookemail"

  • "connector_sharepoint"

  • defer_loading: optional boolean

此 MCP 工具是否延迟加载并通过工具搜索发现。

  • headers: optional map[string] or null

可选的发送给 MCP 服务器的 HTTP 请求头,用于认证 或其他用途。

  • require_approval: optional McpToolApprovalFilter { always, never } or "always" or "never" or null (default: "always")

指定 MCP 服务器的哪些工具需要批准。

  • McpToolApprovalFilter object { always, never }

指定 MCP 服务器的哪些工具需要批准。可以是 always、never,或与需要批准的工具关联的 筛选对象。

  • always: optional object { read_only, tool_names }

用于指定允许哪些工具的筛选对象。

  • read_only: optional boolean

表示工具会修改数据还是只读。如果 MCP 服务器标注了 readOnlyHint, 就会与此筛选条件匹配。

  • tool_names: optional array of string

允许的工具名称列表。

  • never: optional object { read_only, tool_names }

用于指定允许哪些工具的筛选对象。

  • read_only: optional boolean

表示工具会修改数据还是只读。如果 MCP 服务器标注了 readOnlyHint, 就会与此筛选条件匹配。

  • tool_names: optional array of string

允许的工具名称列表。

  • McpToolApprovalSetting = "always" or "never"

为所有工具指定统一的批准策略,可选 always 或 never。设为 always 时,所有工具均需要批准; 设为 never 时,所有工具均不需要批准。

  • "always"

  • "never"

  • server_description: optional string

MCP 服务器的可选描述,用于提供更多上下文。

  • server_url: optional string

MCP 服务器的 URL。须提供 server_url、connector_id 或 tunnel_id 中的一项。

format: uri

  • tunnel_id: optional string

用来替代直接服务器 URL 的安全 MCP 隧道 ID。须提供 server_url、connector_id 或 tunnel_id 中的一项。

pattern: ^tunnel_[a-z0-9]{32}$

  • CodeInterpreter object { container, type, allowed_callers }

运行 Python 代码以帮助生成提示词响应的工具。

  • container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }

代码解释器容器,可以是容器 ID,也可以是 指定代码可用的已上传文件 ID 的对象,同时可提供 可选的 memory_limit 设置。

  • string

容器 ID。

  • CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }

代码解释器容器配置,可以指定运行代码时所处理的文件 ID。

  • type: "auto" (default: "auto")

固定为 auto。

  • "auto"

  • file_ids: optional array of string

可选的已上传文件列表,这些文件将提供给代码使用。

maxItems: 50

  • memory_limit: optional "1g" or "4g" or "16g" or "64g" or null

代码解释器容器的内存上限。

  • "1g"

  • "4g"

  • "16g"

  • "64g"

  • network_policy: optional ContainerNetworkPolicyDisabled or ContainerNetworkPolicyAllowlist

容器的网络访问策略。

  • ContainerNetworkPolicyDisabled object { type }

  • type: "disabled" (default: "disabled")

禁用出站网络访问,固定为 disabled。

  • "disabled"

  • ContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }

  • allowed_domains: array of string

type 为 allowlist 时允许访问的域名列表。

minItems: 1

  • type: "allowlist" (default: "allowlist")

仅允许对指定域名发起出站网络访问,固定为 allowlist。

  • "allowlist"

  • domain_secrets: optional array of ContainerNetworkPolicyDomainSecret

可选的仅用于允许访问域名的域名级密钥。

minItems: 1

  • domain: string

密钥关联的域名。

minLength: 1

  • name: string

要为该域名注入的密钥名称。

minLength: 1

  • value: string

要为该域名注入的密钥值。

minLength: 1, maxLength: 10485760

  • type: "code_interpreter"

代码解释器工具类型,固定为 code_interpreter。

  • "code_interpreter"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • ProgrammaticToolCalling object { type }

  • type: "programmatic_tool_calling" (default: "programmatic_tool_calling")

工具类型,固定为 programmatic_tool_calling。

  • "programmatic_tool_calling"

  • ImageGeneration object { type, action, background, 13 more }

使用 GPT 图像模型生成图像的工具。

  • type: "image_generation"

图像生成工具类型,固定为 image_generation。

  • "image_generation"

  • action: optional "generate" or "edit" or "auto"

生成新图像还是编辑已有图像,默认为 auto。

  • "generate"

  • "edit"

  • "auto"

  • background: optional "transparent" or "opaque" or "auto" (default: "auto")

生成图像的背景,可选 transparent、opaque, 或 auto。gpt-image-2.5-sunburst 和 gpt-image-2.5-flare,包括 对应的 2026-09-08 快照,支持 opaque 和 transparent 背景。受支持的 GPT Image 模型可以使用透明 背景。对于 gpt-image-2 和 gpt-image-2-2026-04-21,此功能处于 预览阶段。使用 transparent 时,须将输出格式设为 png 或 webp。 默认为 auto。

  • "transparent"

  • "opaque"

  • "auto"

  • complexity: optional "low" or "medium" or "high"

用于规划图像的计算投入,与渲染质量分开设置。 覆盖外层响应用于图像生成的 reasoning.effort。 省略时,继承外层受支持的推理强度,或使用 图像模型配置的默认值。 对于 SVG 输出,此项控制参考图像,而不是 SVG 生成模型的 推理。

  • "low"

  • "medium"

  • "high"

  • frame_count: optional integer (default: 9)

GIF 帧数,要求 output_format 为 gif,默认为 9。

minimum: 2, maximum: 16

  • frame_duration_ms: optional integer (default: 200)

每个 GIF 帧的时长,单位为毫秒,取整到 10 毫秒。 要求 output_format 为 gif,默认为 200。

minimum: 20, maximum: 2000

  • input_fidelity: optional "high" or "low" or null

控制模型为匹配输入图像风格和特征(尤其是面部特征)投入的程度。gpt-image-1.5 支持 high 和 low,gpt-image-1-mini 仅支持 low。使用 gpt-image-2 时应省略此参数。支持该参数的模型默认为 low。

  • "high"

  • "low"

  • input_image_mask: optional object { file_id, image_url }

可选的局部重绘蒙版,包含 image_url (可选字符串)和 file_id(可选字符串)。

  • file_id: optional string

蒙版图像的文件 ID。

  • image_url: optional string

采用 Base64 编码的蒙版图像。

  • model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-2" or 9 more

用于图像生成的模型,可选 gpt-image-1-mini、 gpt-image-1.5, gpt-image-2, gpt-image-2-2026-04-21、gpt-image-2.5-sunburst、 gpt-image-2.5-sunburst-2026-09-08、gpt-image-2.5-flare、 gpt-image-2.5-flare-2026-09-08, gpt-image-2.6-sunburst, gpt-image-2.6-flare 或 chatgpt-image-latest。默认值: gpt-image-2.6-sunburst.

gpt-image-1 已于 2026 年 10 月 23 日停用,请使用 gpt-image-2.5-sunburst 或 gpt-image-2.5-flare。

  • string

  • "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-2" or 9 more

用于图像生成的模型,可选 gpt-image-1-mini、 gpt-image-1.5, gpt-image-2, gpt-image-2-2026-04-21、gpt-image-2.5-sunburst、 gpt-image-2.5-sunburst-2026-09-08、gpt-image-2.5-flare、 gpt-image-2.5-flare-2026-09-08, gpt-image-2.6-sunburst, gpt-image-2.6-flare 或 chatgpt-image-latest。默认值: gpt-image-2.6-sunburst.

gpt-image-1 已于 2026 年 10 月 23 日停用,请使用 gpt-image-2.5-sunburst 或 gpt-image-2.5-flare。

  • "gpt-image-1"

  • "gpt-image-1-mini"

  • "gpt-image-2"

  • "gpt-image-2-2026-04-21"

  • "gpt-image-2.5-sunburst"

  • "gpt-image-2.5-sunburst-2026-09-08"

  • "gpt-image-2.5-flare"

  • "gpt-image-2.5-flare-2026-09-08"

  • "gpt-image-2.6-sunburst"

  • "gpt-image-2.6-flare"

  • "gpt-image-1.5"

  • "chatgpt-image-latest"

  • moderation: optional "auto" or "low" (default: "auto")

生成图像的审核级别,默认为 auto。

  • "auto"

  • "low"

  • output_compression: optional integer (default: 100)

输出图像的压缩级别,默认为 100。

minimum: 0, maximum: 100

  • output_format: optional "png" or "webp" or "jpeg" or 2 more (default: "png")

输出图像格式,可选 png、webp、jpeg、 gif 或 svg,默认为 png。GIF 和 SVG 输出要求模型 支持所选格式。GIF 输出不支持 部分图像流式传输,即 partial_images 大于 0, 也不支持 input_image_mask 或自定义 output_compression。 GIF 输出仍可以流式发送 Responses 生命周期事件。

  • "png"

  • "webp"

  • "jpeg"

  • "gif"

  • "svg"

  • partial_images: optional integer (default: 0)

流式模式中生成的部分图像数量,范围为 0(默认值)到 3。

minimum: 0, maximum: 3

  • quality: optional "low" or "medium" or "high" or 3 more (default: "auto")

生成图像的质量。GPT 图像模型支持 low、 medium 和 high。gpt-image-2.5-sunburst 和 gpt-image-2.5-flare, 包括对应的 2026-09-08 快照,还支持 xhigh 和 max。 默认为 auto。

  • "low"

  • "medium"

  • "high"

  • "xhigh"

  • "max"

  • "auto"

  • size: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "auto" (default: "auto")

生成图像的尺寸。gpt-image-2、gpt-image-2-2026-04-21、gpt-image-2.5-sunburst、gpt-image-2.5-sunburst-2026-09-08、gpt-image-2.5-flare 和 gpt-image-2.5-flare-2026-09-08 支持以 WIDTHxHEIGHT 字符串指定任意分辨率,例如 1536x864。宽和高均须能被 16 整除,宽高比须在 1:3 至 3:1 之间。高于 2560x1440 的分辨率属于实验功能,支持的最高分辨率为 3840x2160。尺寸还须符合模型当前的像素数与边长限制。GPT Image 模型支持标准尺寸 1024x1024、1536x1024 和 1024x1536;允许自动尺寸的模型支持 auto。

  • string

  • "1024x1024" or "1024x1536" or "1536x1024" or "auto"

生成图像的尺寸。gpt-image-2、gpt-image-2-2026-04-21、gpt-image-2.5-sunburst、gpt-image-2.5-sunburst-2026-09-08、gpt-image-2.5-flare 和 gpt-image-2.5-flare-2026-09-08 支持以 WIDTHxHEIGHT 字符串指定任意分辨率,例如 1536x864。宽和高均须能被 16 整除,宽高比须在 1:3 至 3:1 之间。高于 2560x1440 的分辨率属于实验功能,支持的最高分辨率为 3840x2160。尺寸还须符合模型当前的像素数与边长限制。GPT Image 模型支持标准尺寸 1024x1024、1536x1024 和 1024x1536;允许自动尺寸的模型支持 auto。

  • "1024x1024"

  • "1024x1536"

  • "1536x1024"

  • "auto"

  • svg: optional object { model, reasoning }

SVG 生成模型的设置,要求 output_format 为 svg。 启用 SVG 模型选择时,省略此对象会使用 外层响应模型。否则使用默认 SVG 生成模型,且 不能显式覆盖模型。

  • model: optional string

minLength: 1

  • reasoning: optional object { effort } or null

SVG 编写的推理强度。省略时,Images 和 Responses 均使用编写模型的默认值。

  • effort: optional "none" or "minimal" or "low" or 4 more

控制模型为此次请求投入的推理强度。

  • "none"

  • "minimal"

  • "low"

  • "medium"

  • "high"

  • "xhigh"

  • "max"

  • LocalShell object { type }

允许模型在本地环境执行 shell 命令的工具。

  • type: "local_shell" (default: "local_shell")

本地 shell 工具类型,固定为 local_shell。

  • "local_shell"

  • Shell object { type, allowed_callers, environment }

允许模型执行 shell 命令的工具。

  • type: "shell" (default: "shell")

shell 工具类型,固定为 shell。

  • "shell"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • environment: optional ContainerAuto or LocalEnvironment or ContainerReference or null

  • ContainerAuto object { type, file_ids, memory_limit, 2 more }

  • type: "container_auto" (default: "container_auto")

为此请求自动创建容器。

  • "container_auto"

  • file_ids: optional array of string

可选的已上传文件列表,这些文件将提供给代码使用。

maxItems: 50

  • memory_limit: optional "1g" or "4g" or "16g" or "64g" or null

容器的内存上限。

  • "1g"

  • "4g"

  • "16g"

  • "64g"

  • network_policy: optional ContainerNetworkPolicyDisabled or ContainerNetworkPolicyAllowlist

容器的网络访问策略。

  • ContainerNetworkPolicyDisabled object { type }

  • ContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }

  • skills: optional array of SkillReference or InlineSkill

可选的技能列表,通过 ID 或内联数据引用技能。

maxItems: 200

  • SkillReference object { skill_id, type, version }

  • skill_id: string

引用的技能 ID。

minLength: 1, maxLength: 64

  • type: "skill_reference" (default: "skill_reference")

引用通过 /v1/skills 接口创建的技能。

  • "skill_reference"

  • version: optional string

可选的技能版本。使用正整数或 'latest',省略时使用默认版本。

  • InlineSkill object { description, name, source, type }

  • description: string

技能描述。

  • name: string

技能名称。

  • source: InlineSkillSource

内联技能载荷。

  • data: string

采用 Base64 编码的技能 ZIP 包。

minLength: 1, maxLength: 70254592

  • media_type: "application/zip" (default: "application/zip")

内联技能载荷的媒体类型,必须为 application/zip。

  • "application/zip"

  • type: "base64" (default: "base64")

内联技能来源的类型,必须为 base64。

  • "base64"

  • type: "inline" (default: "inline")

为此请求定义内联技能。

  • "inline"

  • LocalEnvironment object { type, skills }

  • type: "local" (default: "local")

使用本地计算机环境。

  • "local"

  • skills: optional array of LocalSkill

可选的技能列表。

maxItems: 200

  • description: string

技能描述。

  • name: string

技能名称。

  • path: string

包含该技能的目录路径。

  • ContainerReference object { container_id, type }

  • container_id: string

引用的容器 ID。

  • type: "container_reference" (default: "container_reference")

引用通过 /v1/containers 接口创建的容器。

  • "container_reference"

  • Custom object { name, type, allowed_callers, 4 more }

使用指定格式处理输入的自定义工具。参阅自定义工具。

  • name: string

自定义工具的名称,用于在工具调用中标识它。

  • type: "custom" (default: "custom")

自定义工具类型,固定为 custom。

  • "custom"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • async: optional boolean

工具响应是否可以异步返回,而非在下一次创建响应时立即返回。

  • defer_loading: optional boolean

此工具是否应延迟加载并通过工具搜索发现。

  • description: optional string

自定义工具的可选描述,用于提供更多上下文。

  • format: optional CustomToolInputFormat

自定义工具的输入格式,默认为无约束文本。

  • Text object { type }

无约束的自由文本。

  • type: "text" (default: "text")

无约束文本格式,固定为 text。

  • "text"

  • Grammar object { definition, syntax, type }

用户定义的语法。

  • definition: string

语法定义。

  • syntax: "lark" or "regex"

语法定义的语法类型,可选 lark 或 regex。

  • "lark"

  • "regex"

  • type: "grammar" (default: "grammar")

语法格式,固定为 grammar。

  • "grammar"

  • Namespace object { description, name, tools, type }

将函数工具或自定义工具归入共享命名空间。

  • description: string

展示给模型的命名空间描述。

  • name: string

工具调用使用的命名空间名称,例如 crm。

minLength: 1

  • tools: array of Function { name, type, allowed_callers, 6 more } or Custom { name, type, allowed_callers, 4 more }

此命名空间内可用的函数工具或自定义工具。

minItems: 1

  • Function object { name, type, allowed_callers, 6 more }

  • name: string

pattern: ^[a-zA-Z0-9_-]+$, minLength: 1, maxLength: 128

  • type: "function" (default: "function")

  • "function"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • async: optional boolean

工具响应是否可以异步返回,而非在下一次创建响应时立即返回。

  • defer_loading: optional boolean

此函数是否应延迟加载并通过工具搜索发现。

  • description: optional string or null

  • output_schema: optional map[unknown] or null

描述此函数工具字符串输出中编码的 JSON 值的 JSON Schema,不用于描述内容数组输出。

  • parameters: optional unknown or null

  • strict: optional boolean or null

是否强制执行严格参数校验。省略时,模式兼容的情况下 Responses 会尝试严格校验,否则退回非严格校验。

  • Custom object { name, type, allowed_callers, 4 more }

使用指定格式处理输入的自定义工具。参阅自定义工具。

  • name: string

自定义工具的名称,用于在工具调用中标识它。

  • type: "custom" (default: "custom")

自定义工具类型,固定为 custom。

  • "custom"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • async: optional boolean

工具响应是否可以异步返回,而非在下一次创建响应时立即返回。

  • defer_loading: optional boolean

此工具是否应延迟加载并通过工具搜索发现。

  • description: optional string

自定义工具的可选描述,用于提供更多上下文。

  • format: optional CustomToolInputFormat

自定义工具的输入格式,默认为无约束文本。

  • type: "namespace" (default: "namespace")

工具类型,固定为 namespace。

  • "namespace"

  • ToolSearch object { type, description, execution, parameters }

用于延迟加载工具的托管工具搜索或自带工具(BYOT)搜索配置。

  • type: "tool_search" (default: "tool_search")

工具类型,固定为 tool_search。

  • "tool_search"

  • description: optional string or null

客户端执行的工具搜索工具展示给模型的描述。

  • execution: optional "server" or "client"

工具搜索由服务端还是客户端执行。

  • "server"

  • "client"

  • parameters: optional unknown or null

客户端执行的工具搜索工具的参数模式。

  • WebSearchPreview object { type, search_content_types, search_context_size, user_location }

搜索网页以获取可用于响应的相关结果的工具。参阅网页搜索工具。

  • type: "web_search_preview" or "web_search_preview_2025_03_11" (default: "web_search_preview")

网页搜索工具类型,可选 web_search_preview 或 web_search_preview_2025_03_11。

  • "web_search_preview"

  • "web_search_preview_2025_03_11"

  • search_content_types: optional array of "text" or "image"

  • "text"

  • "image"

  • search_context_size: optional "low" or "medium" or "high"

对搜索占用上下文窗口空间大小的总体指导,可选 low、medium 或 high,默认为 medium。

  • "low"

  • "medium"

  • "high"

  • user_location: optional object { type, city, country, 2 more } or null

用户的大致位置。省略或设为 null 时默认为美国。若要避免此默认值,可传入不包含位置字段的 {"type": "approximate"}。若要本地化结果,须提供相应位置字段。

  • type: "approximate" (default: "approximate")

位置估算类型,固定为 approximate。

  • "approximate"

  • city: optional string or null

用户所在城市的自由文本,例如 San Francisco。

  • country: optional string or null

用户所在国家/地区的两字母 ISO 代码,例如 US。

  • region: optional string or null

用户所在地区的自由文本,例如 California。

  • timezone: optional string or null

用户所在的 IANA 时区,例如 America/Los_Angeles。

  • ApplyPatch object { type, allowed_callers }

允许助手使用统一差异格式创建、删除或更新文件。

  • type: "apply_patch" (default: "apply_patch")

工具类型,固定为 apply_patch。

  • "apply_patch"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • top_p: optional number (default: 1)

用于核采样的参数,是 temperature 的替代方案;1.0 表示包含所有词元。

  • error: EvalAPIError or null

表示 Eval API 错误响应的对象。

  • code: string

错误代码。

  • message: string

错误消息。

  • eval_id: string

关联评测的标识。

  • metadata: Metadata or null

可附加到对象的元数据,最多包含 16 组键值对,可 以结构化方式存储对象的额外信息, 并通过 API 或控制台查询对象。

键为最多 64 个字符的字符串,值为 最多 512 个字符的字符串。

  • model: string or null

被评测的模型,如适用。

  • name: string or null

评测运行名称。

  • object: "eval.run" (default: "eval.run")

对象类型,固定为 "eval.run"。

  • "eval.run"

  • per_model_usage: array of object { cached_tokens, completion_tokens, invocation_count, 3 more } or null

评测运行期间各模型的用量统计。

  • cached_tokens: integer

从缓存读取的词元数。

  • completion_tokens: integer

生成的补全词元数。

  • invocation_count: integer

调用次数。

  • model_name: string

模型名称。

  • prompt_tokens: integer

使用的提示词词元数。

  • total_tokens: integer

使用的总词元数。

  • per_testing_criteria_results: array of object { failed, passed, testing_criteria } or null

评测运行中各测试标准的结果。

  • failed: integer

未通过此标准的测试数量。

  • passed: integer

通过此标准的测试数量。

  • testing_criteria: string

测试标准的描述。

  • report_url: string

在控制台界面中呈现评测运行报告的 URL。

format: uri

  • result_counts: object { errored, failed, passed, total }

汇总评测运行结果的计数器。

  • errored: integer

因错误而失败的输出条目数量。

  • failed: integer

未通过评测的输出条目数量。

  • passed: integer

通过评测的输出条目数量。

  • total: integer

已执行的输出条目总数。

  • status: string

评测运行状态。

运行删除响应

  • RunDeleteResponse object { deleted, object, run_id }

  • deleted: optional boolean

  • object: optional string

  • run_id: optional string

运行列表响应

  • RunListResponse object { id, created_at, data_source, 11 more }

表示评测运行的模式。

  • id: string

评测运行的唯一标识。

  • created_at: integer

评测运行创建时的 Unix 时间戳,单位为秒。

format: unixtime

  • data_source: CreateEvalJSONLRunDataSource or CreateEvalCompletionsRunDataSource or ResponsesRunDataSource { source, type, input_messages, 2 more }

本次运行的数据源信息。

  • CreateEvalJSONLRunDataSource object { source, type }

JsonlRunDataSource 对象,指定与该评测匹配的 JSONL 文件。

  • source: EvalJSONLFileContentSource { content, type } or EvalJSONLFileIDSource { id, type }

决定数据源中 item 命名空间的内容。

  • EvalJSONLFileContentSource object { content, type }

  • content: array of object { item, sample }

JSONL 文件的内容。

  • item: map[unknown]

  • sample: optional map[unknown]

  • type: "file_content" (default: "file_content")

JSONL 来源的类型,固定为 file_content。

  • "file_content"

  • EvalJSONLFileIDSource object { id, type }

  • id: string

文件标识。

  • type: "file_id" (default: "file_id")

JSONL 来源的类型,固定为 file_id。

  • "file_id"

  • type: "jsonl" (default: "jsonl")

数据源类型,固定为 jsonl。

  • "jsonl"

  • CreateEvalCompletionsRunDataSource object { source, type, input_messages, 2 more }

描述模型采样配置的 CompletionsRunDataSource 对象。

  • source: EvalJSONLFileContentSource { content, type } or EvalJSONLFileIDSource { id, type } or StoredCompletionsRunDataSource { type, created_after, created_before, 3 more }

决定本次运行数据源中 item 命名空间的内容。

  • EvalJSONLFileContentSource object { content, type }

  • content: array of object { item, sample }

JSONL 文件的内容。

  • item: map[unknown]

  • sample: optional map[unknown]

  • type: "file_content" (default: "file_content")

JSONL 来源的类型,固定为 file_content。

  • "file_content"

  • EvalJSONLFileIDSource object { id, type }

  • id: string

文件标识。

  • type: "file_id" (default: "file_id")

JSONL 来源的类型,固定为 file_id。

  • "file_id"

  • StoredCompletionsRunDataSource object { type, created_after, created_before, 3 more }

描述一组筛选条件的 StoredCompletionsRunDataSource 配置。

  • type: "stored_completions" (default: "stored_completions")

来源类型,固定为 stored_completions。

  • "stored_completions"

  • created_after: optional integer or null

可选的 Unix 时间戳,用于筛选在此时间之后创建的条目。

  • created_before: optional integer or null

可选的 Unix 时间戳,用于筛选在此时间之前创建的条目。

  • limit: optional integer or null

可选的返回条目数量上限。

  • metadata: optional Metadata or null

可附加到对象的元数据,最多包含 16 组键值对,可 以结构化方式存储对象的额外信息, 并通过 API 或控制台查询对象。

键为最多 64 个字符的字符串,值为 最多 512 个字符的字符串。

  • model: optional string or null

可选的模型筛选条件,例如 'gpt-6-astra'。

  • type: "completions" (default: "completions")

运行数据源类型,固定为 completions。

  • "completions"

  • input_messages: optional TemplateInputMessages { template, type } or ItemReferenceInputMessages { item_reference, type }

从模型采样时使用,规定传给模型的消息结构。可以引用预先构建的轨迹,例如 item.input_trajectory,也可以使用包含 item 命名空间变量引用的模板。

  • TemplateInputMessages object { template, type }

  • template: array of EasyInputMessage or EvalMessageObject { content, role, type }

构成提示词或上下文的聊天消息列表,可以包含对 item 命名空间的变量引用,例如 {{item.name}}。

  • EasyInputMessage object { content, role, phase, type }

输入模型的消息,其角色表示指令遵循的 优先级。以 developer 或 system 角色给出的指令 优先于 user 角色给出的指令。 assistant 角色的消息被视为模型在此前 交互中生成的内容。

  • content: string or ResponseInputMessageContentList

用于生成响应的文本、图像或音频输入。 也可以包含此前的助手响应。

  • TextInput = string

输入模型的文本。

  • ResponseInputMessageContentList = array of ResponseInputContent

输入模型的一个或多个条目的列表,可以包含不同 内容类型。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • text: string

输入模型的文本。

  • type: "input_text" (default: "input_text")

输入条目类型,固定为 input_text。

  • "input_text"

  • prompt_cache_breakpoint: optional object { mode, ttl }

标记可复用提示词前缀的精确结束位置。省略 ttl 时,断点继承请求中的 prompt_cache_options.ttl;该边界不会按词元块取整。

  • mode: "explicit" (default: "explicit")

断点模式,固定为 explicit。

  • "explicit"

  • ttl: optional "30m" or "12h"

此缓存断点的最短存续时间,默认为请求的 TTL。

  • "30m"

  • "12h"

  • ResponseInputImage object { detail, type, file_id, 2 more }

输入模型的图像。参阅图像输入。

  • detail: ImageDetail

发送给模型的图像细节级别,可选 high、low、auto 或 original,默认为 auto。

  • "low"

  • "high"

  • "auto"

  • "original"

  • type: "input_image" (default: "input_image")

输入条目类型,固定为 input_image。

  • "input_image"

  • file_id: optional string or null

要发送给模型的文件 ID。

  • image_url: optional string or null

要发送给模型的图像 URL,可以是完整 URL,或包含 Base64 编码图像的 data URL。

format: uri

  • prompt_cache_breakpoint: optional object { mode, ttl }

标记可复用提示词前缀的精确结束位置。省略 ttl 时,断点继承请求中的 prompt_cache_options.ttl;该边界不会按词元块取整。

  • mode: "explicit" (default: "explicit")

断点模式,固定为 explicit。

  • "explicit"

  • ttl: optional "30m" or "12h"

此缓存断点的最短存续时间,默认为请求的 TTL。

  • "30m"

  • "12h"

  • ResponseInputFile object { type, detail, file_data, 4 more }

输入模型的文件。

  • type: "input_file" (default: "input_file")

输入条目类型,固定为 input_file。

  • "input_file"

  • detail: optional "auto" or "low" or "high"

发送给模型的文件细节级别。使用 auto 由系统选择;对于 GPT-5.6 及后续模型,auto 使用高质量渲染,可能增加输入词元用量。使用 low 进行成本较低的渲染,或使用 high 以更高质量渲染文件。默认为 auto。

  • "auto"

  • "low"

  • "high"

  • file_data: optional string

要发送给模型的文件内容。

  • file_id: optional string or null

要发送给模型的文件 ID。

  • file_url: optional string

要发送给模型的文件 URL。

format: uri

  • filename: optional string

要发送给模型的文件名。

  • prompt_cache_breakpoint: optional object { mode, ttl }

标记可复用提示词前缀的精确结束位置。省略 ttl 时,断点继承请求中的 prompt_cache_options.ttl;该边界不会按词元块取整。

  • mode: "explicit" (default: "explicit")

断点模式,固定为 explicit。

  • "explicit"

  • ttl: optional "30m" or "12h"

此缓存断点的最短存续时间,默认为请求的 TTL。

  • "30m"

  • "12h"

  • role: "user" or "assistant" or "system" or "developer"

输入消息的角色,可选 user、assistant、system 或 developer.

  • "user"

  • "assistant"

  • "system"

  • "developer"

  • phase: optional "commentary" or "final_answer" or null

将 assistant 消息标记为中间说明(commentary)或最终答案(final_answer)。 对于 gpt-5.3-codex 及后续此类模型,发送后续请求时,须保留并重新发送 所有助手消息的 phase;丢弃它可能降低表现。用户消息不使用此字段。

  • "commentary"

  • "final_answer"

  • type: optional "message"

输入消息类型,固定为 message。

  • "message"

  • EvalMessageObject object { content, role, type }

输入模型的消息,其角色表示指令遵循的 优先级。以 developer 或 system 角色给出的指令 优先于 user 角色给出的指令。 assistant 角色的消息被视为模型在此前 交互中生成的内容。

  • content: string or ResponseInputText or OutputText { text, type } or 3 more

模型输入,可以包含模板字符串。支持输入文本、输出文本、输入图像和输入音频,可提供单个条目或条目数组。

  • TextInput = string

输入模型的文本。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • OutputText object { text, type }

模型输出的文本。

  • text: string

模型输出的文本内容。

  • type: "output_text"

输出文本类型,固定为 output_text。

  • "output_text"

  • InputImage object { image_url, type, detail }

用于 EvalItem 内容数组中的图像输入块。

  • image_url: string

输入图像的 URL。

format: uri

  • type: "input_image"

输入图像类型,固定为 input_image。

  • "input_image"

  • detail: optional string

发送给模型的图像细节级别,可选 high、low 或 auto,默认为 auto。

  • ResponseInputAudio object { input_audio, type }

输入模型的音频。

  • input_audio: object { data, format }

  • data: string

采用 Base64 编码的音频数据。

  • format: "mp3" or "wav"

音频数据格式,当前支持 mp3 和 wav.

  • "mp3"

  • "wav"

  • type: "input_audio"

输入条目类型,固定为 input_audio。

  • "input_audio"

  • GraderInputs = array of string or ResponseInputText or OutputText { text, type } or 2 more

输入列表,每项可以是输入文本、输出文本、输入 图像或输入音频对象。

  • TextInput = string

输入模型的文本。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • OutputText object { text, type }

模型输出的文本。

  • text: string

模型输出的文本内容。

  • type: "output_text"

输出文本类型,固定为 output_text。

  • "output_text"

  • InputImage object { image_url, type, detail }

用于 EvalItem 内容数组中的图像输入块。

  • image_url: string

输入图像的 URL。

format: uri

  • type: "input_image"

输入图像类型,固定为 input_image。

  • "input_image"

  • detail: optional string

发送给模型的图像细节级别,可选 high、low 或 auto,默认为 auto。

  • ResponseInputAudio object { input_audio, type }

输入模型的音频。

  • role: "user" or "assistant" or "system" or "developer"

输入消息的角色,可选 user、assistant、system 或 developer.

  • "user"

  • "assistant"

  • "system"

  • "developer"

  • type: optional "message"

输入消息类型,固定为 message。

  • "message"

  • type: "template"

输入消息类型,固定为 template。

  • "template"

  • ItemReferenceInputMessages object { item_reference, type }

  • item_reference: string

对 item 命名空间中变量的引用,例如 "item.input_trajectory"。

  • type: "item_reference"

输入消息类型,固定为 item_reference。

  • "item_reference"

  • model: optional string

用于生成补全内容的模型名称,例如 "o3-mini"。

  • sampling_params: optional object { max_completion_tokens, reasoning_effort, response_format, 4 more }

  • max_completion_tokens: optional integer

生成输出的最大词元数。

  • reasoning_effort: optional ReasoningEffort or null (default: "medium")

限制推理模型的推理强度。当前支持 none、minimal、low、medium、high、xhigh 和 max。 降低推理强度可能加快响应,并减少响应中用于 推理的词元数。并非所有推理模型都支持每个 取值。各模型的支持情况请参阅 推理指南 中的说明。

  • "none"

  • "minimal"

  • "low"

  • "medium"

  • "high"

  • "xhigh"

  • "max"

  • response_format: optional ResponseFormatText or ResponseFormatJSONSchema or ResponseFormatJSONObject

指定模型必须输出的格式的对象。

设为 { "type": "json_schema", "json_schema": {...} } 会启用 结构化输出,确保模型遵循你提供的 JSON 模式。更多信息请参阅结构化输出 指南。

设为 { "type": "json_object" } 会启用旧版 JSON 模式, 确保模型生成有效的 JSON。对于支持的模型,优先使用 json_schema 格式。

  • ResponseFormatText object { type }

默认响应格式,用于生成文本响应。

  • type: "text"

定义的响应格式类型,固定为 text。

  • "text"

  • ResponseFormatJSONSchema object { json_schema, type }

JSON Schema 响应格式,用于生成结构化 JSON 响应。 参阅结构化输出。

  • json_schema: object { name, description, schema, strict }

结构化输出配置选项,包含 JSON Schema。

  • name: string

响应格式的名称,须使用 a-z、A-Z、0-9,或包含 下划线和连字符,最长为 64 个字符。

  • description: optional string

响应格式的用途描述,模型据此 判断如何按该格式响应。

  • schema: optional map[unknown]

以 JSON Schema 对象描述的响应格式模式。 JSON Schema 的构建方法参阅此处。

  • strict: optional boolean or null (default: false)

生成输出时是否启用严格模式遵循。 设为 true 时,模型始终严格遵循 schema 字段中定义的模式。strict 为 true 时仅支持 JSON Schema 的子集。更多信息请参阅结构化输出 指南。

  • type: "json_schema"

定义的响应格式类型,固定为 json_schema。

  • "json_schema"

  • ResponseFormatJSONObject object { type }

JSON 对象响应格式,是生成 JSON 响应的较早方式。 对于支持的模型,建议使用 json_schema。注意: 须在系统消息或用户消息中指示模型生成 JSON, 模型才会生成 JSON。

  • type: "json_object"

定义的响应格式类型,固定为 json_object。

  • "json_object"

  • seed: optional integer (default: 42)

采样时用于初始化随机性的种子值。

  • temperature: optional number (default: 1)

较高的 temperature 会增加输出的随机性。

  • tools: optional array of ChatCompletionFunctionTool

模型可以调用的工具列表。目前工具仅支持函数。通过此项提供模型可为其生成 JSON 输入的函数列表,最多支持 128 个函数。

  • function: FunctionDefinition

  • name: string

要调用的函数名称,须使用 a-z、A-Z、0-9,或包含下划线和连字符,最长为 64 个字符。

  • description: optional string

函数功能的描述,模型据此选择何时以及如何调用该函数。

  • parameters: optional FunctionParameters

函数接受的参数,以 JSON Schema 对象描述。示例参阅指南,格式说明参阅 JSON Schema 参考。

省略 parameters 表示定义参数列表为空的函数。

  • strict: optional boolean or null (default: false)

生成函数调用时是否启用严格模式遵循。设为 true 时,模型严格遵循 parameters 字段中定义的模式。strict 为 true 时仅支持 JSON Schema 的子集。结构化输出的更多信息参阅函数调用指南。

  • type: "function"

工具类型,目前仅支持 function。

  • "function"

  • top_p: optional number (default: 1)

用于核采样的参数,是 temperature 的替代方案;1.0 表示包含所有词元。

  • ResponsesRunDataSource object { source, type, input_messages, 2 more }

描述模型采样配置的 ResponsesRunDataSource 对象。

  • source: EvalJSONLFileContentSource { content, type } or EvalJSONLFileIDSource { id, type } or EvalResponsesSource { type, created_after, created_before, 8 more }

决定本次运行数据源中 item 命名空间的内容。

  • EvalJSONLFileContentSource object { content, type }

  • content: array of object { item, sample }

JSONL 文件的内容。

  • item: map[unknown]

  • sample: optional map[unknown]

  • type: "file_content" (default: "file_content")

JSONL 来源的类型,固定为 file_content。

  • "file_content"

  • EvalJSONLFileIDSource object { id, type }

  • id: string

文件标识。

  • type: "file_id" (default: "file_id")

JSONL 来源的类型,固定为 file_id。

  • "file_id"

  • EvalResponsesSource object { type, created_after, created_before, 8 more }

描述运行数据源配置的 EvalResponsesSource 对象。

  • type: "responses"

运行数据源类型,固定为 responses。

  • "responses"

  • created_after: optional integer or null

仅包含在此时间戳之后创建的条目,含边界。此查询参数用于选择响应。

minimum: 0

  • created_before: optional integer or null

仅包含在此时间戳之前创建的条目,含边界。此查询参数用于选择响应。

minimum: 0

  • instructions_search: optional string or null

可选的字符串,用于搜索 'instructions' 字段。此查询参数用于选择响应。

  • metadata: optional unknown or null

响应的元数据筛选条件。此查询参数用于选择响应。

  • model: optional string or null

要查找其响应的模型名称。此查询参数用于选择响应。

  • reasoning_effort: optional ReasoningEffort or null (default: "medium")

限制推理模型的推理强度。当前支持 none、minimal、low、medium、high、xhigh 和 max。 降低推理强度可能加快响应,并减少响应中用于 推理的词元数。并非所有推理模型都支持每个 取值。各模型的支持情况请参阅 推理指南 中的说明。

  • temperature: optional number or null

采样温度。此查询参数用于选择响应。

  • tools: optional array of string or null

工具名称列表。此查询参数用于选择响应。

  • top_p: optional number or null

核采样参数。此查询参数用于选择响应。

  • users: optional array of string or null

用户标识列表。此查询参数用于选择响应。

  • type: "responses" (default: "responses")

运行数据源类型,固定为 responses。

  • "responses"

  • input_messages: optional InputMessagesTemplate { template, type } or InputMessagesItemReference { item_reference, type }

从模型采样时使用,规定传给模型的消息结构。可以引用预先构建的轨迹,例如 item.input_trajectory,也可以使用包含 item 命名空间变量引用的模板。

  • InputMessagesTemplate object { template, type }

  • template: array of ChatMessage { content, role } or EvalMessageObject { content, role, type }

构成提示词或上下文的聊天消息列表,可以包含对 item 命名空间的变量引用,例如 {{item.name}}。

  • ChatMessage object { content, role }

  • content: string

消息内容。

  • role: string

消息角色,例如 "system"、"assistant"、"user"。

  • EvalMessageObject object { content, role, type }

输入模型的消息,其角色表示指令遵循的 优先级。以 developer 或 system 角色给出的指令 优先于 user 角色给出的指令。 assistant 角色的消息被视为模型在此前 交互中生成的内容。

  • content: string or ResponseInputText or OutputText { text, type } or 3 more

模型输入,可以包含模板字符串。支持输入文本、输出文本、输入图像和输入音频,可提供单个条目或条目数组。

  • TextInput = string

输入模型的文本。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • OutputText object { text, type }

模型输出的文本。

  • text: string

模型输出的文本内容。

  • type: "output_text"

输出文本类型,固定为 output_text。

  • "output_text"

  • InputImage object { image_url, type, detail }

用于 EvalItem 内容数组中的图像输入块。

  • image_url: string

输入图像的 URL。

format: uri

  • type: "input_image"

输入图像类型,固定为 input_image。

  • "input_image"

  • detail: optional string

发送给模型的图像细节级别,可选 high、low 或 auto,默认为 auto。

  • ResponseInputAudio object { input_audio, type }

输入模型的音频。

  • GraderInputs = array of string or ResponseInputText or OutputText { text, type } or 2 more

输入列表,每项可以是输入文本、输出文本、输入 图像或输入音频对象。

  • role: "user" or "assistant" or "system" or "developer"

输入消息的角色,可选 user、assistant、system 或 developer.

  • "user"

  • "assistant"

  • "system"

  • "developer"

  • type: optional "message"

输入消息类型,固定为 message。

  • "message"

  • type: "template"

输入消息类型,固定为 template。

  • "template"

  • InputMessagesItemReference object { item_reference, type }

  • item_reference: string

对 item 命名空间中变量的引用,例如 "item.name"。

  • type: "item_reference"

输入消息类型,固定为 item_reference。

  • "item_reference"

  • model: optional string

用于生成补全内容的模型名称,例如 "o3-mini"。

  • sampling_params: optional object { max_completion_tokens, reasoning_effort, seed, 4 more }

  • max_completion_tokens: optional integer

生成输出的最大词元数。

  • reasoning_effort: optional ReasoningEffort or null (default: "medium")

限制推理模型的推理强度。当前支持 none、minimal、low、medium、high、xhigh 和 max。 降低推理强度可能加快响应,并减少响应中用于 推理的词元数。并非所有推理模型都支持每个 取值。各模型的支持情况请参阅 推理指南 中的说明。

  • seed: optional integer (default: 42)

采样时用于初始化随机性的种子值。

  • temperature: optional number (default: 1)

较高的 temperature 会增加输出的随机性。

  • text: optional object { format }

模型文本响应的配置选项,可以是纯 文本或结构化 JSON 数据。更多信息:

  • format: optional ResponseFormatTextConfig

指定模型必须输出的格式的对象。

配置 { "type": "json_schema" } 会启用结构化输出, 确保模型遵循你提供的 JSON Schema。更多信息参阅 结构化输出指南。

默认格式为 { "type": "text" },没有额外选项。

不建议用于 gpt-4o 及后续模型:

设为 { "type": "json_object" } 会启用旧版 JSON 模式, 确保模型生成有效的 JSON。对于支持的模型,优先使用 json_schema 格式。

  • ResponseFormatText object { type }

默认响应格式,用于生成文本响应。

  • ResponseFormatTextJSONSchemaConfig object { name, schema, type, 2 more }

JSON Schema 响应格式,用于生成结构化 JSON 响应。 参阅结构化输出。

  • name: string

响应格式的名称,须使用 a-z、A-Z、0-9,或包含 下划线和连字符,最长为 64 个字符。

  • schema: map[unknown]

以 JSON Schema 对象描述的响应格式模式。 JSON Schema 的构建方法参阅此处。

  • type: "json_schema"

定义的响应格式类型,固定为 json_schema。

  • "json_schema"

  • description: optional string

响应格式的用途描述,模型据此 判断如何按该格式响应。

  • strict: optional boolean or null (default: false)

生成输出时是否启用严格模式遵循。 设为 true 时,模型始终严格遵循 schema 字段中定义的模式。strict 为 true 时仅支持 JSON Schema 的子集。更多信息请参阅结构化输出 指南。

  • ResponseFormatJSONObject object { type }

JSON 对象响应格式,是生成 JSON 响应的较早方式。 对于支持的模型,建议使用 json_schema。注意: 须在系统消息或用户消息中指示模型生成 JSON, 模型才会生成 JSON。

  • tools: optional array of Function { name, parameters, strict, 6 more } or FileSearch { type, vector_store_ids, filters, 2 more } or Computer { type } or 13 more

模型生成响应时可以调用的工具数组。你 可以通过 tool_choice 参数指定要使用的工具。

可向模型提供以下两类工具:

  • 内置工具:由 OpenAI 提供,用于扩展 模型能力,例如网页搜索 或文件搜索。更多信息参阅 内置工具。
  • 函数调用(自定义工具):由你定义的函数, 使模型可以调用你自己的代码。更多信息参阅 函数调用。

  • Function object { name, parameters, strict, 6 more }

定义模型可以选择调用的自有代码函数。参阅函数调用。

  • name: string

要调用的函数名称。

  • parameters: map[unknown] or null

描述函数参数的 JSON Schema 对象。

  • strict: boolean or null

是否对此函数工具强制执行严格参数校验。

  • type: "function" (default: "function")

函数工具类型,固定为 function。

  • "function"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

  • "direct"

  • "programmatic"

  • async: optional boolean

  • defer_loading: optional boolean

此函数是否延迟加载并通过工具搜索加载。

  • description: optional string or null

函数描述,模型据此判断是否调用该函数。

  • output_schema: optional map[unknown] or null

描述此函数字符串输出中编码的 JSON 值的 JSON Schema 对象。

  • FileSearch object { type, vector_store_ids, filters, 2 more }

搜索已上传文件中相关内容的工具。参阅文件搜索工具。

  • type: "file_search" (default: "file_search")

文件搜索工具类型,固定为 file_search。

  • "file_search"

  • vector_store_ids: array of string

要搜索的向量存储 ID 列表。

  • filters: optional ComparisonFilter or CompoundFilter or null

要应用的筛选条件。

  • ComparisonFilter object { key, type, value }

使用指定比较运算,将某个属性键与给定值比较的筛选条件。

  • key: string

要与值比较的属性键。

  • type: "eq" or "ne" or "gt" or 5 more (default: "eq")

指定比较运算符:eq、ne、gt、gte、lt、lte、in、nin。

  • eq:等于
  • ne:不等于
  • gt:大于
  • gte:大于或等于
  • lt:小于
  • lte:小于或等于
  • in:属于
  • nin:不属于

  • "eq"

  • "ne"

  • "gt"

  • "gte"

  • "lt"

  • "lte"

  • "in"

  • "nin"

  • value: string or number or boolean or array of string or number

用于与属性键比较的值,支持字符串、数字或布尔类型。

  • string

  • number

  • boolean

  • array of string or number

  • string

  • number

  • CompoundFilter object { filters, type }

使用 and 或 or 组合多个筛选条件。

  • filters: array of ComparisonFilter or CompoundFilter

要组合的筛选条件数组,条目可以是 ComparisonFilter 或 CompoundFilter。

  • ComparisonFilter object { key, type, value }

使用指定比较运算,将某个属性键与给定值比较的筛选条件。

  • CompoundFilter object { filters, type }

使用 and 或 or 组合多个筛选条件。

  • type: "and" or "or"

运算类型:and 或 or。

  • "and"

  • "or"

  • max_num_results: optional integer

返回结果数量上限,须介于 1–50 之间,含边界。

  • ranking_options: optional object { hybrid_search, ranker, score_threshold }

搜索结果的排序选项。

  • hybrid_search: optional object { embedding_weight, text_weight }

启用混合搜索时,控制倒数排名融合如何平衡语义嵌入匹配与稀疏关键词匹配的权重。

  • embedding_weight: number

嵌入在倒数排名融合中的权重。

  • text_weight: number

文本在倒数排名融合中的权重。

  • ranker: optional "auto" or "default-2024-11-15"

文件搜索所用的排序器。

  • "auto"

  • "default-2024-11-15"

  • score_threshold: optional number

文件搜索的分数阈值,为 0–1 之间的数字。越接近 1,越倾向于只返回最相关的结果,但返回数量可能减少。

  • Computer object { type }

控制虚拟计算机的工具。参阅计算机工具。

  • type: "computer" (default: "computer")

计算机工具类型,固定为 computer。

  • "computer"

  • ComputerUsePreview object { display_height, display_width, environment, type }

控制虚拟计算机的工具。参阅计算机工具。

  • display_height: integer

计算机显示区域的高度。

  • display_width: integer

计算机显示区域的宽度。

  • environment: "windows" or "mac" or "linux" or 2 more

要控制的计算机环境类型。

  • "windows"

  • "mac"

  • "linux"

  • "ubuntu"

  • "browser"

  • type: "computer_use_preview" (default: "computer_use_preview")

计算机使用工具类型,固定为 computer_use_preview。

  • "computer_use_preview"

  • WebSearch object { type, external_web_access, filters, 2 more }

在互联网上搜索与提示词相关的信息来源。参阅 网络搜索工具时。

  • type: "web_search" or "web_search_2025_08_26" (default: "web_search")

网页搜索工具类型,可选 web_search 或 web_search_2025_08_26。

  • "web_search"

  • "web_search_2025_08_26"

  • external_web_access: optional boolean (default: true)

是否允许网页搜索实时访问互联网。省略时默认为 true。设为 false 时,网页搜索工具以离线或仅缓存模式运行,不会抓取新的外部内容。

  • filters: optional object { allowed_domains } or null

搜索的筛选条件。

  • allowed_domains: optional array of string or null (default: [])

搜索允许的域名。未提供时允许所有域名。 也允许访问所提供域名的子域名。

示例:["pubmed.ncbi.nlm.nih.gov"]

  • search_context_size: optional "low" or "medium" or "high" (default: "medium")

对搜索占用上下文窗口空间大小的总体指导,可选 low、medium 或 high,默认为 medium。

  • "low"

  • "medium"

  • "high"

  • user_location: optional object { city, country, region, 2 more } or null

用户的大致位置。省略或设为 null 时,默认为 美国。若要避免此默认值,可传入不包含位置字段的 {"type": "approximate"}。 若要本地化结果,须提供相应位置字段。

  • city: optional string or null

用户所在城市的自由文本,例如 San Francisco。

  • country: optional string or null

用户所在国家/地区的两字母 ISO 代码,例如 US。

  • region: optional string or null

用户所在地区的自由文本,例如 California。

  • timezone: optional string or null

用户所在的 IANA 时区,例如 America/Los_Angeles。

  • type: optional "approximate" (default: "approximate")

位置估算类型,固定为 approximate。

  • "approximate"

  • Mcp object { server_label, type, allowed_callers, 9 more }

通过远程模型上下文协议(MCP)服务器, 向模型提供额外工具。了解 MCP。

  • server_label: string

此 MCP 服务器的标签,用于在工具调用中标识服务器。

  • type: "mcp"

MCP 工具类型,固定为 mcp。

  • "mcp"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • allowed_tools: optional array of string or McpToolFilter { read_only, tool_names } or null

允许的工具名称列表或筛选对象。

  • McpAllowedTools = array of string

允许的工具名称组成的字符串数组。

  • McpToolFilter object { read_only, tool_names }

用于指定允许哪些工具的筛选对象。

  • read_only: optional boolean

表示工具会修改数据还是只读。如果 MCP 服务器标注了 readOnlyHint, 就会与此筛选条件匹配。

  • tool_names: optional array of string

允许的工具名称列表。

  • authorization: optional string

可用于远程 MCP 服务器的 OAuth 访问令牌,既可 配合自定义 MCP 服务器 URL,也可配合服务连接器。你的应用 须处理 OAuth 授权流程,并在此提供令牌。

  • connector_id: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 5 more

服务连接器的标识,例如 ChatGPT 中提供的连接器。须提供 server_url、connector_id 或 tunnel_id 中的一项。更多 服务连接器信息参阅此处。

对于 2026 年 9 月 1 日之后发布的模型,此字段已弃用。 使用 server_url 连接远程 MCP 服务器,或使用 tunnel_id 通过安全 MCP 隧道连接。

当前支持的 connector_id 值如下:

  • Dropbox:connector_dropbox
  • Gmail:connector_gmail
  • Google 日历:connector_googlecalendar
  • Google 云端硬盘:connector_googledrive
  • Microsoft Teams:connector_microsoftteams
  • Outlook 日历:connector_outlookcalendar
  • Outlook 邮箱:connector_outlookemail
  • SharePoint:connector_sharepoint

  • "connector_dropbox"

  • "connector_gmail"

  • "connector_googlecalendar"

  • "connector_googledrive"

  • "connector_microsoftteams"

  • "connector_outlookcalendar"

  • "connector_outlookemail"

  • "connector_sharepoint"

  • defer_loading: optional boolean

此 MCP 工具是否延迟加载并通过工具搜索发现。

  • headers: optional map[string] or null

可选的发送给 MCP 服务器的 HTTP 请求头,用于认证 或其他用途。

  • require_approval: optional McpToolApprovalFilter { always, never } or "always" or "never" or null (default: "always")

指定 MCP 服务器的哪些工具需要批准。

  • McpToolApprovalFilter object { always, never }

指定 MCP 服务器的哪些工具需要批准。可以是 always、never,或与需要批准的工具关联的 筛选对象。

  • always: optional object { read_only, tool_names }

用于指定允许哪些工具的筛选对象。

  • read_only: optional boolean

表示工具会修改数据还是只读。如果 MCP 服务器标注了 readOnlyHint, 就会与此筛选条件匹配。

  • tool_names: optional array of string

允许的工具名称列表。

  • never: optional object { read_only, tool_names }

用于指定允许哪些工具的筛选对象。

  • read_only: optional boolean

表示工具会修改数据还是只读。如果 MCP 服务器标注了 readOnlyHint, 就会与此筛选条件匹配。

  • tool_names: optional array of string

允许的工具名称列表。

  • McpToolApprovalSetting = "always" or "never"

为所有工具指定统一的批准策略,可选 always 或 never。设为 always 时,所有工具均需要批准; 设为 never 时,所有工具均不需要批准。

  • "always"

  • "never"

  • server_description: optional string

MCP 服务器的可选描述,用于提供更多上下文。

  • server_url: optional string

MCP 服务器的 URL。须提供 server_url、connector_id 或 tunnel_id 中的一项。

format: uri

  • tunnel_id: optional string

用来替代直接服务器 URL 的安全 MCP 隧道 ID。须提供 server_url、connector_id 或 tunnel_id 中的一项。

pattern: ^tunnel_[a-z0-9]{32}$

  • CodeInterpreter object { container, type, allowed_callers }

运行 Python 代码以帮助生成提示词响应的工具。

  • container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }

代码解释器容器,可以是容器 ID,也可以是 指定代码可用的已上传文件 ID 的对象,同时可提供 可选的 memory_limit 设置。

  • string

容器 ID。

  • CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }

代码解释器容器配置,可以指定运行代码时所处理的文件 ID。

  • type: "auto" (default: "auto")

固定为 auto。

  • "auto"

  • file_ids: optional array of string

可选的已上传文件列表,这些文件将提供给代码使用。

maxItems: 50

  • memory_limit: optional "1g" or "4g" or "16g" or "64g" or null

代码解释器容器的内存上限。

  • "1g"

  • "4g"

  • "16g"

  • "64g"

  • network_policy: optional ContainerNetworkPolicyDisabled or ContainerNetworkPolicyAllowlist

容器的网络访问策略。

  • ContainerNetworkPolicyDisabled object { type }

  • type: "disabled" (default: "disabled")

禁用出站网络访问,固定为 disabled。

  • "disabled"

  • ContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }

  • allowed_domains: array of string

type 为 allowlist 时允许访问的域名列表。

minItems: 1

  • type: "allowlist" (default: "allowlist")

仅允许对指定域名发起出站网络访问,固定为 allowlist。

  • "allowlist"

  • domain_secrets: optional array of ContainerNetworkPolicyDomainSecret

可选的仅用于允许访问域名的域名级密钥。

minItems: 1

  • domain: string

密钥关联的域名。

minLength: 1

  • name: string

要为该域名注入的密钥名称。

minLength: 1

  • value: string

要为该域名注入的密钥值。

minLength: 1, maxLength: 10485760

  • type: "code_interpreter"

代码解释器工具类型,固定为 code_interpreter。

  • "code_interpreter"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • ProgrammaticToolCalling object { type }

  • type: "programmatic_tool_calling" (default: "programmatic_tool_calling")

工具类型,固定为 programmatic_tool_calling。

  • "programmatic_tool_calling"

  • ImageGeneration object { type, action, background, 13 more }

使用 GPT 图像模型生成图像的工具。

  • type: "image_generation"

图像生成工具类型,固定为 image_generation。

  • "image_generation"

  • action: optional "generate" or "edit" or "auto"

生成新图像还是编辑已有图像,默认为 auto。

  • "generate"

  • "edit"

  • "auto"

  • background: optional "transparent" or "opaque" or "auto" (default: "auto")

生成图像的背景,可选 transparent、opaque, 或 auto。gpt-image-2.5-sunburst 和 gpt-image-2.5-flare,包括 对应的 2026-09-08 快照,支持 opaque 和 transparent 背景。受支持的 GPT Image 模型可以使用透明 背景。对于 gpt-image-2 和 gpt-image-2-2026-04-21,此功能处于 预览阶段。使用 transparent 时,须将输出格式设为 png 或 webp。 默认为 auto。

  • "transparent"

  • "opaque"

  • "auto"

  • complexity: optional "low" or "medium" or "high"

用于规划图像的计算投入,与渲染质量分开设置。 覆盖外层响应用于图像生成的 reasoning.effort。 省略时,继承外层受支持的推理强度,或使用 图像模型配置的默认值。 对于 SVG 输出,此项控制参考图像,而不是 SVG 生成模型的 推理。

  • "low"

  • "medium"

  • "high"

  • frame_count: optional integer (default: 9)

GIF 帧数,要求 output_format 为 gif,默认为 9。

minimum: 2, maximum: 16

  • frame_duration_ms: optional integer (default: 200)

每个 GIF 帧的时长,单位为毫秒,取整到 10 毫秒。 要求 output_format 为 gif,默认为 200。

minimum: 20, maximum: 2000

  • input_fidelity: optional "high" or "low" or null

控制模型为匹配输入图像风格和特征(尤其是面部特征)投入的程度。gpt-image-1.5 支持 high 和 low,gpt-image-1-mini 仅支持 low。使用 gpt-image-2 时应省略此参数。支持该参数的模型默认为 low。

  • "high"

  • "low"

  • input_image_mask: optional object { file_id, image_url }

可选的局部重绘蒙版,包含 image_url (可选字符串)和 file_id(可选字符串)。

  • file_id: optional string

蒙版图像的文件 ID。

  • image_url: optional string

采用 Base64 编码的蒙版图像。

  • model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-2" or 9 more

用于图像生成的模型,可选 gpt-image-1-mini、 gpt-image-1.5, gpt-image-2, gpt-image-2-2026-04-21、gpt-image-2.5-sunburst、 gpt-image-2.5-sunburst-2026-09-08、gpt-image-2.5-flare、 gpt-image-2.5-flare-2026-09-08, gpt-image-2.6-sunburst, gpt-image-2.6-flare 或 chatgpt-image-latest。默认值: gpt-image-2.6-sunburst.

gpt-image-1 已于 2026 年 10 月 23 日停用,请使用 gpt-image-2.5-sunburst 或 gpt-image-2.5-flare。

  • string

  • "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-2" or 9 more

用于图像生成的模型,可选 gpt-image-1-mini、 gpt-image-1.5, gpt-image-2, gpt-image-2-2026-04-21、gpt-image-2.5-sunburst、 gpt-image-2.5-sunburst-2026-09-08、gpt-image-2.5-flare、 gpt-image-2.5-flare-2026-09-08, gpt-image-2.6-sunburst, gpt-image-2.6-flare 或 chatgpt-image-latest。默认值: gpt-image-2.6-sunburst.

gpt-image-1 已于 2026 年 10 月 23 日停用,请使用 gpt-image-2.5-sunburst 或 gpt-image-2.5-flare。

  • "gpt-image-1"

  • "gpt-image-1-mini"

  • "gpt-image-2"

  • "gpt-image-2-2026-04-21"

  • "gpt-image-2.5-sunburst"

  • "gpt-image-2.5-sunburst-2026-09-08"

  • "gpt-image-2.5-flare"

  • "gpt-image-2.5-flare-2026-09-08"

  • "gpt-image-2.6-sunburst"

  • "gpt-image-2.6-flare"

  • "gpt-image-1.5"

  • "chatgpt-image-latest"

  • moderation: optional "auto" or "low" (default: "auto")

生成图像的审核级别,默认为 auto。

  • "auto"

  • "low"

  • output_compression: optional integer (default: 100)

输出图像的压缩级别,默认为 100。

minimum: 0, maximum: 100

  • output_format: optional "png" or "webp" or "jpeg" or 2 more (default: "png")

输出图像格式,可选 png、webp、jpeg、 gif 或 svg,默认为 png。GIF 和 SVG 输出要求模型 支持所选格式。GIF 输出不支持 部分图像流式传输,即 partial_images 大于 0, 也不支持 input_image_mask 或自定义 output_compression。 GIF 输出仍可以流式发送 Responses 生命周期事件。

  • "png"

  • "webp"

  • "jpeg"

  • "gif"

  • "svg"

  • partial_images: optional integer (default: 0)

流式模式中生成的部分图像数量,范围为 0(默认值)到 3。

minimum: 0, maximum: 3

  • quality: optional "low" or "medium" or "high" or 3 more (default: "auto")

生成图像的质量。GPT 图像模型支持 low、 medium 和 high。gpt-image-2.5-sunburst 和 gpt-image-2.5-flare, 包括对应的 2026-09-08 快照,还支持 xhigh 和 max。 默认为 auto。

  • "low"

  • "medium"

  • "high"

  • "xhigh"

  • "max"

  • "auto"

  • size: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "auto" (default: "auto")

生成图像的尺寸。gpt-image-2、gpt-image-2-2026-04-21、gpt-image-2.5-sunburst、gpt-image-2.5-sunburst-2026-09-08、gpt-image-2.5-flare 和 gpt-image-2.5-flare-2026-09-08 支持以 WIDTHxHEIGHT 字符串指定任意分辨率,例如 1536x864。宽和高均须能被 16 整除,宽高比须在 1:3 至 3:1 之间。高于 2560x1440 的分辨率属于实验功能,支持的最高分辨率为 3840x2160。尺寸还须符合模型当前的像素数与边长限制。GPT Image 模型支持标准尺寸 1024x1024、1536x1024 和 1024x1536;允许自动尺寸的模型支持 auto。

  • string

  • "1024x1024" or "1024x1536" or "1536x1024" or "auto"

生成图像的尺寸。gpt-image-2、gpt-image-2-2026-04-21、gpt-image-2.5-sunburst、gpt-image-2.5-sunburst-2026-09-08、gpt-image-2.5-flare 和 gpt-image-2.5-flare-2026-09-08 支持以 WIDTHxHEIGHT 字符串指定任意分辨率,例如 1536x864。宽和高均须能被 16 整除,宽高比须在 1:3 至 3:1 之间。高于 2560x1440 的分辨率属于实验功能,支持的最高分辨率为 3840x2160。尺寸还须符合模型当前的像素数与边长限制。GPT Image 模型支持标准尺寸 1024x1024、1536x1024 和 1024x1536;允许自动尺寸的模型支持 auto。

  • "1024x1024"

  • "1024x1536"

  • "1536x1024"

  • "auto"

  • svg: optional object { model, reasoning }

SVG 生成模型的设置,要求 output_format 为 svg。 启用 SVG 模型选择时,省略此对象会使用 外层响应模型。否则使用默认 SVG 生成模型,且 不能显式覆盖模型。

  • model: optional string

minLength: 1

  • reasoning: optional object { effort } or null

SVG 编写的推理强度。省略时,Images 和 Responses 均使用编写模型的默认值。

  • effort: optional "none" or "minimal" or "low" or 4 more

控制模型为此次请求投入的推理强度。

  • "none"

  • "minimal"

  • "low"

  • "medium"

  • "high"

  • "xhigh"

  • "max"

  • LocalShell object { type }

允许模型在本地环境执行 shell 命令的工具。

  • type: "local_shell" (default: "local_shell")

本地 shell 工具类型,固定为 local_shell。

  • "local_shell"

  • Shell object { type, allowed_callers, environment }

允许模型执行 shell 命令的工具。

  • type: "shell" (default: "shell")

shell 工具类型,固定为 shell。

  • "shell"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • environment: optional ContainerAuto or LocalEnvironment or ContainerReference or null

  • ContainerAuto object { type, file_ids, memory_limit, 2 more }

  • type: "container_auto" (default: "container_auto")

为此请求自动创建容器。

  • "container_auto"

  • file_ids: optional array of string

可选的已上传文件列表,这些文件将提供给代码使用。

maxItems: 50

  • memory_limit: optional "1g" or "4g" or "16g" or "64g" or null

容器的内存上限。

  • "1g"

  • "4g"

  • "16g"

  • "64g"

  • network_policy: optional ContainerNetworkPolicyDisabled or ContainerNetworkPolicyAllowlist

容器的网络访问策略。

  • ContainerNetworkPolicyDisabled object { type }

  • ContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }

  • skills: optional array of SkillReference or InlineSkill

可选的技能列表,通过 ID 或内联数据引用技能。

maxItems: 200

  • SkillReference object { skill_id, type, version }

  • skill_id: string

引用的技能 ID。

minLength: 1, maxLength: 64

  • type: "skill_reference" (default: "skill_reference")

引用通过 /v1/skills 接口创建的技能。

  • "skill_reference"

  • version: optional string

可选的技能版本。使用正整数或 'latest',省略时使用默认版本。

  • InlineSkill object { description, name, source, type }

  • description: string

技能描述。

  • name: string

技能名称。

  • source: InlineSkillSource

内联技能载荷。

  • data: string

采用 Base64 编码的技能 ZIP 包。

minLength: 1, maxLength: 70254592

  • media_type: "application/zip" (default: "application/zip")

内联技能载荷的媒体类型,必须为 application/zip。

  • "application/zip"

  • type: "base64" (default: "base64")

内联技能来源的类型,必须为 base64。

  • "base64"

  • type: "inline" (default: "inline")

为此请求定义内联技能。

  • "inline"

  • LocalEnvironment object { type, skills }

  • type: "local" (default: "local")

使用本地计算机环境。

  • "local"

  • skills: optional array of LocalSkill

可选的技能列表。

maxItems: 200

  • description: string

技能描述。

  • name: string

技能名称。

  • path: string

包含该技能的目录路径。

  • ContainerReference object { container_id, type }

  • container_id: string

引用的容器 ID。

  • type: "container_reference" (default: "container_reference")

引用通过 /v1/containers 接口创建的容器。

  • "container_reference"

  • Custom object { name, type, allowed_callers, 4 more }

使用指定格式处理输入的自定义工具。参阅自定义工具。

  • name: string

自定义工具的名称,用于在工具调用中标识它。

  • type: "custom" (default: "custom")

自定义工具类型,固定为 custom。

  • "custom"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • async: optional boolean

工具响应是否可以异步返回,而非在下一次创建响应时立即返回。

  • defer_loading: optional boolean

此工具是否应延迟加载并通过工具搜索发现。

  • description: optional string

自定义工具的可选描述,用于提供更多上下文。

  • format: optional CustomToolInputFormat

自定义工具的输入格式,默认为无约束文本。

  • Text object { type }

无约束的自由文本。

  • type: "text" (default: "text")

无约束文本格式,固定为 text。

  • "text"

  • Grammar object { definition, syntax, type }

用户定义的语法。

  • definition: string

语法定义。

  • syntax: "lark" or "regex"

语法定义的语法类型,可选 lark 或 regex。

  • "lark"

  • "regex"

  • type: "grammar" (default: "grammar")

语法格式,固定为 grammar。

  • "grammar"

  • Namespace object { description, name, tools, type }

将函数工具或自定义工具归入共享命名空间。

  • description: string

展示给模型的命名空间描述。

  • name: string

工具调用使用的命名空间名称,例如 crm。

minLength: 1

  • tools: array of Function { name, type, allowed_callers, 6 more } or Custom { name, type, allowed_callers, 4 more }

此命名空间内可用的函数工具或自定义工具。

minItems: 1

  • Function object { name, type, allowed_callers, 6 more }

  • name: string

pattern: ^[a-zA-Z0-9_-]+$, minLength: 1, maxLength: 128

  • type: "function" (default: "function")

  • "function"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • async: optional boolean

工具响应是否可以异步返回,而非在下一次创建响应时立即返回。

  • defer_loading: optional boolean

此函数是否应延迟加载并通过工具搜索发现。

  • description: optional string or null

  • output_schema: optional map[unknown] or null

描述此函数工具字符串输出中编码的 JSON 值的 JSON Schema,不用于描述内容数组输出。

  • parameters: optional unknown or null

  • strict: optional boolean or null

是否强制执行严格参数校验。省略时,模式兼容的情况下 Responses 会尝试严格校验,否则退回非严格校验。

  • Custom object { name, type, allowed_callers, 4 more }

使用指定格式处理输入的自定义工具。参阅自定义工具。

  • name: string

自定义工具的名称,用于在工具调用中标识它。

  • type: "custom" (default: "custom")

自定义工具类型,固定为 custom。

  • "custom"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • async: optional boolean

工具响应是否可以异步返回,而非在下一次创建响应时立即返回。

  • defer_loading: optional boolean

此工具是否应延迟加载并通过工具搜索发现。

  • description: optional string

自定义工具的可选描述,用于提供更多上下文。

  • format: optional CustomToolInputFormat

自定义工具的输入格式,默认为无约束文本。

  • type: "namespace" (default: "namespace")

工具类型,固定为 namespace。

  • "namespace"

  • ToolSearch object { type, description, execution, parameters }

用于延迟加载工具的托管工具搜索或自带工具(BYOT)搜索配置。

  • type: "tool_search" (default: "tool_search")

工具类型,固定为 tool_search。

  • "tool_search"

  • description: optional string or null

客户端执行的工具搜索工具展示给模型的描述。

  • execution: optional "server" or "client"

工具搜索由服务端还是客户端执行。

  • "server"

  • "client"

  • parameters: optional unknown or null

客户端执行的工具搜索工具的参数模式。

  • WebSearchPreview object { type, search_content_types, search_context_size, user_location }

搜索网页以获取可用于响应的相关结果的工具。参阅网页搜索工具。

  • type: "web_search_preview" or "web_search_preview_2025_03_11" (default: "web_search_preview")

网页搜索工具类型,可选 web_search_preview 或 web_search_preview_2025_03_11。

  • "web_search_preview"

  • "web_search_preview_2025_03_11"

  • search_content_types: optional array of "text" or "image"

  • "text"

  • "image"

  • search_context_size: optional "low" or "medium" or "high"

对搜索占用上下文窗口空间大小的总体指导,可选 low、medium 或 high,默认为 medium。

  • "low"

  • "medium"

  • "high"

  • user_location: optional object { type, city, country, 2 more } or null

用户的大致位置。省略或设为 null 时默认为美国。若要避免此默认值,可传入不包含位置字段的 {"type": "approximate"}。若要本地化结果,须提供相应位置字段。

  • type: "approximate" (default: "approximate")

位置估算类型,固定为 approximate。

  • "approximate"

  • city: optional string or null

用户所在城市的自由文本,例如 San Francisco。

  • country: optional string or null

用户所在国家/地区的两字母 ISO 代码,例如 US。

  • region: optional string or null

用户所在地区的自由文本,例如 California。

  • timezone: optional string or null

用户所在的 IANA 时区,例如 America/Los_Angeles。

  • ApplyPatch object { type, allowed_callers }

允许助手使用统一差异格式创建、删除或更新文件。

  • type: "apply_patch" (default: "apply_patch")

工具类型,固定为 apply_patch。

  • "apply_patch"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • top_p: optional number (default: 1)

用于核采样的参数,是 temperature 的替代方案;1.0 表示包含所有词元。

  • error: EvalAPIError or null

表示 Eval API 错误响应的对象。

  • code: string

错误代码。

  • message: string

错误消息。

  • eval_id: string

关联评测的标识。

  • metadata: Metadata or null

可附加到对象的元数据,最多包含 16 组键值对,可 以结构化方式存储对象的额外信息, 并通过 API 或控制台查询对象。

键为最多 64 个字符的字符串,值为 最多 512 个字符的字符串。

  • model: string or null

被评测的模型,如适用。

  • name: string or null

评测运行名称。

  • object: "eval.run" (default: "eval.run")

对象类型,固定为 "eval.run"。

  • "eval.run"

  • per_model_usage: array of object { cached_tokens, completion_tokens, invocation_count, 3 more } or null

评测运行期间各模型的用量统计。

  • cached_tokens: integer

从缓存读取的词元数。

  • completion_tokens: integer

生成的补全词元数。

  • invocation_count: integer

调用次数。

  • model_name: string

模型名称。

  • prompt_tokens: integer

使用的提示词词元数。

  • total_tokens: integer

使用的总词元数。

  • per_testing_criteria_results: array of object { failed, passed, testing_criteria } or null

评测运行中各测试标准的结果。

  • failed: integer

未通过此标准的测试数量。

  • passed: integer

通过此标准的测试数量。

  • testing_criteria: string

测试标准的描述。

  • report_url: string

在控制台界面中呈现评测运行报告的 URL。

format: uri

  • result_counts: object { errored, failed, passed, total }

汇总评测运行结果的计数器。

  • errored: integer

因错误而失败的输出条目数量。

  • failed: integer

未通过评测的输出条目数量。

  • passed: integer

通过评测的输出条目数量。

  • total: integer

已执行的输出条目总数。

  • status: string

评测运行状态。

运行获取响应

  • RunRetrieveResponse object { id, created_at, data_source, 11 more }

表示评测运行的模式。

  • id: string

评测运行的唯一标识。

  • created_at: integer

评测运行创建时的 Unix 时间戳,单位为秒。

format: unixtime

  • data_source: CreateEvalJSONLRunDataSource or CreateEvalCompletionsRunDataSource or ResponsesRunDataSource { source, type, input_messages, 2 more }

本次运行的数据源信息。

  • CreateEvalJSONLRunDataSource object { source, type }

JsonlRunDataSource 对象,指定与该评测匹配的 JSONL 文件。

  • source: EvalJSONLFileContentSource { content, type } or EvalJSONLFileIDSource { id, type }

决定数据源中 item 命名空间的内容。

  • EvalJSONLFileContentSource object { content, type }

  • content: array of object { item, sample }

JSONL 文件的内容。

  • item: map[unknown]

  • sample: optional map[unknown]

  • type: "file_content" (default: "file_content")

JSONL 来源的类型,固定为 file_content。

  • "file_content"

  • EvalJSONLFileIDSource object { id, type }

  • id: string

文件标识。

  • type: "file_id" (default: "file_id")

JSONL 来源的类型,固定为 file_id。

  • "file_id"

  • type: "jsonl" (default: "jsonl")

数据源类型,固定为 jsonl。

  • "jsonl"

  • CreateEvalCompletionsRunDataSource object { source, type, input_messages, 2 more }

描述模型采样配置的 CompletionsRunDataSource 对象。

  • source: EvalJSONLFileContentSource { content, type } or EvalJSONLFileIDSource { id, type } or StoredCompletionsRunDataSource { type, created_after, created_before, 3 more }

决定本次运行数据源中 item 命名空间的内容。

  • EvalJSONLFileContentSource object { content, type }

  • content: array of object { item, sample }

JSONL 文件的内容。

  • item: map[unknown]

  • sample: optional map[unknown]

  • type: "file_content" (default: "file_content")

JSONL 来源的类型,固定为 file_content。

  • "file_content"

  • EvalJSONLFileIDSource object { id, type }

  • id: string

文件标识。

  • type: "file_id" (default: "file_id")

JSONL 来源的类型,固定为 file_id。

  • "file_id"

  • StoredCompletionsRunDataSource object { type, created_after, created_before, 3 more }

描述一组筛选条件的 StoredCompletionsRunDataSource 配置。

  • type: "stored_completions" (default: "stored_completions")

来源类型,固定为 stored_completions。

  • "stored_completions"

  • created_after: optional integer or null

可选的 Unix 时间戳,用于筛选在此时间之后创建的条目。

  • created_before: optional integer or null

可选的 Unix 时间戳,用于筛选在此时间之前创建的条目。

  • limit: optional integer or null

可选的返回条目数量上限。

  • metadata: optional Metadata or null

可附加到对象的元数据,最多包含 16 组键值对,可 以结构化方式存储对象的额外信息, 并通过 API 或控制台查询对象。

键为最多 64 个字符的字符串,值为 最多 512 个字符的字符串。

  • model: optional string or null

可选的模型筛选条件,例如 'gpt-6-astra'。

  • type: "completions" (default: "completions")

运行数据源类型,固定为 completions。

  • "completions"

  • input_messages: optional TemplateInputMessages { template, type } or ItemReferenceInputMessages { item_reference, type }

从模型采样时使用,规定传给模型的消息结构。可以引用预先构建的轨迹,例如 item.input_trajectory,也可以使用包含 item 命名空间变量引用的模板。

  • TemplateInputMessages object { template, type }

  • template: array of EasyInputMessage or EvalMessageObject { content, role, type }

构成提示词或上下文的聊天消息列表,可以包含对 item 命名空间的变量引用,例如 {{item.name}}。

  • EasyInputMessage object { content, role, phase, type }

输入模型的消息,其角色表示指令遵循的 优先级。以 developer 或 system 角色给出的指令 优先于 user 角色给出的指令。 assistant 角色的消息被视为模型在此前 交互中生成的内容。

  • content: string or ResponseInputMessageContentList

用于生成响应的文本、图像或音频输入。 也可以包含此前的助手响应。

  • TextInput = string

输入模型的文本。

  • ResponseInputMessageContentList = array of ResponseInputContent

输入模型的一个或多个条目的列表,可以包含不同 内容类型。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • text: string

输入模型的文本。

  • type: "input_text" (default: "input_text")

输入条目类型,固定为 input_text。

  • "input_text"

  • prompt_cache_breakpoint: optional object { mode, ttl }

标记可复用提示词前缀的精确结束位置。省略 ttl 时,断点继承请求中的 prompt_cache_options.ttl;该边界不会按词元块取整。

  • mode: "explicit" (default: "explicit")

断点模式,固定为 explicit。

  • "explicit"

  • ttl: optional "30m" or "12h"

此缓存断点的最短存续时间,默认为请求的 TTL。

  • "30m"

  • "12h"

  • ResponseInputImage object { detail, type, file_id, 2 more }

输入模型的图像。参阅图像输入。

  • detail: ImageDetail

发送给模型的图像细节级别,可选 high、low、auto 或 original,默认为 auto。

  • "low"

  • "high"

  • "auto"

  • "original"

  • type: "input_image" (default: "input_image")

输入条目类型,固定为 input_image。

  • "input_image"

  • file_id: optional string or null

要发送给模型的文件 ID。

  • image_url: optional string or null

要发送给模型的图像 URL,可以是完整 URL,或包含 Base64 编码图像的 data URL。

format: uri

  • prompt_cache_breakpoint: optional object { mode, ttl }

标记可复用提示词前缀的精确结束位置。省略 ttl 时,断点继承请求中的 prompt_cache_options.ttl;该边界不会按词元块取整。

  • mode: "explicit" (default: "explicit")

断点模式,固定为 explicit。

  • "explicit"

  • ttl: optional "30m" or "12h"

此缓存断点的最短存续时间,默认为请求的 TTL。

  • "30m"

  • "12h"

  • ResponseInputFile object { type, detail, file_data, 4 more }

输入模型的文件。

  • type: "input_file" (default: "input_file")

输入条目类型,固定为 input_file。

  • "input_file"

  • detail: optional "auto" or "low" or "high"

发送给模型的文件细节级别。使用 auto 由系统选择;对于 GPT-5.6 及后续模型,auto 使用高质量渲染,可能增加输入词元用量。使用 low 进行成本较低的渲染,或使用 high 以更高质量渲染文件。默认为 auto。

  • "auto"

  • "low"

  • "high"

  • file_data: optional string

要发送给模型的文件内容。

  • file_id: optional string or null

要发送给模型的文件 ID。

  • file_url: optional string

要发送给模型的文件 URL。

format: uri

  • filename: optional string

要发送给模型的文件名。

  • prompt_cache_breakpoint: optional object { mode, ttl }

标记可复用提示词前缀的精确结束位置。省略 ttl 时,断点继承请求中的 prompt_cache_options.ttl;该边界不会按词元块取整。

  • mode: "explicit" (default: "explicit")

断点模式,固定为 explicit。

  • "explicit"

  • ttl: optional "30m" or "12h"

此缓存断点的最短存续时间,默认为请求的 TTL。

  • "30m"

  • "12h"

  • role: "user" or "assistant" or "system" or "developer"

输入消息的角色,可选 user、assistant、system 或 developer.

  • "user"

  • "assistant"

  • "system"

  • "developer"

  • phase: optional "commentary" or "final_answer" or null

将 assistant 消息标记为中间说明(commentary)或最终答案(final_answer)。 对于 gpt-5.3-codex 及后续此类模型,发送后续请求时,须保留并重新发送 所有助手消息的 phase;丢弃它可能降低表现。用户消息不使用此字段。

  • "commentary"

  • "final_answer"

  • type: optional "message"

输入消息类型,固定为 message。

  • "message"

  • EvalMessageObject object { content, role, type }

输入模型的消息,其角色表示指令遵循的 优先级。以 developer 或 system 角色给出的指令 优先于 user 角色给出的指令。 assistant 角色的消息被视为模型在此前 交互中生成的内容。

  • content: string or ResponseInputText or OutputText { text, type } or 3 more

模型输入,可以包含模板字符串。支持输入文本、输出文本、输入图像和输入音频,可提供单个条目或条目数组。

  • TextInput = string

输入模型的文本。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • OutputText object { text, type }

模型输出的文本。

  • text: string

模型输出的文本内容。

  • type: "output_text"

输出文本类型,固定为 output_text。

  • "output_text"

  • InputImage object { image_url, type, detail }

用于 EvalItem 内容数组中的图像输入块。

  • image_url: string

输入图像的 URL。

format: uri

  • type: "input_image"

输入图像类型,固定为 input_image。

  • "input_image"

  • detail: optional string

发送给模型的图像细节级别,可选 high、low 或 auto,默认为 auto。

  • ResponseInputAudio object { input_audio, type }

输入模型的音频。

  • input_audio: object { data, format }

  • data: string

采用 Base64 编码的音频数据。

  • format: "mp3" or "wav"

音频数据格式,当前支持 mp3 和 wav.

  • "mp3"

  • "wav"

  • type: "input_audio"

输入条目类型,固定为 input_audio。

  • "input_audio"

  • GraderInputs = array of string or ResponseInputText or OutputText { text, type } or 2 more

输入列表,每项可以是输入文本、输出文本、输入 图像或输入音频对象。

  • TextInput = string

输入模型的文本。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • OutputText object { text, type }

模型输出的文本。

  • text: string

模型输出的文本内容。

  • type: "output_text"

输出文本类型,固定为 output_text。

  • "output_text"

  • InputImage object { image_url, type, detail }

用于 EvalItem 内容数组中的图像输入块。

  • image_url: string

输入图像的 URL。

format: uri

  • type: "input_image"

输入图像类型,固定为 input_image。

  • "input_image"

  • detail: optional string

发送给模型的图像细节级别,可选 high、low 或 auto,默认为 auto。

  • ResponseInputAudio object { input_audio, type }

输入模型的音频。

  • role: "user" or "assistant" or "system" or "developer"

输入消息的角色,可选 user、assistant、system 或 developer.

  • "user"

  • "assistant"

  • "system"

  • "developer"

  • type: optional "message"

输入消息类型,固定为 message。

  • "message"

  • type: "template"

输入消息类型,固定为 template。

  • "template"

  • ItemReferenceInputMessages object { item_reference, type }

  • item_reference: string

对 item 命名空间中变量的引用,例如 "item.input_trajectory"。

  • type: "item_reference"

输入消息类型,固定为 item_reference。

  • "item_reference"

  • model: optional string

用于生成补全内容的模型名称,例如 "o3-mini"。

  • sampling_params: optional object { max_completion_tokens, reasoning_effort, response_format, 4 more }

  • max_completion_tokens: optional integer

生成输出的最大词元数。

  • reasoning_effort: optional ReasoningEffort or null (default: "medium")

限制推理模型的推理强度。当前支持 none、minimal、low、medium、high、xhigh 和 max。 降低推理强度可能加快响应,并减少响应中用于 推理的词元数。并非所有推理模型都支持每个 取值。各模型的支持情况请参阅 推理指南 中的说明。

  • "none"

  • "minimal"

  • "low"

  • "medium"

  • "high"

  • "xhigh"

  • "max"

  • response_format: optional ResponseFormatText or ResponseFormatJSONSchema or ResponseFormatJSONObject

指定模型必须输出的格式的对象。

设为 { "type": "json_schema", "json_schema": {...} } 会启用 结构化输出,确保模型遵循你提供的 JSON 模式。更多信息请参阅结构化输出 指南。

设为 { "type": "json_object" } 会启用旧版 JSON 模式, 确保模型生成有效的 JSON。对于支持的模型,优先使用 json_schema 格式。

  • ResponseFormatText object { type }

默认响应格式,用于生成文本响应。

  • type: "text"

定义的响应格式类型,固定为 text。

  • "text"

  • ResponseFormatJSONSchema object { json_schema, type }

JSON Schema 响应格式,用于生成结构化 JSON 响应。 参阅结构化输出。

  • json_schema: object { name, description, schema, strict }

结构化输出配置选项,包含 JSON Schema。

  • name: string

响应格式的名称,须使用 a-z、A-Z、0-9,或包含 下划线和连字符,最长为 64 个字符。

  • description: optional string

响应格式的用途描述,模型据此 判断如何按该格式响应。

  • schema: optional map[unknown]

以 JSON Schema 对象描述的响应格式模式。 JSON Schema 的构建方法参阅此处。

  • strict: optional boolean or null (default: false)

生成输出时是否启用严格模式遵循。 设为 true 时,模型始终严格遵循 schema 字段中定义的模式。strict 为 true 时仅支持 JSON Schema 的子集。更多信息请参阅结构化输出 指南。

  • type: "json_schema"

定义的响应格式类型,固定为 json_schema。

  • "json_schema"

  • ResponseFormatJSONObject object { type }

JSON 对象响应格式,是生成 JSON 响应的较早方式。 对于支持的模型,建议使用 json_schema。注意: 须在系统消息或用户消息中指示模型生成 JSON, 模型才会生成 JSON。

  • type: "json_object"

定义的响应格式类型,固定为 json_object。

  • "json_object"

  • seed: optional integer (default: 42)

采样时用于初始化随机性的种子值。

  • temperature: optional number (default: 1)

较高的 temperature 会增加输出的随机性。

  • tools: optional array of ChatCompletionFunctionTool

模型可以调用的工具列表。目前工具仅支持函数。通过此项提供模型可为其生成 JSON 输入的函数列表,最多支持 128 个函数。

  • function: FunctionDefinition

  • name: string

要调用的函数名称,须使用 a-z、A-Z、0-9,或包含下划线和连字符,最长为 64 个字符。

  • description: optional string

函数功能的描述,模型据此选择何时以及如何调用该函数。

  • parameters: optional FunctionParameters

函数接受的参数,以 JSON Schema 对象描述。示例参阅指南,格式说明参阅 JSON Schema 参考。

省略 parameters 表示定义参数列表为空的函数。

  • strict: optional boolean or null (default: false)

生成函数调用时是否启用严格模式遵循。设为 true 时,模型严格遵循 parameters 字段中定义的模式。strict 为 true 时仅支持 JSON Schema 的子集。结构化输出的更多信息参阅函数调用指南。

  • type: "function"

工具类型,目前仅支持 function。

  • "function"

  • top_p: optional number (default: 1)

用于核采样的参数,是 temperature 的替代方案;1.0 表示包含所有词元。

  • ResponsesRunDataSource object { source, type, input_messages, 2 more }

描述模型采样配置的 ResponsesRunDataSource 对象。

  • source: EvalJSONLFileContentSource { content, type } or EvalJSONLFileIDSource { id, type } or EvalResponsesSource { type, created_after, created_before, 8 more }

决定本次运行数据源中 item 命名空间的内容。

  • EvalJSONLFileContentSource object { content, type }

  • content: array of object { item, sample }

JSONL 文件的内容。

  • item: map[unknown]

  • sample: optional map[unknown]

  • type: "file_content" (default: "file_content")

JSONL 来源的类型,固定为 file_content。

  • "file_content"

  • EvalJSONLFileIDSource object { id, type }

  • id: string

文件标识。

  • type: "file_id" (default: "file_id")

JSONL 来源的类型,固定为 file_id。

  • "file_id"

  • EvalResponsesSource object { type, created_after, created_before, 8 more }

描述运行数据源配置的 EvalResponsesSource 对象。

  • type: "responses"

运行数据源类型,固定为 responses。

  • "responses"

  • created_after: optional integer or null

仅包含在此时间戳之后创建的条目,含边界。此查询参数用于选择响应。

minimum: 0

  • created_before: optional integer or null

仅包含在此时间戳之前创建的条目,含边界。此查询参数用于选择响应。

minimum: 0

  • instructions_search: optional string or null

可选的字符串,用于搜索 'instructions' 字段。此查询参数用于选择响应。

  • metadata: optional unknown or null

响应的元数据筛选条件。此查询参数用于选择响应。

  • model: optional string or null

要查找其响应的模型名称。此查询参数用于选择响应。

  • reasoning_effort: optional ReasoningEffort or null (default: "medium")

限制推理模型的推理强度。当前支持 none、minimal、low、medium、high、xhigh 和 max。 降低推理强度可能加快响应,并减少响应中用于 推理的词元数。并非所有推理模型都支持每个 取值。各模型的支持情况请参阅 推理指南 中的说明。

  • temperature: optional number or null

采样温度。此查询参数用于选择响应。

  • tools: optional array of string or null

工具名称列表。此查询参数用于选择响应。

  • top_p: optional number or null

核采样参数。此查询参数用于选择响应。

  • users: optional array of string or null

用户标识列表。此查询参数用于选择响应。

  • type: "responses" (default: "responses")

运行数据源类型,固定为 responses。

  • "responses"

  • input_messages: optional InputMessagesTemplate { template, type } or InputMessagesItemReference { item_reference, type }

从模型采样时使用,规定传给模型的消息结构。可以引用预先构建的轨迹,例如 item.input_trajectory,也可以使用包含 item 命名空间变量引用的模板。

  • InputMessagesTemplate object { template, type }

  • template: array of ChatMessage { content, role } or EvalMessageObject { content, role, type }

构成提示词或上下文的聊天消息列表,可以包含对 item 命名空间的变量引用,例如 {{item.name}}。

  • ChatMessage object { content, role }

  • content: string

消息内容。

  • role: string

消息角色,例如 "system"、"assistant"、"user"。

  • EvalMessageObject object { content, role, type }

输入模型的消息,其角色表示指令遵循的 优先级。以 developer 或 system 角色给出的指令 优先于 user 角色给出的指令。 assistant 角色的消息被视为模型在此前 交互中生成的内容。

  • content: string or ResponseInputText or OutputText { text, type } or 3 more

模型输入,可以包含模板字符串。支持输入文本、输出文本、输入图像和输入音频,可提供单个条目或条目数组。

  • TextInput = string

输入模型的文本。

  • ResponseInputText object { text, type, prompt_cache_breakpoint }

输入模型的文本。

  • OutputText object { text, type }

模型输出的文本。

  • text: string

模型输出的文本内容。

  • type: "output_text"

输出文本类型,固定为 output_text。

  • "output_text"

  • InputImage object { image_url, type, detail }

用于 EvalItem 内容数组中的图像输入块。

  • image_url: string

输入图像的 URL。

format: uri

  • type: "input_image"

输入图像类型,固定为 input_image。

  • "input_image"

  • detail: optional string

发送给模型的图像细节级别,可选 high、low 或 auto,默认为 auto。

  • ResponseInputAudio object { input_audio, type }

输入模型的音频。

  • GraderInputs = array of string or ResponseInputText or OutputText { text, type } or 2 more

输入列表,每项可以是输入文本、输出文本、输入 图像或输入音频对象。

  • role: "user" or "assistant" or "system" or "developer"

输入消息的角色,可选 user、assistant、system 或 developer.

  • "user"

  • "assistant"

  • "system"

  • "developer"

  • type: optional "message"

输入消息类型,固定为 message。

  • "message"

  • type: "template"

输入消息类型,固定为 template。

  • "template"

  • InputMessagesItemReference object { item_reference, type }

  • item_reference: string

对 item 命名空间中变量的引用,例如 "item.name"。

  • type: "item_reference"

输入消息类型,固定为 item_reference。

  • "item_reference"

  • model: optional string

用于生成补全内容的模型名称,例如 "o3-mini"。

  • sampling_params: optional object { max_completion_tokens, reasoning_effort, seed, 4 more }

  • max_completion_tokens: optional integer

生成输出的最大词元数。

  • reasoning_effort: optional ReasoningEffort or null (default: "medium")

限制推理模型的推理强度。当前支持 none、minimal、low、medium、high、xhigh 和 max。 降低推理强度可能加快响应,并减少响应中用于 推理的词元数。并非所有推理模型都支持每个 取值。各模型的支持情况请参阅 推理指南 中的说明。

  • seed: optional integer (default: 42)

采样时用于初始化随机性的种子值。

  • temperature: optional number (default: 1)

较高的 temperature 会增加输出的随机性。

  • text: optional object { format }

模型文本响应的配置选项,可以是纯 文本或结构化 JSON 数据。更多信息:

  • format: optional ResponseFormatTextConfig

指定模型必须输出的格式的对象。

配置 { "type": "json_schema" } 会启用结构化输出, 确保模型遵循你提供的 JSON Schema。更多信息参阅 结构化输出指南。

默认格式为 { "type": "text" },没有额外选项。

不建议用于 gpt-4o 及后续模型:

设为 { "type": "json_object" } 会启用旧版 JSON 模式, 确保模型生成有效的 JSON。对于支持的模型,优先使用 json_schema 格式。

  • ResponseFormatText object { type }

默认响应格式,用于生成文本响应。

  • ResponseFormatTextJSONSchemaConfig object { name, schema, type, 2 more }

JSON Schema 响应格式,用于生成结构化 JSON 响应。 参阅结构化输出。

  • name: string

响应格式的名称,须使用 a-z、A-Z、0-9,或包含 下划线和连字符,最长为 64 个字符。

  • schema: map[unknown]

以 JSON Schema 对象描述的响应格式模式。 JSON Schema 的构建方法参阅此处。

  • type: "json_schema"

定义的响应格式类型,固定为 json_schema。

  • "json_schema"

  • description: optional string

响应格式的用途描述,模型据此 判断如何按该格式响应。

  • strict: optional boolean or null (default: false)

生成输出时是否启用严格模式遵循。 设为 true 时,模型始终严格遵循 schema 字段中定义的模式。strict 为 true 时仅支持 JSON Schema 的子集。更多信息请参阅结构化输出 指南。

  • ResponseFormatJSONObject object { type }

JSON 对象响应格式,是生成 JSON 响应的较早方式。 对于支持的模型,建议使用 json_schema。注意: 须在系统消息或用户消息中指示模型生成 JSON, 模型才会生成 JSON。

  • tools: optional array of Function { name, parameters, strict, 6 more } or FileSearch { type, vector_store_ids, filters, 2 more } or Computer { type } or 13 more

模型生成响应时可以调用的工具数组。你 可以通过 tool_choice 参数指定要使用的工具。

可向模型提供以下两类工具:

  • 内置工具:由 OpenAI 提供,用于扩展 模型能力,例如网页搜索 或文件搜索。更多信息参阅 内置工具。
  • 函数调用(自定义工具):由你定义的函数, 使模型可以调用你自己的代码。更多信息参阅 函数调用。

  • Function object { name, parameters, strict, 6 more }

定义模型可以选择调用的自有代码函数。参阅函数调用。

  • name: string

要调用的函数名称。

  • parameters: map[unknown] or null

描述函数参数的 JSON Schema 对象。

  • strict: boolean or null

是否对此函数工具强制执行严格参数校验。

  • type: "function" (default: "function")

函数工具类型,固定为 function。

  • "function"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

  • "direct"

  • "programmatic"

  • async: optional boolean

  • defer_loading: optional boolean

此函数是否延迟加载并通过工具搜索加载。

  • description: optional string or null

函数描述,模型据此判断是否调用该函数。

  • output_schema: optional map[unknown] or null

描述此函数字符串输出中编码的 JSON 值的 JSON Schema 对象。

  • FileSearch object { type, vector_store_ids, filters, 2 more }

搜索已上传文件中相关内容的工具。参阅文件搜索工具。

  • type: "file_search" (default: "file_search")

文件搜索工具类型,固定为 file_search。

  • "file_search"

  • vector_store_ids: array of string

要搜索的向量存储 ID 列表。

  • filters: optional ComparisonFilter or CompoundFilter or null

要应用的筛选条件。

  • ComparisonFilter object { key, type, value }

使用指定比较运算,将某个属性键与给定值比较的筛选条件。

  • key: string

要与值比较的属性键。

  • type: "eq" or "ne" or "gt" or 5 more (default: "eq")

指定比较运算符:eq、ne、gt、gte、lt、lte、in、nin。

  • eq:等于
  • ne:不等于
  • gt:大于
  • gte:大于或等于
  • lt:小于
  • lte:小于或等于
  • in:属于
  • nin:不属于

  • "eq"

  • "ne"

  • "gt"

  • "gte"

  • "lt"

  • "lte"

  • "in"

  • "nin"

  • value: string or number or boolean or array of string or number

用于与属性键比较的值,支持字符串、数字或布尔类型。

  • string

  • number

  • boolean

  • array of string or number

  • string

  • number

  • CompoundFilter object { filters, type }

使用 and 或 or 组合多个筛选条件。

  • filters: array of ComparisonFilter or CompoundFilter

要组合的筛选条件数组,条目可以是 ComparisonFilter 或 CompoundFilter。

  • ComparisonFilter object { key, type, value }

使用指定比较运算,将某个属性键与给定值比较的筛选条件。

  • CompoundFilter object { filters, type }

使用 and 或 or 组合多个筛选条件。

  • type: "and" or "or"

运算类型:and 或 or。

  • "and"

  • "or"

  • max_num_results: optional integer

返回结果数量上限,须介于 1–50 之间,含边界。

  • ranking_options: optional object { hybrid_search, ranker, score_threshold }

搜索结果的排序选项。

  • hybrid_search: optional object { embedding_weight, text_weight }

启用混合搜索时,控制倒数排名融合如何平衡语义嵌入匹配与稀疏关键词匹配的权重。

  • embedding_weight: number

嵌入在倒数排名融合中的权重。

  • text_weight: number

文本在倒数排名融合中的权重。

  • ranker: optional "auto" or "default-2024-11-15"

文件搜索所用的排序器。

  • "auto"

  • "default-2024-11-15"

  • score_threshold: optional number

文件搜索的分数阈值,为 0–1 之间的数字。越接近 1,越倾向于只返回最相关的结果,但返回数量可能减少。

  • Computer object { type }

控制虚拟计算机的工具。参阅计算机工具。

  • type: "computer" (default: "computer")

计算机工具类型,固定为 computer。

  • "computer"

  • ComputerUsePreview object { display_height, display_width, environment, type }

控制虚拟计算机的工具。参阅计算机工具。

  • display_height: integer

计算机显示区域的高度。

  • display_width: integer

计算机显示区域的宽度。

  • environment: "windows" or "mac" or "linux" or 2 more

要控制的计算机环境类型。

  • "windows"

  • "mac"

  • "linux"

  • "ubuntu"

  • "browser"

  • type: "computer_use_preview" (default: "computer_use_preview")

计算机使用工具类型,固定为 computer_use_preview。

  • "computer_use_preview"

  • WebSearch object { type, external_web_access, filters, 2 more }

在互联网上搜索与提示词相关的信息来源。参阅 网络搜索工具时。

  • type: "web_search" or "web_search_2025_08_26" (default: "web_search")

网页搜索工具类型,可选 web_search 或 web_search_2025_08_26。

  • "web_search"

  • "web_search_2025_08_26"

  • external_web_access: optional boolean (default: true)

是否允许网页搜索实时访问互联网。省略时默认为 true。设为 false 时,网页搜索工具以离线或仅缓存模式运行,不会抓取新的外部内容。

  • filters: optional object { allowed_domains } or null

搜索的筛选条件。

  • allowed_domains: optional array of string or null (default: [])

搜索允许的域名。未提供时允许所有域名。 也允许访问所提供域名的子域名。

示例:["pubmed.ncbi.nlm.nih.gov"]

  • search_context_size: optional "low" or "medium" or "high" (default: "medium")

对搜索占用上下文窗口空间大小的总体指导,可选 low、medium 或 high,默认为 medium。

  • "low"

  • "medium"

  • "high"

  • user_location: optional object { city, country, region, 2 more } or null

用户的大致位置。省略或设为 null 时,默认为 美国。若要避免此默认值,可传入不包含位置字段的 {"type": "approximate"}。 若要本地化结果,须提供相应位置字段。

  • city: optional string or null

用户所在城市的自由文本,例如 San Francisco。

  • country: optional string or null

用户所在国家/地区的两字母 ISO 代码,例如 US。

  • region: optional string or null

用户所在地区的自由文本,例如 California。

  • timezone: optional string or null

用户所在的 IANA 时区,例如 America/Los_Angeles。

  • type: optional "approximate" (default: "approximate")

位置估算类型,固定为 approximate。

  • "approximate"

  • Mcp object { server_label, type, allowed_callers, 9 more }

通过远程模型上下文协议(MCP)服务器, 向模型提供额外工具。了解 MCP。

  • server_label: string

此 MCP 服务器的标签,用于在工具调用中标识服务器。

  • type: "mcp"

MCP 工具类型,固定为 mcp。

  • "mcp"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • allowed_tools: optional array of string or McpToolFilter { read_only, tool_names } or null

允许的工具名称列表或筛选对象。

  • McpAllowedTools = array of string

允许的工具名称组成的字符串数组。

  • McpToolFilter object { read_only, tool_names }

用于指定允许哪些工具的筛选对象。

  • read_only: optional boolean

表示工具会修改数据还是只读。如果 MCP 服务器标注了 readOnlyHint, 就会与此筛选条件匹配。

  • tool_names: optional array of string

允许的工具名称列表。

  • authorization: optional string

可用于远程 MCP 服务器的 OAuth 访问令牌,既可 配合自定义 MCP 服务器 URL,也可配合服务连接器。你的应用 须处理 OAuth 授权流程,并在此提供令牌。

  • connector_id: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 5 more

服务连接器的标识,例如 ChatGPT 中提供的连接器。须提供 server_url、connector_id 或 tunnel_id 中的一项。更多 服务连接器信息参阅此处。

对于 2026 年 9 月 1 日之后发布的模型,此字段已弃用。 使用 server_url 连接远程 MCP 服务器,或使用 tunnel_id 通过安全 MCP 隧道连接。

当前支持的 connector_id 值如下:

  • Dropbox:connector_dropbox
  • Gmail:connector_gmail
  • Google 日历:connector_googlecalendar
  • Google 云端硬盘:connector_googledrive
  • Microsoft Teams:connector_microsoftteams
  • Outlook 日历:connector_outlookcalendar
  • Outlook 邮箱:connector_outlookemail
  • SharePoint:connector_sharepoint

  • "connector_dropbox"

  • "connector_gmail"

  • "connector_googlecalendar"

  • "connector_googledrive"

  • "connector_microsoftteams"

  • "connector_outlookcalendar"

  • "connector_outlookemail"

  • "connector_sharepoint"

  • defer_loading: optional boolean

此 MCP 工具是否延迟加载并通过工具搜索发现。

  • headers: optional map[string] or null

可选的发送给 MCP 服务器的 HTTP 请求头,用于认证 或其他用途。

  • require_approval: optional McpToolApprovalFilter { always, never } or "always" or "never" or null (default: "always")

指定 MCP 服务器的哪些工具需要批准。

  • McpToolApprovalFilter object { always, never }

指定 MCP 服务器的哪些工具需要批准。可以是 always、never,或与需要批准的工具关联的 筛选对象。

  • always: optional object { read_only, tool_names }

用于指定允许哪些工具的筛选对象。

  • read_only: optional boolean

表示工具会修改数据还是只读。如果 MCP 服务器标注了 readOnlyHint, 就会与此筛选条件匹配。

  • tool_names: optional array of string

允许的工具名称列表。

  • never: optional object { read_only, tool_names }

用于指定允许哪些工具的筛选对象。

  • read_only: optional boolean

表示工具会修改数据还是只读。如果 MCP 服务器标注了 readOnlyHint, 就会与此筛选条件匹配。

  • tool_names: optional array of string

允许的工具名称列表。

  • McpToolApprovalSetting = "always" or "never"

为所有工具指定统一的批准策略,可选 always 或 never。设为 always 时,所有工具均需要批准; 设为 never 时,所有工具均不需要批准。

  • "always"

  • "never"

  • server_description: optional string

MCP 服务器的可选描述,用于提供更多上下文。

  • server_url: optional string

MCP 服务器的 URL。须提供 server_url、connector_id 或 tunnel_id 中的一项。

format: uri

  • tunnel_id: optional string

用来替代直接服务器 URL 的安全 MCP 隧道 ID。须提供 server_url、connector_id 或 tunnel_id 中的一项。

pattern: ^tunnel_[a-z0-9]{32}$

  • CodeInterpreter object { container, type, allowed_callers }

运行 Python 代码以帮助生成提示词响应的工具。

  • container: string or CodeInterpreterToolAuto { type, file_ids, memory_limit, network_policy }

代码解释器容器,可以是容器 ID,也可以是 指定代码可用的已上传文件 ID 的对象,同时可提供 可选的 memory_limit 设置。

  • string

容器 ID。

  • CodeInterpreterToolAuto object { type, file_ids, memory_limit, network_policy }

代码解释器容器配置,可以指定运行代码时所处理的文件 ID。

  • type: "auto" (default: "auto")

固定为 auto。

  • "auto"

  • file_ids: optional array of string

可选的已上传文件列表,这些文件将提供给代码使用。

maxItems: 50

  • memory_limit: optional "1g" or "4g" or "16g" or "64g" or null

代码解释器容器的内存上限。

  • "1g"

  • "4g"

  • "16g"

  • "64g"

  • network_policy: optional ContainerNetworkPolicyDisabled or ContainerNetworkPolicyAllowlist

容器的网络访问策略。

  • ContainerNetworkPolicyDisabled object { type }

  • type: "disabled" (default: "disabled")

禁用出站网络访问,固定为 disabled。

  • "disabled"

  • ContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }

  • allowed_domains: array of string

type 为 allowlist 时允许访问的域名列表。

minItems: 1

  • type: "allowlist" (default: "allowlist")

仅允许对指定域名发起出站网络访问,固定为 allowlist。

  • "allowlist"

  • domain_secrets: optional array of ContainerNetworkPolicyDomainSecret

可选的仅用于允许访问域名的域名级密钥。

minItems: 1

  • domain: string

密钥关联的域名。

minLength: 1

  • name: string

要为该域名注入的密钥名称。

minLength: 1

  • value: string

要为该域名注入的密钥值。

minLength: 1, maxLength: 10485760

  • type: "code_interpreter"

代码解释器工具类型,固定为 code_interpreter。

  • "code_interpreter"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • ProgrammaticToolCalling object { type }

  • type: "programmatic_tool_calling" (default: "programmatic_tool_calling")

工具类型,固定为 programmatic_tool_calling。

  • "programmatic_tool_calling"

  • ImageGeneration object { type, action, background, 13 more }

使用 GPT 图像模型生成图像的工具。

  • type: "image_generation"

图像生成工具类型,固定为 image_generation。

  • "image_generation"

  • action: optional "generate" or "edit" or "auto"

生成新图像还是编辑已有图像,默认为 auto。

  • "generate"

  • "edit"

  • "auto"

  • background: optional "transparent" or "opaque" or "auto" (default: "auto")

生成图像的背景,可选 transparent、opaque, 或 auto。gpt-image-2.5-sunburst 和 gpt-image-2.5-flare,包括 对应的 2026-09-08 快照,支持 opaque 和 transparent 背景。受支持的 GPT Image 模型可以使用透明 背景。对于 gpt-image-2 和 gpt-image-2-2026-04-21,此功能处于 预览阶段。使用 transparent 时,须将输出格式设为 png 或 webp。 默认为 auto。

  • "transparent"

  • "opaque"

  • "auto"

  • complexity: optional "low" or "medium" or "high"

用于规划图像的计算投入,与渲染质量分开设置。 覆盖外层响应用于图像生成的 reasoning.effort。 省略时,继承外层受支持的推理强度,或使用 图像模型配置的默认值。 对于 SVG 输出,此项控制参考图像,而不是 SVG 生成模型的 推理。

  • "low"

  • "medium"

  • "high"

  • frame_count: optional integer (default: 9)

GIF 帧数,要求 output_format 为 gif,默认为 9。

minimum: 2, maximum: 16

  • frame_duration_ms: optional integer (default: 200)

每个 GIF 帧的时长,单位为毫秒,取整到 10 毫秒。 要求 output_format 为 gif,默认为 200。

minimum: 20, maximum: 2000

  • input_fidelity: optional "high" or "low" or null

控制模型为匹配输入图像风格和特征(尤其是面部特征)投入的程度。gpt-image-1.5 支持 high 和 low,gpt-image-1-mini 仅支持 low。使用 gpt-image-2 时应省略此参数。支持该参数的模型默认为 low。

  • "high"

  • "low"

  • input_image_mask: optional object { file_id, image_url }

可选的局部重绘蒙版,包含 image_url (可选字符串)和 file_id(可选字符串)。

  • file_id: optional string

蒙版图像的文件 ID。

  • image_url: optional string

采用 Base64 编码的蒙版图像。

  • model: optional string or "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-2" or 9 more

用于图像生成的模型,可选 gpt-image-1-mini、 gpt-image-1.5, gpt-image-2, gpt-image-2-2026-04-21、gpt-image-2.5-sunburst、 gpt-image-2.5-sunburst-2026-09-08、gpt-image-2.5-flare、 gpt-image-2.5-flare-2026-09-08, gpt-image-2.6-sunburst, gpt-image-2.6-flare 或 chatgpt-image-latest。默认值: gpt-image-2.6-sunburst.

gpt-image-1 已于 2026 年 10 月 23 日停用,请使用 gpt-image-2.5-sunburst 或 gpt-image-2.5-flare。

  • string

  • "gpt-image-1" or "gpt-image-1-mini" or "gpt-image-2" or 9 more

用于图像生成的模型,可选 gpt-image-1-mini、 gpt-image-1.5, gpt-image-2, gpt-image-2-2026-04-21、gpt-image-2.5-sunburst、 gpt-image-2.5-sunburst-2026-09-08、gpt-image-2.5-flare、 gpt-image-2.5-flare-2026-09-08, gpt-image-2.6-sunburst, gpt-image-2.6-flare 或 chatgpt-image-latest。默认值: gpt-image-2.6-sunburst.

gpt-image-1 已于 2026 年 10 月 23 日停用,请使用 gpt-image-2.5-sunburst 或 gpt-image-2.5-flare。

  • "gpt-image-1"

  • "gpt-image-1-mini"

  • "gpt-image-2"

  • "gpt-image-2-2026-04-21"

  • "gpt-image-2.5-sunburst"

  • "gpt-image-2.5-sunburst-2026-09-08"

  • "gpt-image-2.5-flare"

  • "gpt-image-2.5-flare-2026-09-08"

  • "gpt-image-2.6-sunburst"

  • "gpt-image-2.6-flare"

  • "gpt-image-1.5"

  • "chatgpt-image-latest"

  • moderation: optional "auto" or "low" (default: "auto")

生成图像的审核级别,默认为 auto。

  • "auto"

  • "low"

  • output_compression: optional integer (default: 100)

输出图像的压缩级别,默认为 100。

minimum: 0, maximum: 100

  • output_format: optional "png" or "webp" or "jpeg" or 2 more (default: "png")

输出图像格式,可选 png、webp、jpeg、 gif 或 svg,默认为 png。GIF 和 SVG 输出要求模型 支持所选格式。GIF 输出不支持 部分图像流式传输,即 partial_images 大于 0, 也不支持 input_image_mask 或自定义 output_compression。 GIF 输出仍可以流式发送 Responses 生命周期事件。

  • "png"

  • "webp"

  • "jpeg"

  • "gif"

  • "svg"

  • partial_images: optional integer (default: 0)

流式模式中生成的部分图像数量,范围为 0(默认值)到 3。

minimum: 0, maximum: 3

  • quality: optional "low" or "medium" or "high" or 3 more (default: "auto")

生成图像的质量。GPT 图像模型支持 low、 medium 和 high。gpt-image-2.5-sunburst 和 gpt-image-2.5-flare, 包括对应的 2026-09-08 快照,还支持 xhigh 和 max。 默认为 auto。

  • "low"

  • "medium"

  • "high"

  • "xhigh"

  • "max"

  • "auto"

  • size: optional string or "1024x1024" or "1024x1536" or "1536x1024" or "auto" (default: "auto")

生成图像的尺寸。gpt-image-2、gpt-image-2-2026-04-21、gpt-image-2.5-sunburst、gpt-image-2.5-sunburst-2026-09-08、gpt-image-2.5-flare 和 gpt-image-2.5-flare-2026-09-08 支持以 WIDTHxHEIGHT 字符串指定任意分辨率,例如 1536x864。宽和高均须能被 16 整除,宽高比须在 1:3 至 3:1 之间。高于 2560x1440 的分辨率属于实验功能,支持的最高分辨率为 3840x2160。尺寸还须符合模型当前的像素数与边长限制。GPT Image 模型支持标准尺寸 1024x1024、1536x1024 和 1024x1536;允许自动尺寸的模型支持 auto。

  • string

  • "1024x1024" or "1024x1536" or "1536x1024" or "auto"

生成图像的尺寸。gpt-image-2、gpt-image-2-2026-04-21、gpt-image-2.5-sunburst、gpt-image-2.5-sunburst-2026-09-08、gpt-image-2.5-flare 和 gpt-image-2.5-flare-2026-09-08 支持以 WIDTHxHEIGHT 字符串指定任意分辨率,例如 1536x864。宽和高均须能被 16 整除,宽高比须在 1:3 至 3:1 之间。高于 2560x1440 的分辨率属于实验功能,支持的最高分辨率为 3840x2160。尺寸还须符合模型当前的像素数与边长限制。GPT Image 模型支持标准尺寸 1024x1024、1536x1024 和 1024x1536;允许自动尺寸的模型支持 auto。

  • "1024x1024"

  • "1024x1536"

  • "1536x1024"

  • "auto"

  • svg: optional object { model, reasoning }

SVG 生成模型的设置,要求 output_format 为 svg。 启用 SVG 模型选择时,省略此对象会使用 外层响应模型。否则使用默认 SVG 生成模型,且 不能显式覆盖模型。

  • model: optional string

minLength: 1

  • reasoning: optional object { effort } or null

SVG 编写的推理强度。省略时,Images 和 Responses 均使用编写模型的默认值。

  • effort: optional "none" or "minimal" or "low" or 4 more

控制模型为此次请求投入的推理强度。

  • "none"

  • "minimal"

  • "low"

  • "medium"

  • "high"

  • "xhigh"

  • "max"

  • LocalShell object { type }

允许模型在本地环境执行 shell 命令的工具。

  • type: "local_shell" (default: "local_shell")

本地 shell 工具类型,固定为 local_shell。

  • "local_shell"

  • Shell object { type, allowed_callers, environment }

允许模型执行 shell 命令的工具。

  • type: "shell" (default: "shell")

shell 工具类型,固定为 shell。

  • "shell"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • environment: optional ContainerAuto or LocalEnvironment or ContainerReference or null

  • ContainerAuto object { type, file_ids, memory_limit, 2 more }

  • type: "container_auto" (default: "container_auto")

为此请求自动创建容器。

  • "container_auto"

  • file_ids: optional array of string

可选的已上传文件列表,这些文件将提供给代码使用。

maxItems: 50

  • memory_limit: optional "1g" or "4g" or "16g" or "64g" or null

容器的内存上限。

  • "1g"

  • "4g"

  • "16g"

  • "64g"

  • network_policy: optional ContainerNetworkPolicyDisabled or ContainerNetworkPolicyAllowlist

容器的网络访问策略。

  • ContainerNetworkPolicyDisabled object { type }

  • ContainerNetworkPolicyAllowlist object { allowed_domains, type, domain_secrets }

  • skills: optional array of SkillReference or InlineSkill

可选的技能列表,通过 ID 或内联数据引用技能。

maxItems: 200

  • SkillReference object { skill_id, type, version }

  • skill_id: string

引用的技能 ID。

minLength: 1, maxLength: 64

  • type: "skill_reference" (default: "skill_reference")

引用通过 /v1/skills 接口创建的技能。

  • "skill_reference"

  • version: optional string

可选的技能版本。使用正整数或 'latest',省略时使用默认版本。

  • InlineSkill object { description, name, source, type }

  • description: string

技能描述。

  • name: string

技能名称。

  • source: InlineSkillSource

内联技能载荷。

  • data: string

采用 Base64 编码的技能 ZIP 包。

minLength: 1, maxLength: 70254592

  • media_type: "application/zip" (default: "application/zip")

内联技能载荷的媒体类型,必须为 application/zip。

  • "application/zip"

  • type: "base64" (default: "base64")

内联技能来源的类型,必须为 base64。

  • "base64"

  • type: "inline" (default: "inline")

为此请求定义内联技能。

  • "inline"

  • LocalEnvironment object { type, skills }

  • type: "local" (default: "local")

使用本地计算机环境。

  • "local"

  • skills: optional array of LocalSkill

可选的技能列表。

maxItems: 200

  • description: string

技能描述。

  • name: string

技能名称。

  • path: string

包含该技能的目录路径。

  • ContainerReference object { container_id, type }

  • container_id: string

引用的容器 ID。

  • type: "container_reference" (default: "container_reference")

引用通过 /v1/containers 接口创建的容器。

  • "container_reference"

  • Custom object { name, type, allowed_callers, 4 more }

使用指定格式处理输入的自定义工具。参阅自定义工具。

  • name: string

自定义工具的名称,用于在工具调用中标识它。

  • type: "custom" (default: "custom")

自定义工具类型,固定为 custom。

  • "custom"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • async: optional boolean

工具响应是否可以异步返回,而非在下一次创建响应时立即返回。

  • defer_loading: optional boolean

此工具是否应延迟加载并通过工具搜索发现。

  • description: optional string

自定义工具的可选描述,用于提供更多上下文。

  • format: optional CustomToolInputFormat

自定义工具的输入格式,默认为无约束文本。

  • Text object { type }

无约束的自由文本。

  • type: "text" (default: "text")

无约束文本格式,固定为 text。

  • "text"

  • Grammar object { definition, syntax, type }

用户定义的语法。

  • definition: string

语法定义。

  • syntax: "lark" or "regex"

语法定义的语法类型,可选 lark 或 regex。

  • "lark"

  • "regex"

  • type: "grammar" (default: "grammar")

语法格式,固定为 grammar。

  • "grammar"

  • Namespace object { description, name, tools, type }

将函数工具或自定义工具归入共享命名空间。

  • description: string

展示给模型的命名空间描述。

  • name: string

工具调用使用的命名空间名称,例如 crm。

minLength: 1

  • tools: array of Function { name, type, allowed_callers, 6 more } or Custom { name, type, allowed_callers, 4 more }

此命名空间内可用的函数工具或自定义工具。

minItems: 1

  • Function object { name, type, allowed_callers, 6 more }

  • name: string

pattern: ^[a-zA-Z0-9_-]+$, minLength: 1, maxLength: 128

  • type: "function" (default: "function")

  • "function"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • async: optional boolean

工具响应是否可以异步返回,而非在下一次创建响应时立即返回。

  • defer_loading: optional boolean

此函数是否应延迟加载并通过工具搜索发现。

  • description: optional string or null

  • output_schema: optional map[unknown] or null

描述此函数工具字符串输出中编码的 JSON 值的 JSON Schema,不用于描述内容数组输出。

  • parameters: optional unknown or null

  • strict: optional boolean or null

是否强制执行严格参数校验。省略时,模式兼容的情况下 Responses 会尝试严格校验,否则退回非严格校验。

  • Custom object { name, type, allowed_callers, 4 more }

使用指定格式处理输入的自定义工具。参阅自定义工具。

  • name: string

自定义工具的名称,用于在工具调用中标识它。

  • type: "custom" (default: "custom")

自定义工具类型,固定为 custom。

  • "custom"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • async: optional boolean

工具响应是否可以异步返回,而非在下一次创建响应时立即返回。

  • defer_loading: optional boolean

此工具是否应延迟加载并通过工具搜索发现。

  • description: optional string

自定义工具的可选描述,用于提供更多上下文。

  • format: optional CustomToolInputFormat

自定义工具的输入格式,默认为无约束文本。

  • type: "namespace" (default: "namespace")

工具类型,固定为 namespace。

  • "namespace"

  • ToolSearch object { type, description, execution, parameters }

用于延迟加载工具的托管工具搜索或自带工具(BYOT)搜索配置。

  • type: "tool_search" (default: "tool_search")

工具类型,固定为 tool_search。

  • "tool_search"

  • description: optional string or null

客户端执行的工具搜索工具展示给模型的描述。

  • execution: optional "server" or "client"

工具搜索由服务端还是客户端执行。

  • "server"

  • "client"

  • parameters: optional unknown or null

客户端执行的工具搜索工具的参数模式。

  • WebSearchPreview object { type, search_content_types, search_context_size, user_location }

搜索网页以获取可用于响应的相关结果的工具。参阅网页搜索工具。

  • type: "web_search_preview" or "web_search_preview_2025_03_11" (default: "web_search_preview")

网页搜索工具类型,可选 web_search_preview 或 web_search_preview_2025_03_11。

  • "web_search_preview"

  • "web_search_preview_2025_03_11"

  • search_content_types: optional array of "text" or "image"

  • "text"

  • "image"

  • search_context_size: optional "low" or "medium" or "high"

对搜索占用上下文窗口空间大小的总体指导,可选 low、medium 或 high,默认为 medium。

  • "low"

  • "medium"

  • "high"

  • user_location: optional object { type, city, country, 2 more } or null

用户的大致位置。省略或设为 null 时默认为美国。若要避免此默认值,可传入不包含位置字段的 {"type": "approximate"}。若要本地化结果,须提供相应位置字段。

  • type: "approximate" (default: "approximate")

位置估算类型,固定为 approximate。

  • "approximate"

  • city: optional string or null

用户所在城市的自由文本,例如 San Francisco。

  • country: optional string or null

用户所在国家/地区的两字母 ISO 代码,例如 US。

  • region: optional string or null

用户所在地区的自由文本,例如 California。

  • timezone: optional string or null

用户所在的 IANA 时区,例如 America/Los_Angeles。

  • ApplyPatch object { type, allowed_callers }

允许助手使用统一差异格式创建、删除或更新文件。

  • type: "apply_patch" (default: "apply_patch")

工具类型,固定为 apply_patch。

  • "apply_patch"

  • allowed_callers: optional array of "direct" or "programmatic" or null

工具调用的上下文。

minItems: 1

  • "direct"

  • "programmatic"

  • top_p: optional number (default: 1)

用于核采样的参数,是 temperature 的替代方案;1.0 表示包含所有词元。

  • error: EvalAPIError or null

表示 Eval API 错误响应的对象。

  • code: string

错误代码。

  • message: string

错误消息。

  • eval_id: string

关联评测的标识。

  • metadata: Metadata or null

可附加到对象的元数据,最多包含 16 组键值对,可 以结构化方式存储对象的额外信息, 并通过 API 或控制台查询对象。

键为最多 64 个字符的字符串,值为 最多 512 个字符的字符串。

  • model: string or null

被评测的模型,如适用。

  • name: string or null

评测运行名称。

  • object: "eval.run" (default: "eval.run")

对象类型,固定为 "eval.run"。

  • "eval.run"

  • per_model_usage: array of object { cached_tokens, completion_tokens, invocation_count, 3 more } or null

评测运行期间各模型的用量统计。

  • cached_tokens: integer

从缓存读取的词元数。

  • completion_tokens: integer

生成的补全词元数。

  • invocation_count: integer

调用次数。

  • model_name: string

模型名称。

  • prompt_tokens: integer

使用的提示词词元数。

  • total_tokens: integer

使用的总词元数。

  • per_testing_criteria_results: array of object { failed, passed, testing_criteria } or null

评测运行中各测试标准的结果。

  • failed: integer

未通过此标准的测试数量。

  • passed: integer

通过此标准的测试数量。

  • testing_criteria: string

测试标准的描述。

  • report_url: string

在控制台界面中呈现评测运行报告的 URL。

format: uri

  • result_counts: object { errored, failed, passed, total }

汇总评测运行结果的计数器。

  • errored: integer

因错误而失败的输出条目数量。

  • failed: integer

未通过评测的输出条目数量。

  • passed: integer

通过评测的输出条目数量。

  • total: integer

已执行的输出条目总数。

  • status: string

评测运行状态。

输出条目

获取评测运行输出条目列表

get /evals/{eval_id}/runs/{run_id}/output_items

获取某次评测运行的输出条目列表。

路径参数

  • eval_id: string

要获取其运行列表的评测的 ID。

  • run_id: string

要获取其输出条目的运行的 ID。

查询参数

  • after: optional string

上一次分页请求中最后一个输出条目的标识。

  • limit: optional integer (default: 20)

要获取的输出条目数量。

  • order: optional "asc" or "desc" (default: "asc")

按时间戳对输出条目排序,使用 asc 升序或 desc 降序,默认为 asc。

  • "asc"

  • "desc"

  • status: optional "fail" or "pass"

按输出条目状态筛选。使用 failed 筛选未通过的输出 条目,使用 pass 筛选通过的输出条目。

  • "fail"

  • "pass"

返回值

  • data: array of object { id, created_at, datasource_item, 7 more }

评测运行输出条目对象数组。

  • id: string

评测运行输出条目的唯一标识。

  • created_at: integer

评测运行创建时的 Unix 时间戳,单位为秒。

format: unixtime

  • datasource_item: map[unknown]

输入数据源条目的详情。

  • datasource_item_id: integer

数据源条目的标识。

  • eval_id: string

评测组的标识。

  • object: "eval.run.output_item" (default: "eval.run.output_item")

对象类型,固定为 "eval.run.output_item"。

  • "eval.run.output_item"

  • results: array of object { name, passed, score, 2 more }

此输出条目的评分器结果列表。

  • name: string

评分器名称。

  • passed: boolean

评分器是否认为此输出通过。

  • score: number

评分器给出的数值分数。

  • sample: optional map[unknown] or null

评分器生成的可选样本或中间数据。

  • type: optional string

评分器类型,例如 "string-check-grader"。

  • run_id: string

与此输出条目关联的评测运行的标识。

  • sample: object { error, finish_reason, input, 7 more }

包含评测运行输入和输出的样本。

  • error: EvalAPIError or null

表示 Eval API 错误响应的对象。

  • code: string

错误代码。

  • message: string

错误消息。

  • finish_reason: string

样本生成结束的原因。

  • input: array of object { content, role }

输入消息数组。

  • content: string

消息内容。

  • role: string

消息发送者的角色,例如 system、user、developer。

  • max_completion_tokens: integer

允许生成的最大补全词元数。

  • model: string

生成样本使用的模型。

  • output: array of object { content, role }

输出消息数组。

  • content: optional string

消息内容。

  • role: optional string

消息角色,例如 "system"、"assistant"、"user"。

  • seed: integer

生成样本使用的随机种子。

  • temperature: number

使用的采样温度。

  • top_p: number

采样使用的 top_p 值。

  • usage: object { cached_tokens, completion_tokens, prompt_tokens, total_tokens }

样本的词元用量详情。

  • cached_tokens: integer

从缓存读取的词元数。

  • completion_tokens: integer

生成的补全词元数。

  • prompt_tokens: integer

使用的提示词词元数。

  • total_tokens: integer

使用的总词元数。

  • status: string

评测运行状态。

  • first_id: string

data 数组中第一个评测运行输出条目的标识。

  • has_more: boolean

是否还有更多可用的评测运行输出条目。

  • last_id: string

data 数组中最后一个评测运行输出条目的标识。

  • object: "list" (default: "list")

对象类型,固定为 "list"。

  • "list"

示例

## 设置 OPENAI_API_KEY,并将评测 ID 和运行 ID 替换为实际值。
curl https://api.openai.com/v1/evals/$EVAL_ID/runs/$RUN_ID/output_items \
    -H "Authorization: Bearer $OPENAI_API_KEY"

200 响应示例

{
  "data": [
    {
      "id": "id",
      "created_at": 0,
      "datasource_item": {
        "foo": "bar"
      },
      "datasource_item_id": 0,
      "eval_id": "eval_id",
      "object": "eval.run.output_item",
      "results": [
        {
          "name": "name",
          "passed": true,
          "score": 0,
          "sample": {
            "foo": "bar"
          },
          "type": "type"
        }
      ],
      "run_id": "run_id",
      "sample": {
        "error": {
          "code": "code",
          "message": "message"
        },
        "finish_reason": "finish_reason",
        "input": [
          {
            "content": "content",
            "role": "role"
          }
        ],
        "max_completion_tokens": 0,
        "model": "model",
        "output": [
          {
            "content": "content",
            "role": "role"
          }
        ],
        "seed": 0,
        "temperature": 0,
        "top_p": 0,
        "usage": {
          "cached_tokens": 0,
          "completion_tokens": 0,
          "prompt_tokens": 0,
          "total_tokens": 0
        }
      },
      "status": "status"
    }
  ],
  "first_id": "first_id",
  "has_more": true,
  "last_id": "last_id",
  "object": "list"
}

示例

## 设置 OPENAI_API_KEY,并将评测 ID 和运行 ID 替换为实际值。
curl https://api.openai.com/v1/evals/egroup_67abd54d9b0081909a86353f6fb9317a/runs/erun_67abd54d60ec8190832b46859da808f7/output_items \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json"

响应示例

{
  "object": "list",
  "data": [
    {
      "object": "eval.run.output_item",
      "id": "outputitem_67e5796c28e081909917bf79f6e6214d",
      "created_at": 1743092076,
      "run_id": "evalrun_67abd54d60ec8190832b46859da808f7",
      "eval_id": "eval_67abd54d9b0081909a86353f6fb9317a",
      "status": "pass",
      "datasource_item_id": 5,
      "datasource_item": {
        "input": "利好经济数据公布后股市上涨",
        "ground_truth": "Markets"
      },
      "results": [
        {
          "name": "String check-a2486074-d803-4445-b431-ad2262e85d47",
          "sample": null,
          "passed": true,
          "score": 1.0
        }
      ],
      "sample": {
        "input": [
          {
            "role": "developer",
            "content": "将给定新闻标题归入以下主题之一:Technology(科技)、Markets(市场)、World(国际)、Business(商业)或 Sports(体育)。\n\n# 步骤\n\n1. 分析新闻标题的内容,理解其主要关注点。\n2. 提取主题,找出关键线索或关键词。\n3. 根据这些线索,从 Technology、Markets、World、Business、Sports 五个选项中选择最合适的类别。\n4. 每个标题只能选择一个类别。\n\n# 输出格式\n\n仅返回所选类别的一个英文单词,例如:\"Technology\"、\"Markets\"、\"World\"、\"Business\" 或 \"Sports\"。\n\n# 示例\n\n**输入**:\"苹果发布搭载先进 AI 功能的新款 iPhone\"  \n**输出**:\"Technology\"\n\n**输入**:\"投资者等待央行决议,全球股市涨跌互现\"  \n**输出**:\"Markets\"\n\n**输入**:\"乌克兰战争:谈判进展最新消息\"  \n**输出**:\"World\"\n\n**输入**:\"微软洽谈以 20 亿美元收购游戏公司\"  \n**输出**:\"Business\"\n\n**输入**:\"曼联赢得英超足球比赛\"  \n**输出**:\"Sports\" \n\n# 注意\n\n- 如果标题似乎符合多个类别,选择最主要的主题。\n- “股票”“公司收购”“比赛”等关键词或短语,以及科技品牌,都可以作为分类线索。\n",
            "tool_call_id": null,
            "tool_calls": null,
            "function_call": null
          },
          {
            "role": "user",
            "content": "利好经济数据公布后股市上涨",
            "tool_call_id": null,
            "tool_calls": null,
            "function_call": null
          }
        ],
        "output": [
          {
            "role": "assistant",
            "content": "Markets",
            "tool_call_id": null,
            "tool_calls": null,
            "function_call": null
          }
        ],
        "finish_reason": "stop",
        "model": "gpt-6-astra",
        "usage": {
          "total_tokens": 325,
          "completion_tokens": 2,
          "prompt_tokens": 323,
          "cached_tokens": 0
        },
        "error": null,
        "temperature": 1.0,
        "max_completion_tokens": 2048,
        "top_p": 1.0,
        "seed": 42
      }
    }
  ],
  "first_id": "outputitem_67e5796c28e081909917bf79f6e6214d",
  "last_id": "outputitem_67e5796c28e081909917bf79f6e6214d",
  "has_more": true
}

获取评测运行的单个输出条目

get /evals/{eval_id}/runs/{run_id}/output_items/{output_item_id}

按 ID 获取评测运行输出条目。

路径参数

  • eval_id: string

要获取其运行列表的评测的 ID。

  • run_id: string

要获取的运行的 ID。

  • output_item_id: string

要获取的输出条目的 ID。

返回值

  • id: string

评测运行输出条目的唯一标识。

  • created_at: integer

评测运行创建时的 Unix 时间戳,单位为秒。

format: unixtime

  • datasource_item: map[unknown]

输入数据源条目的详情。

  • datasource_item_id: integer

数据源条目的标识。

  • eval_id: string

评测组的标识。

  • object: "eval.run.output_item" (default: "eval.run.output_item")

对象类型,固定为 "eval.run.output_item"。

  • "eval.run.output_item"

  • results: array of object { name, passed, score, 2 more }

此输出条目的评分器结果列表。

  • name: string

评分器名称。

  • passed: boolean

评分器是否认为此输出通过。

  • score: number

评分器给出的数值分数。

  • sample: optional map[unknown] or null

评分器生成的可选样本或中间数据。

  • type: optional string

评分器类型,例如 "string-check-grader"。

  • run_id: string

与此输出条目关联的评测运行的标识。

  • sample: object { error, finish_reason, input, 7 more }

包含评测运行输入和输出的样本。

  • error: EvalAPIError or null

表示 Eval API 错误响应的对象。

  • code: string

错误代码。

  • message: string

错误消息。

  • finish_reason: string

样本生成结束的原因。

  • input: array of object { content, role }

输入消息数组。

  • content: string

消息内容。

  • role: string

消息发送者的角色,例如 system、user、developer。

  • max_completion_tokens: integer

允许生成的最大补全词元数。

  • model: string

生成样本使用的模型。

  • output: array of object { content, role }

输出消息数组。

  • content: optional string

消息内容。

  • role: optional string

消息角色,例如 "system"、"assistant"、"user"。

  • seed: integer

生成样本使用的随机种子。

  • temperature: number

使用的采样温度。

  • top_p: number

采样使用的 top_p 值。

  • usage: object { cached_tokens, completion_tokens, prompt_tokens, total_tokens }

样本的词元用量详情。

  • cached_tokens: integer

从缓存读取的词元数。

  • completion_tokens: integer

生成的补全词元数。

  • prompt_tokens: integer

使用的提示词词元数。

  • total_tokens: integer

使用的总词元数。

  • status: string

评测运行状态。

示例

## 设置 OPENAI_API_KEY,并将评测 ID 和运行 ID 替换为实际值。
curl https://api.openai.com/v1/evals/$EVAL_ID/runs/$RUN_ID/output_items/$OUTPUT_ITEM_ID \
    -H "Authorization: Bearer $OPENAI_API_KEY"

200 响应示例

{
  "id": "id",
  "created_at": 0,
  "datasource_item": {
    "foo": "bar"
  },
  "datasource_item_id": 0,
  "eval_id": "eval_id",
  "object": "eval.run.output_item",
  "results": [
    {
      "name": "name",
      "passed": true,
      "score": 0,
      "sample": {
        "foo": "bar"
      },
      "type": "type"
    }
  ],
  "run_id": "run_id",
  "sample": {
    "error": {
      "code": "code",
      "message": "message"
    },
    "finish_reason": "finish_reason",
    "input": [
      {
        "content": "content",
        "role": "role"
      }
    ],
    "max_completion_tokens": 0,
    "model": "model",
    "output": [
      {
        "content": "content",
        "role": "role"
      }
    ],
    "seed": 0,
    "temperature": 0,
    "top_p": 0,
    "usage": {
      "cached_tokens": 0,
      "completion_tokens": 0,
      "prompt_tokens": 0,
      "total_tokens": 0
    }
  },
  "status": "status"
}

示例

## 设置 OPENAI_API_KEY,并将评测 ID 和运行 ID 替换为实际值。
curl https://api.openai.com/v1/evals/eval_67abd54d9b0081909a86353f6fb9317a/runs/evalrun_67abd54d60ec8190832b46859da808f7/output_items/outputitem_67abd55eb6548190bb580745d5644a33 \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json"

响应示例

{
  "object": "eval.run.output_item",
  "id": "outputitem_67e5796c28e081909917bf79f6e6214d",
  "created_at": 1743092076,
  "run_id": "evalrun_67abd54d60ec8190832b46859da808f7",
  "eval_id": "eval_67abd54d9b0081909a86353f6fb9317a",
  "status": "pass",
  "datasource_item_id": 5,
  "datasource_item": {
    "input": "利好经济数据公布后股市上涨",
    "ground_truth": "Markets"
  },
  "results": [
    {
      "name": "String check-a2486074-d803-4445-b431-ad2262e85d47",
      "sample": null,
      "passed": true,
      "score": 1.0
    }
  ],
  "sample": {
    "input": [
      {
        "role": "developer",
        "content": "将给定新闻标题归入以下主题之一:Technology(科技)、Markets(市场)、World(国际)、Business(商业)或 Sports(体育)。\n\n# 步骤\n\n1. 分析新闻标题的内容,理解其主要关注点。\n2. 提取主题,找出关键线索或关键词。\n3. 根据这些线索,从 Technology、Markets、World、Business、Sports 五个选项中选择最合适的类别。\n4. 每个标题只能选择一个类别。\n\n# 输出格式\n\n仅返回所选类别的一个英文单词,例如:\"Technology\"、\"Markets\"、\"World\"、\"Business\" 或 \"Sports\"。\n\n# 示例\n\n**输入**:\"苹果发布搭载先进 AI 功能的新款 iPhone\"  \n**输出**:\"Technology\"\n\n**输入**:\"投资者等待央行决议,全球股市涨跌互现\"  \n**输出**:\"Markets\"\n\n**输入**:\"乌克兰战争:谈判进展最新消息\"  \n**输出**:\"World\"\n\n**输入**:\"微软洽谈以 20 亿美元收购游戏公司\"  \n**输出**:\"Business\"\n\n**输入**:\"曼联赢得英超足球比赛\"  \n**输出**:\"Sports\" \n\n# 注意\n\n- 如果标题似乎符合多个类别,选择最主要的主题。\n- “股票”“公司收购”“比赛”等关键词或短语,以及科技品牌,都可以作为分类线索。\n",
        "tool_call_id": null,
        "tool_calls": null,
        "function_call": null
      },
      {
        "role": "user",
        "content": "利好经济数据公布后股市上涨",
        "tool_call_id": null,
        "tool_calls": null,
        "function_call": null
      }
    ],
    "output": [
      {
        "role": "assistant",
        "content": "Markets",
        "tool_call_id": null,
        "tool_calls": null,
        "function_call": null
      }
    ],
    "finish_reason": "stop",
    "model": "gpt-6-astra",
    "usage": {
      "total_tokens": 325,
      "completion_tokens": 2,
      "prompt_tokens": 323,
      "cached_tokens": 0
    },
    "error": null,
    "temperature": 1.0,
    "max_completion_tokens": 2048,
    "top_p": 1.0,
    "seed": 42
  }
}

资源类型

输出条目列表响应

  • OutputItemListResponse object { id, created_at, datasource_item, 7 more }

表示评测运行输出条目的模式。

  • id: string

评测运行输出条目的唯一标识。

  • created_at: integer

评测运行创建时的 Unix 时间戳,单位为秒。

format: unixtime

  • datasource_item: map[unknown]

输入数据源条目的详情。

  • datasource_item_id: integer

数据源条目的标识。

  • eval_id: string

评测组的标识。

  • object: "eval.run.output_item" (default: "eval.run.output_item")

对象类型,固定为 "eval.run.output_item"。

  • "eval.run.output_item"

  • results: array of object { name, passed, score, 2 more }

此输出条目的评分器结果列表。

  • name: string

评分器名称。

  • passed: boolean

评分器是否认为此输出通过。

  • score: number

评分器给出的数值分数。

  • sample: optional map[unknown] or null

评分器生成的可选样本或中间数据。

  • type: optional string

评分器类型,例如 "string-check-grader"。

  • run_id: string

与此输出条目关联的评测运行的标识。

  • sample: object { error, finish_reason, input, 7 more }

包含评测运行输入和输出的样本。

  • error: EvalAPIError or null

表示 Eval API 错误响应的对象。

  • code: string

错误代码。

  • message: string

错误消息。

  • finish_reason: string

样本生成结束的原因。

  • input: array of object { content, role }

输入消息数组。

  • content: string

消息内容。

  • role: string

消息发送者的角色,例如 system、user、developer。

  • max_completion_tokens: integer

允许生成的最大补全词元数。

  • model: string

生成样本使用的模型。

  • output: array of object { content, role }

输出消息数组。

  • content: optional string

消息内容。

  • role: optional string

消息角色,例如 "system"、"assistant"、"user"。

  • seed: integer

生成样本使用的随机种子。

  • temperature: number

使用的采样温度。

  • top_p: number

采样使用的 top_p 值。

  • usage: object { cached_tokens, completion_tokens, prompt_tokens, total_tokens }

样本的词元用量详情。

  • cached_tokens: integer

从缓存读取的词元数。

  • completion_tokens: integer

生成的补全词元数。

  • prompt_tokens: integer

使用的提示词词元数。

  • total_tokens: integer

使用的总词元数。

  • status: string

评测运行状态。

输出条目获取响应

  • OutputItemRetrieveResponse object { id, created_at, datasource_item, 7 more }

表示评测运行输出条目的模式。

  • id: string

评测运行输出条目的唯一标识。

  • created_at: integer

评测运行创建时的 Unix 时间戳,单位为秒。

format: unixtime

  • datasource_item: map[unknown]

输入数据源条目的详情。

  • datasource_item_id: integer

数据源条目的标识。

  • eval_id: string

评测组的标识。

  • object: "eval.run.output_item" (default: "eval.run.output_item")

对象类型,固定为 "eval.run.output_item"。

  • "eval.run.output_item"

  • results: array of object { name, passed, score, 2 more }

此输出条目的评分器结果列表。

  • name: string

评分器名称。

  • passed: boolean

评分器是否认为此输出通过。

  • score: number

评分器给出的数值分数。

  • sample: optional map[unknown] or null

评分器生成的可选样本或中间数据。

  • type: optional string

评分器类型,例如 "string-check-grader"。

  • run_id: string

与此输出条目关联的评测运行的标识。

  • sample: object { error, finish_reason, input, 7 more }

包含评测运行输入和输出的样本。

  • error: EvalAPIError or null

表示 Eval API 错误响应的对象。

  • code: string

错误代码。

  • message: string

错误消息。

  • finish_reason: string

样本生成结束的原因。

  • input: array of object { content, role }

输入消息数组。

  • content: string

消息内容。

  • role: string

消息发送者的角色,例如 system、user、developer。

  • max_completion_tokens: integer

允许生成的最大补全词元数。

  • model: string

生成样本使用的模型。

  • output: array of object { content, role }

输出消息数组。

  • content: optional string

消息内容。

  • role: optional string

消息角色,例如 "system"、"assistant"、"user"。

  • seed: integer

生成样本使用的随机种子。

  • temperature: number

使用的采样温度。

  • top_p: number

采样使用的 top_p 值。

  • usage: object { cached_tokens, completion_tokens, prompt_tokens, total_tokens }

样本的词元用量详情。

  • cached_tokens: integer

从缓存读取的词元数。

  • completion_tokens: integer

生成的补全词元数。

  • prompt_tokens: integer

使用的提示词词元数。

  • total_tokens: integer

使用的总词元数。

  • status: string

评测运行状态。

以上内容是否对您有帮助:
在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号