1. 聊天(Response)
ModelPort.AI 接口文档
  • 快速开始
    • 平台简介
    • 控制台(入门)
    • API key
    • Base URL
  • AI大模型接口
    • 图像
      • GPT Image 2
      • Kwai-Kolors
      • flux-kontext-max
      • grok-imagine-image
    • 视频
      • 通用视频生成接口
      • 豆包视频
        • 文生视频示例
        • 图生视频示例
        • 查询单个任务
        • Seedance-2.0系列
      • grok视频
      • Agnes-Video
        • Agnes-Video
        • Agnes-Video查询
    • OpenAI格式(支持各大原厂模型)
      • 聊天(Response)
        • 创建模型响应
          POST
        • 创建网络搜索
          POST
        • 创建模型响应 gpt-5启用思考
          POST
        • 创建函数调用
          POST
        • 创建模型响应(流式返回)
          POST
        • 创建模型响应 (控制思考长度)
          POST
    • Anthropic格式
      • Anthropic简介
      • 聊天
      • 聊天(深度思考)
      • 聊天(新模型-深度思考)
      • 流式返回
      • 工具调用(function call)
      • 分析图片
    • 谷歌Gemini接口
      • Gemini API
      • 文本
        • 聊天
        • 文本生成-流
      • 图片NanoBanana
        • Nano Banana
        • OpenAI请求方式
          • 生成图片
          • 编辑图像
        • Gemini请求方式
          • 生成图片
          • 编辑图片
      • 视频Veo
        • Veo
      • 文档理解
    • Rerank重排序模型
      • 重排序
    • 文生音乐Suno
      • 生成歌曲(灵感模式)
      • 生成歌词
      • 查询单个任务
      • 查询批量任务
    • Midjourney格式
      • Midjourney简介
  • 素材资产
    • CreateAssetGroup
      POST
    • CreateAsset
      POST
    • GetAsset
      POST
  1. 聊天(Response)

创建函数调用

开发中
POST
/v1/responses
https://platform.openai.com/docs/api-reference/responses/create
部分OpenAI模型仅支持Response格式,例如o3-pro,codex-mini-latest

请求参数

Header 参数

Body 参数application/json

示例
{
    "input": [
        {
            "role": "user",
            "content": "请同时帮我做以下几件事:\n1. 获取当前系统时间\n2. 查看系统信息(操作系统、内存等)\n3. 帮我计算 123.5 + 456.7 的结果\n4. 生成3个1-100之间的随机数\n\n这是一个并行工具调用测试,请同时执行这些任务。"
        }
    ],
    "metadata": {
        "model_id": "32"
    },
    "model": "gpt-4.1",
    "tool_choice": "auto",
    "tools": [
        {
            "type": "function",
            "name": "random_generator",
            "description": "生成指定范围内的随机数,支持批量生成",
            "parameters": {
                "type": "object",
                "properties": {
                    "min": {
                        "description": "最小值(默认1)",
                        "type": "integer"
                    },
                    "max": {
                        "description": "最大值(默认100)",
                        "type": "integer"
                    },
                    "count": {
                        "description": "生成数量(默认1,最大10)",
                        "type": "integer"
                    }
                }
            }
        },
        {
            "type": "function",
            "name": "system_info",
            "description": "获取当前系统的基本信息,包括操作系统、Java版本、内存使用情况等",
            "parameters": {
                "type": "object",
                "properties": {}
            }
        },
        {
            "type": "function",
            "name": "math_calculator",
            "description": "执行基本数学运算,支持加减乘除和幂运算",
            "parameters": {
                "type": "object",
                "properties": {
                    "a": {
                        "description": "第一个数字",
                        "type": "number"
                    },
                    "b": {
                        "description": "第二个数字",
                        "type": "number"
                    },
                    "operation": {
                        "description": "运算类型: add, subtract, multiply, divide, power",
                        "type": "string"
                    }
                },
                "required": [
                    "operation",
                    "a",
                    "b"
                ]
            }
        },
        {
            "type": "function",
            "name": "current_time",
            "description": "获取当前系统时间",
            "parameters": {
                "type": "object",
                "properties": {}
            }
        }
    ]
}

请求示例代码

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location 'https://api.modelport.ai/v1/responses' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <您的真实API_KEY>' \
--header 'Content-Type: application/json' \
--data '{
    "input": [
        {
            "role": "user",
            "content": "请同时帮我做以下几件事:\n1. 获取当前系统时间\n2. 查看系统信息(操作系统、内存等)\n3. 帮我计算 123.5 + 456.7 的结果\n4. 生成3个1-100之间的随机数\n\n这是一个并行工具调用测试,请同时执行这些任务。"
        }
    ],
    "metadata": {
        "model_id": "32"
    },
    "model": "gpt-4.1",
    "tool_choice": "auto",
    "tools": [
        {
            "type": "function",
            "name": "random_generator",
            "description": "生成指定范围内的随机数,支持批量生成",
            "parameters": {
                "type": "object",
                "properties": {
                    "min": {
                        "description": "最小值(默认1)",
                        "type": "integer"
                    },
                    "max": {
                        "description": "最大值(默认100)",
                        "type": "integer"
                    },
                    "count": {
                        "description": "生成数量(默认1,最大10)",
                        "type": "integer"
                    }
                }
            }
        },
        {
            "type": "function",
            "name": "system_info",
            "description": "获取当前系统的基本信息,包括操作系统、Java版本、内存使用情况等",
            "parameters": {
                "type": "object",
                "properties": {}
            }
        },
        {
            "type": "function",
            "name": "math_calculator",
            "description": "执行基本数学运算,支持加减乘除和幂运算",
            "parameters": {
                "type": "object",
                "properties": {
                    "a": {
                        "description": "第一个数字",
                        "type": "number"
                    },
                    "b": {
                        "description": "第二个数字",
                        "type": "number"
                    },
                    "operation": {
                        "description": "运算类型: add, subtract, multiply, divide, power",
                        "type": "string"
                    }
                },
                "required": [
                    "operation",
                    "a",
                    "b"
                ]
            }
        },
        {
            "type": "function",
            "name": "current_time",
            "description": "获取当前系统时间",
            "parameters": {
                "type": "object",
                "properties": {}
            }
        }
    ]
}'

返回响应

🟢200成功
application/json
Bodyapplication/json

示例
{
    "id": "string",
    "object": "string",
    "created": 0,
    "choices": [
        {
            "index": 0,
            "message": {
                "role": "string",
                "content": "string"
            },
            "finish_reason": "string"
        }
    ],
    "usage": {
        "prompt_tokens": 0,
        "completion_tokens": 0,
        "total_tokens": 0
    },
    "model": "string",
    "input": "string"
}
修改于 2026-04-18 03:31:58
上一页
创建模型响应 gpt-5启用思考
下一页
创建模型响应(流式返回)
Built with