创建聊天

POST /v1/chat/completions

MethodPOST
Path/v1/chat/completions
Typehttp
Status-2
Module2102810
Folder45008044

概览

MethodPOST
Path/v1/chat/completions
Typehttp
Status-2
Module2102810
Folder45008044

参数

{
  "query": [],
  "header": [
    {
      "required": false,
      "description": "",
      "type": "string",
      "id": "f0mtN2mjsY",
      "enable": true,
      "name": "Content-Type",
      "sampleValue": "application/json"
    },
    {
      "required": false,
      "description": "",
      "type": "string",
      "id": "qsGKYUUCpS",
      "enable": true,
      "name": "Accept",
      "sampleValue": "application/json"
    },
    {
      "required": false,
      "description": "",
      "type": "string",
      "id": "n12LMeLcmH",
      "enable": true,
      "name": "Authorization",
      "sampleValue": "Bearer {{YOUR_API_KEY}}"
    },
    {
      "required": false,
      "description": "",
      "type": "string",
      "id": "KPudQumdqF",
      "enable": true,
      "name": "X-Forwarded-HoAPP-Codest",
      "sampleValue": "localhost:5173"
    }
  ]
}

请求体

{
  "type": "application/json",
  "parameters": [],
  "jsonSchema": {
    "$schema": "http://json-schema.org/draft-07/schema#",
    "title": "对话接口 POST /v1/chat/completions",
    "description": "仅多轮对话场景,对应 dto.GeneralOpenAIRequest 的对话相关字段。必填:model、messages(非空)。鉴权:Authorization: Bearer {API Key}。",
    "type": "object",
    "required": [
      "model",
      "messages"
    ],
    "x-apifox-orders": [
      "model",
      "messages",
      "stream",
      "stream_options",
      "max_tokens",
      "max_completion_tokens",
      "temperature",
      "top_p",
      "n",
      "stop",
      "presence_penalty",
      "frequency_penalty",
      "logit_bias",
      "seed",
      "user",
      "response_format",
      "tools",
      "tool_choice",
      "parallel_tool_calls",
      "reasoning_effort",
      "enable_thinking",
      "extra_body",
      "web_search_options"
    ],
    "properties": {
      "model": {
        "type": "string",
        "description": "要使用的模型 ID。网关会按令牌分组选择渠道,并可能做模型名映射或后缀解析(如 -thinking、-search)。"
      },
      "messages": {
        "type": "array",
        "minItems": 1,
        "description": "对话消息列表,至少一条。支持多轮:system / user / assistant / tool。",
        "items": {
          "$ref": "#/$defs/Message"
        }
      },
      "stream": {
        "type": "boolean",
        "default": false,
        "description": "是否流式输出。false:一次返回完整 JSON;true:SSE 增量推送,结束为 data: [DONE]。"
      },
      "stream_options": {
        "$ref": "#/$defs/StreamOptions",
        "description": "流式时的附加选项,例如是否在流末尾返回 token 用量。"
      },
      "max_tokens": {
        "type": "integer",
        "minimum": 0,
        "description": "本次回复最多生成的 token 数(常用字段)。"
      },
      "max_completion_tokens": {
        "type": "integer",
        "minimum": 0,
        "description": "补全 token 上限(o 系、GPT-5 等推理模型更常用)。未设置时可能沿用 max_tokens。"
      },
      "temperature": {
        "type": "number",
        "description": "采样温度,通常 0~2。值越高回复越随机,越低越稳定。与 top_p 一般只调一个。"
      },
      "top_p": {
        "type": "number",
        "description": "核采样,0~1。只从累计概率达到 top_p 的 token 中采样。"
      },
      "n": {
        "type": "integer",
        "minimum": 1,
        "default": 1,
        "description": "对同一轮输入生成几条 assistant 回复候选。"
      },
      "stop": {
        "description": "遇到这些字符串时停止生成。可为单个字符串或字符串数组(最多 4 个)。",
        "oneOf": [
          {
            "type": "string"
          },
          {
            "type": "array",
            "items": {
              "type": "string"
            },
            "maxItems": 4
          }
        ]
      },
      "presence_penalty": {
        "type": "number",
        "description": "存在惩罚,约 -2~2。正值减少重复已出现过的主题表述。"
      },
      "frequency_penalty": {
        "type": "number",
        "description": "频率惩罚,约 -2~2。正值降低重复相同词句的概率。"
      },
      "logit_bias": {
        "type": "object",
        "additionalProperties": {
          "type": "number"
        },
        "description": "按 token ID 调整出现概率,取值为 -100~100 的映射对象。",
        "x-apifox-orders": [],
        "properties": {}
      },
      "seed": {
        "type": "number",
        "description": "随机种子,在相同参数下尽量得到可复现结果(不保证完全一致)。注意字段名为 seed。"
      },
      "user": {
        "type": "string",
        "description": "终端用户唯一标识,便于平台侧滥用检测与统计。"
      },
      "response_format": {
        "$ref": "#/$defs/ResponseFormat",
        "description": "约束模型输出格式,例如 JSON 模式。使用 json_object 时请在消息中明确要求输出 JSON。"
      },
      "tools": {
        "type": "array",
        "description": "模型可调用的工具(函数)列表,用于对话中的 function calling。",
        "items": {
          "$ref": "#/$defs/Tool"
        }
      },
      "tool_choice": {
        "description": "控制是否调用工具:none(不调用)、auto(自动)、required(必须调用),或指定某个函数。",
        "oneOf": [
          {
            "type": "string",
            "enum": [
              "none",
              "auto",
              "required"
            ]
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "const": "function"
              },
              "function": {
                "type": "object",
                "required": [
                  "name"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "强制调用的函数名。"
                  }
                },
                "x-apifox-orders": [
                  "name"
                ]
              }
            },
            "x-apifox-orders": [
              "type",
              "function"
            ]
          }
        ]
      },
      "parallel_tool_calls": {
        "type": "boolean",
        "description": "是否允许在一次回复中并行发起多个工具调用(上游支持时)。"
      },
      "reasoning_effort": {
        "type": "string",
        "description": "推理模型力度(如 low / medium / high)。也可通过模型名后缀由网关自动注入。"
      },
      "enable_thinking": {
        "type": "boolean",
        "description": "是否开启思考模式(本仓库扩展)。仅布尔值 true 生效;与 extra_body.enable_thinking 二选一即可。"
      },
      "extra_body": {
        "type": "object",
        "additionalProperties": true,
        "description": "对话扩展参数。常用:enable_thinking;部分 Gemini 模型可用 google.thinking_config 等。是否生效取决于渠道与模型。",
        "properties": {
          "enable_thinking": {
            "type": "boolean",
            "description": "在 extra_body 中开启思考模式,仅 true 有效。"
          },
          "google": {
            "type": "object",
            "additionalProperties": true,
            "description": "Gemini 对话扩展,如 thinking_config、response_modalities。",
            "x-apifox-orders": [],
            "properties": {}
          }
        },
        "x-apifox-orders": [
          "enable_thinking",
          "google"
        ]
      },
      "web_search_options": {
        "$ref": "#/$defs/WebSearchOptions",
        "description": "支持联网的模型使用的搜索选项(如 OpenAI 联网类能力)。"
      }
    },
    "$defs": {
      "Message": {
        "type": "object",
        "required": [
          "role",
          "content"
        ],
        "properties": {
          "role": {
            "type": "string",
            "enum": [
              "system",
              "user",
              "assistant",
              "tool",
              "developer"
            ],
            "description": "消息角色。system:系统设定;user:用户;assistant:模型;tool:工具返回结果。"
          },
          "content": {
            "description": "消息内容:纯文本,或图文混合数组(见 ContentPart)。",
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "$ref": "#/$defs/ContentPart"
                }
              }
            ]
          },
          "name": {
            "type": "string",
            "description": "可选。多用户场景下区分发言者名称。"
          },
          "tool_calls": {
            "type": "array",
            "description": "assistant 消息中的工具调用请求列表(由模型发起)。",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "调用 ID,tool 消息需用 tool_call_id 对应。"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "function"
                  ]
                },
                "function": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "arguments": {
                      "type": "string",
                      "description": "JSON 字符串形式的参数。"
                    }
                  },
                  "x-apifox-orders": [
                    "name",
                    "arguments"
                  ]
                }
              },
              "x-apifox-orders": [
                "id",
                "type",
                "function"
              ]
            }
          },
          "tool_call_id": {
            "type": "string",
            "description": "role 为 tool 时必填,对应某次 tool_calls[].id 的返回内容。"
          },
          "reasoning_content": {
            "type": "string",
            "description": "推理/思考过程文本(推理模型、续写上下文时使用)。"
          }
        },
        "x-apifox-orders": [
          "role",
          "content",
          "name",
          "tool_calls",
          "tool_call_id",
          "reasoning_content"
        ]
      },
      "ContentPart": {
        "type": "object",
        "required": [
          "type"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "text",
              "image_url"
            ],
            "description": "内容块类型:text 文本,image_url 图片。"
          },
          "text": {
            "type": "string",
            "description": "type=text 时的文本内容。"
          },
          "image_url": {
            "type": "object",
            "required": [
              "url"
            ],
            "properties": {
              "url": {
                "type": "string",
                "description": "图片 URL 或 data:image/...;base64,... 。"
              },
              "detail": {
                "type": "string",
                "enum": [
                  "auto",
                  "low",
                  "high"
                ],
                "description": "图像理解精度:auto / low / high。"
              }
            },
            "description": "type=image_url 时的图片。若网关开启图片代理,url 可能被替换。",
            "x-apifox-orders": [
              "url",
              "detail"
            ]
          }
        },
        "x-apifox-orders": [
          "type",
          "text",
          "image_url"
        ]
      },
      "Tool": {
        "type": "object",
        "required": [
          "type",
          "function"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "function"
            ],
            "description": "固定为 function。"
          },
          "function": {
            "type": "object",
            "required": [
              "name"
            ],
            "properties": {
              "name": {
                "type": "string",
                "description": "函数名称,模型通过此名称发起调用。"
              },
              "description": {
                "type": "string",
                "description": "函数用途说明,帮助模型决定何时调用。"
              },
              "parameters": {
                "type": "object",
                "description": "函数参数的 JSON Schema。",
                "x-apifox-orders": []
              }
            },
            "x-apifox-orders": [
              "name",
              "description",
              "parameters"
            ]
          }
        },
        "x-apifox-orders": [
          "type",
          "function"
        ]
      },
      "StreamOptions": {
        "type": "object",
        "properties": {
          "include_usage": {
            "type": "boolean",
            "description": "流式结束时是否附带 usage(prompt/completion tokens)。"
          }
        },
        "x-apifox-orders": [
          "include_usage"
        ]
      },
      "ResponseFormat": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "text",
              "json_object",
              "json_schema"
            ],
            "description": "text:普通文本;json_object:JSON 对象;json_schema:按 schema 结构化输出。"
          },
          "json_schema": {
            "type": "object",
            "description": "type=json_schema 时的输出结构定义。",
            "x-apifox-orders": []
          }
        },
        "x-apifox-orders": [
          "type",
          "json_schema"
        ]
      },
      "WebSearchOptions": {
        "type": "object",
        "properties": {
          "search_context_size": {
            "type": "string",
            "enum": [
              "high",
              "medium",
              "low"
            ],
            "description": "联网搜索上下文规模;未传时网关默认 medium。"
          },
          "user_location": {
            "type": "object",
            "description": "用户地理位置等,用于本地化搜索结果(结构依上游而定)。",
            "x-apifox-orders": []
          }
        },
        "x-apifox-orders": [
          "search_context_size",
          "user_location"
        ]
      }
    },
    "examples": [
      {
        "model": "gpt-4o",
        "messages": [
          {
            "role": "system",
            "content": "你是一个有帮助的助手。"
          },
          {
            "role": "user",
            "content": "你好"
          }
        ]
      },
      {
        "model": "gpt-4o",
        "stream": true,
        "stream_options": {
          "include_usage": true
        },
        "messages": [
          {
            "role": "user",
            "content": "讲一个短笑话"
          }
        ]
      }
    ]
  },
  "required": true,
  "mediaType": "",
  "examples": [
    {
      "mediaType": "application/json",
      "value": "{\r\n  \"model\": \"gpt-4o\",\r\n  \"messages\": [\r\n    {\r\n      \"role\": \"system\",\r\n      \"content\": \"你是一个乐于助人的猫娘。\"\r\n    },\r\n    {\r\n      \"role\": \"user\",\r\n      \"content\": \"帮我总结一下HTTP是什么。\"\r\n    }\r\n  ]\r\n}",
      "name": "新手推荐:基础对话(非流)",
      "description": ""
    },
    {
      "name": "新手推荐:流式对话 · stream + stream_options.include_usage",
      "value": "{\r\n    \"model\": \"gpt-4o\",\r\n    \"stream\": true,\r\n    \"stream_options\": {\r\n        \"include_usage\": true\r\n    },\r\n    \"messages\": [\r\n        {\r\n            \"role\": \"user\",\r\n            \"content\": \"用 3 句话解释什么是token,并给一个例子。\"\r\n        }\r\n    ]\r\n}",
      "mediaType": "application/json"
    },
    {
      "name": "进阶推荐:采样控制:temperature + top_p + stop",
      "value": "{\r\n    \"model\": \"gpt-4o\",\r\n    \"temperature\": 0.4,\r\n    \"top_p\": 0.9,\r\n    \"stop\": [\r\n        \"\\n\\n\",\r\n        \"STOP\"\r\n    ],\r\n    \"messages\": [\r\n        {\r\n            \"role\": \"user\",\r\n            \"content\": \"写一段不超过200字的产品文案,遇到STOP就停止。\"\r\n        }\r\n    ]\r\n}",
      "mediaType": "application/json"
    },
    {
      "name": "进阶推荐:工具调用(tools + tool_choice)",
      "value": "{\r\n    \"model\": \"gpt-4o\",\r\n    \"tool_choice\": \"auto\",\r\n    \"tools\": [\r\n        {\r\n            \"type\": \"function\",\r\n            \"function\": {\r\n                \"name\": \"get_weather\",\r\n                \"description\": \"获取指定城市的天气\",\r\n                \"parameters\": {\r\n                    \"type\": \"object\",\r\n                    \"properties\": {\r\n                        \"city\": {\r\n                            \"type\": \"string\",\r\n                            \"description\": \"城市名\"\r\n                        }\r\n                    },\r\n                    \"required\": [\r\n                        \"city\"\r\n                    ]\r\n                }\r\n            }\r\n        }\r\n    ],\r\n    \"messages\": [\r\n        {\r\n            \"role\": \"user\",\r\n            \"content\": \"北京今天的天气怎么样?\"\r\n        }\r\n    ]\r\n}",
      "mediaType": "application/json"
    },
    {
      "name": "进阶推荐:强制结构化输出(response_format)",
      "value": "{\r\n    \"model\": \"gpt-4o\",\r\n    \"response_format\": {\r\n        \"type\": \"json_object\"\r\n    },\r\n    \"messages\": [\r\n        {\r\n            \"role\": \"user\",\r\n            \"content\": \"输出一个JSON:{ \\\"title\\\": \\\"...\\\", \\\"bullets\\\": [\\\"...\\\", \\\"...\\\"] },不要输出多余文本。主题是“如何写接口文档”。\"\r\n        }\r\n    ]\r\n}",
      "mediaType": "application/json"
    },
    {
      "name": "进阶推荐:用思考模式(enable_thinking / extra_body.enable_thinking)",
      "value": "{\r\n    \"model\": \"qwen-max\",\r\n    \"extra_body\": {\r\n        \"enable_thinking\": true\r\n    },\r\n    \"messages\": [\r\n        {\r\n            \"role\": \"user\",\r\n            \"content\": \"计算:如果一个系统每秒处理 120 请求,5分钟能处理多少?给出过程。\"\r\n        }\r\n    ]\r\n}",
      "mediaType": "application/json"
    },
    {
      "name": "进阶推荐:多模态示例:messages.content 里带图片(image_url",
      "value": "{\r\n    \"model\": \"gpt-4o\",\r\n    \"messages\": [\r\n        {\r\n            \"role\": \"user\",\r\n            \"content\": [\r\n                {\r\n                    \"type\": \"text\",\r\n                    \"text\": \"这张图里是什么?请用中文描述并给出可能的场景。\"\r\n                },\r\n                {\r\n                    \"type\": \"image_url\",\r\n                    \"image_url\": {\r\n                        \"url\": \"https://example.com/image.jpg\",\r\n                        \"detail\": \"high\"\r\n                    }\r\n                }\r\n            ]\r\n        }\r\n    ]\r\n}",
      "mediaType": "application/json"
    },
    {
      "name": "进阶推荐:联网/搜索选项(web_search_options)",
      "value": "{\r\n    \"model\": \"gpt-4o\",\r\n    \"web_search_options\": {\r\n        \"search_context_size\": \"medium\"\r\n    },\r\n    \"messages\": [\r\n        {\r\n            \"role\": \"user\",\r\n            \"content\": \"近期有哪些关于AI代理的高质量文章?给我3条并简要说明。\"\r\n        }\r\n    ]\r\n}",
      "mediaType": "application/json"
    },
    {
      "name": "进阶推荐:图文对话(流式)· stream + image_url.url",
      "value": "{\r\n    \"model\": \"gpt-4o\",\r\n    \"stream\": true,\r\n    \"messages\": [\r\n        {\r\n            \"role\": \"user\",\r\n            \"content\": [\r\n                {\r\n                    \"type\": \"text\",\r\n                    \"text\": \"请用中文描述这张图片。\"\r\n                },\r\n                {\r\n                    \"type\": \"image_url\",\r\n                    \"image_url\": {\r\n                        \"url\": \"https://example.com/demo.jpg\",\r\n                        \"detail\": \"high\"\r\n                    }\r\n                }\r\n            ]\r\n        }\r\n    ]\r\n}",
      "mediaType": "application/json"
    },
    {
      "name": "进阶推荐:图文对话(流式)· stream + image_url(base64)",
      "value": "{\r\n  \"model\": \"gpt-4o\",\r\n  \"stream\": true,\r\n  \"messages\": [\r\n    {\r\n      \"role\": \"user\",\r\n      \"content\": [\r\n        {\r\n          \"type\": \"text\",\r\n          \"text\": \"图中文字是什么?\"\r\n        },\r\n        {\r\n          \"type\": \"image_url\",\r\n          \"image_url\": {\r\n            \"url\": \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==\",\r\n            \"detail\": \"auto\"\r\n          }\r\n        }\r\n      ]\r\n    }\r\n  ]\r\n}",
      "mediaType": "application/json"
    },
    {
      "name": "新手推荐:图文对话(非流式)· messages[].content + image_url.url",
      "value": "{\r\n    \"model\": \"gpt-4o\",\r\n    \"stream\": false,\r\n    \"messages\": [\r\n        {\r\n            \"role\": \"user\",\r\n            \"content\": [\r\n                {\r\n                    \"type\": \"text\",\r\n                    \"text\": \"总结图片内容,分点回答。\"\r\n                },\r\n                {\r\n                    \"type\": \"image_url\",\r\n                    \"image_url\": {\r\n                        \"url\": \"https://example.com/demo.jpg\",\r\n                        \"detail\": \"high\"\r\n                    }\r\n                }\r\n            ]\r\n        }\r\n    ]\r\n}",
      "mediaType": "application/json"
    },
    {
      "name": "进阶推荐:对话生图(非流式)· extra_body.google.response_modalities + image_config",
      "value": "{\r\n    \"model\": \"gpt-4o\",\r\n    \"stream\": false,\r\n    \"messages\": [\r\n        {\r\n            \"role\": \"user\",\r\n            \"content\": [\r\n                {\r\n                    \"type\": \"text\",\r\n                    \"text\": \"总结图片内容,分点回答。\"\r\n                },\r\n                {\r\n                    \"type\": \"image_url\",\r\n                    \"image_url\": {\r\n                        \"url\": \"https://example.com/demo.jpg\",\r\n                        \"detail\": \"high\"\r\n                    }\r\n                }\r\n            ]\r\n        }\r\n    ]\r\n}",
      "mediaType": "application/json"
    },
    {
      "name": "进阶推荐:多候选回复 · n",
      "value": "{\r\n    \"model\": \"gpt-4o\",\r\n    \"n\": 2,\r\n    \"temperature\": 0.8,\r\n    \"max_tokens\": 256,\r\n    \"messages\": [\r\n        {\r\n            \"role\": \"user\",\r\n            \"content\": \"用一句话介绍什么是 API 网关。\"\r\n        }\r\n    ]\r\n}",
      "mediaType": "application/json"
    },
    {
      "name": "进阶推荐:Function Calling(旧版)· functions + tool_choice",
      "value": "{\r\n    \"model\": \"gpt-4o\",\r\n    \"messages\": [\r\n        {\r\n            \"role\": \"user\",\r\n            \"content\": \"北京现在天气怎么样?\"\r\n        }\r\n    ],\r\n    \"functions\": [\r\n        {\r\n            \"name\": \"get_weather\",\r\n            \"description\": \"查询城市天气\",\r\n            \"parameters\": {\r\n                \"type\": \"object\",\r\n                \"properties\": {\r\n                    \"city\": {\r\n                        \"type\": \"string\",\r\n                        \"description\": \"城市名\"\r\n                    }\r\n                },\r\n                \"required\": [\r\n                    \"city\"\r\n                ]\r\n            }\r\n        }\r\n    ],\r\n    \"tool_choice\": \"auto\"\r\n}",
      "mediaType": "application/json"
    },
    {
      "name": "进阶推荐:控制推理模型努力程度(reasoning_effort)",
      "value": "{\r\n    \"model\": \"o3-mini\",\r\n    \"reasoning_effort\": \"high\",\r\n    \"max_completion_tokens\": 2000,\r\n    \"messages\": [\r\n        {\r\n            \"role\": \"user\",\r\n            \"content\": \"证明:若 n 为奇数,则 n² 也为奇数。请分步推理。\"\r\n        }\r\n    ]\r\n}",
      "mediaType": "application/json"
    },
    {
      "name": "进阶推荐:机器翻译 · model(qwen-mt) + messages",
      "value": "{\r\n    \"model\": \"qwen-mt-turbo\",\r\n    \"stream\": false,\r\n    \"messages\": [\r\n        {\r\n            \"role\": \"user\",\r\n            \"content\": \"请将下面英文翻译成简体中文,只输出译文:\\n\\nHello, welcome to our API platform.\"\r\n        }\r\n    ]\r\n}",
      "mediaType": "application/json"
    },
    {
      "name": "进阶推荐:DeepSeek 推理对话(流式)· stream + extra_body.enable_thinking",
      "value": "{\r\n    \"model\": \"deepseek-chat\",\r\n    \"stream\": true,\r\n    \"stream_options\": {\r\n        \"include_usage\": true\r\n    },\r\n    \"messages\": [\r\n        {\r\n            \"role\": \"user\",\r\n            \"content\": \"有三个盒子,只有一个里面有奖品。你选 2 号,主持人打开 3 号(空),问要不要改选 1 号?分析并给建议。\"\r\n        }\r\n    ],\r\n    \"extra_body\": {\r\n        \"enable_thinking\": true\r\n    }\r\n}",
      "mediaType": "application/json"
    },
    {
      "name": "进阶推荐:DeepSeek-OCR 识文 · image_url + 识图提示词",
      "value": "{\r\n    \"model\": \"deepseek-ocr\",\r\n    \"stream\": false,\r\n    \"messages\": [\r\n        {\r\n            \"role\": \"user\",\r\n            \"content\": [\r\n                {\r\n                    \"type\": \"text\",\r\n                    \"text\": \"请识别图片中的全部文字,按原文顺序输出,不要解释。\"\r\n                },\r\n                {\r\n                    \"type\": \"image_url\",\r\n                    \"image_url\": {\r\n                        \"url\": \"https://example.com/document-scan.png\",\r\n                        \"detail\": \"high\"\r\n                    }\r\n                }\r\n            ]\r\n        }\r\n    ]\r\n}",
      "mediaType": "application/json"
    }
  ],
  "oasExtensions": ""
}

响应

[
  {
    "id": 127336590,
    "name": "成功",
    "code": 200,
    "contentType": "json",
    "jsonSchema": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "object": {
          "type": "string"
        },
        "created": {
          "type": "integer"
        },
        "model": {
          "type": "string"
        },
        "choices": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "index": {
                "type": "integer"
              },
              "message": {
                "type": "object",
                "properties": {
                  "role": {
                    "type": "string"
                  },
                  "content": {
                    "type": "string"
                  },
                  "refusal": {
                    "type": "null"
                  },
                  "annotations": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "role",
                  "content",
                  "refusal",
                  "annotations"
                ],
                "x-apifox-orders": [
                  "role",
                  "content",
                  "refusal",
                  "annotations"
                ]
              },
              "logprobs": {
                "type": "null"
              },
              "finish_reason": {
                "type": "string"
              }
            },
            "x-apifox-orders": [
              "index",
              "message",
              "logprobs",
              "finish_reason"
            ]
          }
        },
        "usage": {
          "type": "object",
          "properties": {
            "prompt_tokens": {
              "type": "integer"
            },
            "completion_tokens": {
              "type": "integer"
            },
            "total_tokens": {
              "type": "integer"
            },
            "prompt_tokens_details": {
              "type": "object",
              "properties": {
                "cached_tokens": {
                  "type": "integer"
                },
                "audio_tokens": {
                  "type": "integer"
                }
              },
              "required": [
                "cached_tokens",
                "audio_tokens"
              ],
              "x-apifox-orders": [
                "cached_tokens",
                "audio_tokens"
              ]
            },
            "completion_tokens_details": {
              "type": "object",
              "properties": {
                "reasoning_tokens": {
                  "type": "integer"
                },
                "audio_tokens": {
                  "type": "integer"
                },
                "accepted_prediction_tokens": {
                  "type": "integer"
                },
                "rejected_prediction_tokens": {
                  "type": "integer"
                }
              },
              "required": [
                "reasoning_tokens",
                "audio_tokens",
                "accepted_prediction_tokens",
                "rejected_prediction_tokens"
              ],
              "x-apifox-orders": [
                "reasoning_tokens",
                "audio_tokens",
                "accepted_prediction_tokens",
                "rejected_prediction_tokens"
              ]
            },
            "latency_checkpoint": {
              "type": "object",
              "properties": {
                "engine_tbt_ms": {
                  "type": "integer"
                },
                "engine_ttft_ms": {
                  "type": "integer"
                },
                "engine_ttlt_ms": {
                  "type": "integer"
                },
                "pre_inference_ms": {
                  "type": "integer"
                },
                "service_tbt_ms": {
                  "type": "integer"
                },
                "service_ttft_ms": {
                  "type": "integer"
                },
                "service_ttlt_ms": {
                  "type": "integer"
                },
                "total_duration_ms": {
                  "type": "integer"
                },
                "user_visible_ttft_ms": {
                  "type": "integer"
                }
              },
              "required": [
                "engine_tbt_ms",
                "engine_ttft_ms",
                "engine_ttlt_ms",
                "pre_inference_ms",
                "service_tbt_ms",
                "service_ttft_ms",
                "service_ttlt_ms",
                "total_duration_ms",
                "user_visible_ttft_ms"
              ],
              "x-apifox-orders": [
                "engine_tbt_ms",
                "engine_ttft_ms",
                "engine_ttlt_ms",
                "pre_inference_ms",
                "service_tbt_ms",
                "service_ttft_ms",
                "service_ttlt_ms",
                "total_duration_ms",
                "user_visible_ttft_ms"
              ]
            }
          },
          "required": [
            "prompt_tokens",
            "completion_tokens",
            "total_tokens",
            "prompt_tokens_details",
            "completion_tokens_details",
            "latency_checkpoint"
          ],
          "x-apifox-orders": [
            "prompt_tokens",
            "completion_tokens",
            "total_tokens",
            "prompt_tokens_details",
            "completion_tokens_details",
            "latency_checkpoint"
          ]
        },
        "system_fingerprint": {
          "type": "string"
        },
        "service_tier": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "object",
        "created",
        "model",
        "choices",
        "usage",
        "system_fingerprint",
        "service_tier"
      ],
      "x-apifox-orders": [
        "id",
        "object",
        "created",
        "model",
        "choices",
        "usage",
        "system_fingerprint",
        "service_tier"
      ]
    },
    "itemSchema": {},
    "description": "",
    "mediaType": "",
    "headers": []
  }
]

响应示例

[
  {
    "name": "最简请求(非流)",
    "responseId": 127336590,
    "data": "{\r\n    \"id\": \"chatcmpl-Dk413e7APldPf4BwB44tzOyNKBHV0\",\r\n    \"object\": \"chat.completion\",\r\n    \"created\": 1779870897,\r\n    \"model\": \"gpt-4o\",\r\n    \"choices\": [\r\n        {\r\n            \"index\": 0,\r\n            \"message\": {\r\n                \"role\": \"assistant\",\r\n                \"content\": \"好的喵~ \\\\(>ω<\\\\) 简单来说,HTTP(HyperText Transfer Protocol)是一种**超文本传输协议**,是用来在客户端(比如浏览器)和服务器之间传输数据的规则喵!\\n\\n以下是关键点总结:  \\n\\n1. **无状态协议**:HTTP是无状态的,每次请求互相独立,服务器不会记住之前的请求喵。\\n2. **基于请求-响应模型**:客户端发送请求,服务器返回响应。  \\n3. **工作在应用层**:HTTP是互联网的核心通信协议之一,主要用于传输网页等资源。  \\n4. **版本**:HTTP有多个版本:\\n   - HTTP/1.0、HTTP/1.1(经典版本,广泛使用)。\\n   - HTTP/2(性能更好,多路复用)。\\n   - HTTP/3(基于QUIC协议,更快更安全喵~)。  \\n5. **无处不在**:HTTP支持各种数据格式,不仅传输文字,还支持图片、视频、JSON等。  \\n\\n总的来说,HTTP就是为了让你的浏览器和服务器\\\"聊天\\\"而存在的喵~ (>^ω^<) ⛺\",\r\n                \"refusal\": null,\r\n                \"annotations\": []\r\n            },\r\n            \"logprobs\": null,\r\n            \"finish_reason\": \"stop\"\r\n        }\r\n    ],\r\n    \"usage\": {\r\n        \"prompt_tokens\": 23,\r\n        \"completion_tokens\": 264,\r\n        \"total_tokens\": 287,\r\n        \"prompt_tokens_details\": {\r\n            \"cached_tokens\": 0,\r\n            \"audio_tokens\": 0\r\n        },\r\n        \"completion_tokens_details\": {\r\n            \"reasoning_tokens\": 0,\r\n            \"audio_tokens\": 0,\r\n            \"accepted_prediction_tokens\": 0,\r\n            \"rejected_prediction_tokens\": 0\r\n        },\r\n        \"latency_checkpoint\": {\r\n            \"engine_tbt_ms\": 36,\r\n            \"engine_ttft_ms\": 102,\r\n            \"engine_ttlt_ms\": 9598,\r\n            \"pre_inference_ms\": 67,\r\n            \"service_tbt_ms\": 36,\r\n            \"service_ttft_ms\": 337,\r\n            \"service_ttlt_ms\": 9831,\r\n            \"total_duration_ms\": 9771,\r\n            \"user_visible_ttft_ms\": 270\r\n        }\r\n    },\r\n    \"system_fingerprint\": \"fp_af7f7349a4\",\r\n    \"service_tier\": \"default\"\r\n}",
    "id": "019e68b0-adcb-74ad-8698-699f27d1a850"
  }
]