创建函数调用 - apizt API 中转接口
本页使用 gpt-6.1-sol 和 Responses 协议。推理字段为 reasoning.effort;工具字段和响应事件不能直接复制 Chat 格式。查看型号与协议边界。
在 Header 添加参数 Authorization,其值为 Bearer 之后拼接 Token
Authorization: Bearer ********************
接口选择以当前型号的协议和功能为准。GPT-6.1 Sol 的工具调用使用 Responses;基础文本与图片理解也可使用 Chat。
请求参数
完整 JSON 请求体
{
"input": [
{
"role": "user",
"content": "请同时帮我做以下几件事:\n1. 获取当前系统时间\n2. 查看系统信息(操作系统、内存等)\n3. 帮我计算 123.5 + 456.7 的结果\n4. 生成3个1-100之间的随机数\n\n这是一个并行工具调用测试,请同时执行这些任务。"
}
],
"model": "gpt-6.1-sol",
"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"
}
},
"additionalProperties": false,
"required": [
"min",
"max",
"count"
]
},
"strict": true
},
{
"type": "function",
"name": "system_info",
"description": "获取当前系统的基本信息,包括操作系统、Java版本、内存使用情况等",
"parameters": {
"type": "object",
"properties": {},
"additionalProperties": false,
"required": []
},
"strict": true
},
{
"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": [
"a",
"b",
"operation"
],
"additionalProperties": false
},
"strict": true
},
{
"type": "function",
"name": "current_time",
"description": "获取当前系统时间",
"parameters": {
"type": "object",
"properties": {},
"additionalProperties": false,
"required": []
},
"strict": true
}
],
"reasoning": {
"effort": "low"
}
}
请求示例代码
curl --fail-with-body --request POST 'https://api.apizt.com/v1/responses' \
--header "Authorization: Bearer ${tokenba_API_KEY}" \
--header 'Content-Type: application/json' \
--data-raw '{
"input": [
{
"role": "user",
"content": "请同时帮我做以下几件事:\n1. 获取当前系统时间\n2. 查看系统信息(操作系统、内存等)\n3. 帮我计算 123.5 + 456.7 的结果\n4. 生成3个1-100之间的随机数\n\n这是一个并行工具调用测试,请同时执行这些任务。"
}
],
"model": "gpt-6.1-sol",
"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"
}
},
"additionalProperties": false,
"required": [
"min",
"max",
"count"
]
},
"strict": true
},
{
"type": "function",
"name": "system_info",
"description": "获取当前系统的基本信息,包括操作系统、Java版本、内存使用情况等",
"parameters": {
"type": "object",
"properties": {},
"additionalProperties": false,
"required": []
},
"strict": true
},
{
"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": [
"a",
"b",
"operation"
],
"additionalProperties": false
},
"strict": true
},
{
"type": "function",
"name": "current_time",
"description": "获取当前系统时间",
"parameters": {
"type": "object",
"properties": {},
"additionalProperties": false,
"required": []
},
"strict": true
}
],
"reasoning": {
"effort": "low"
}
}'async function main() {
const headers = {
"Authorization": "Bearer " + process.env.tokenba_API_KEY,
"Content-Type": "application/json"
};
const body = JSON.stringify({
"input": [
{
"role": "user",
"content": "请同时帮我做以下几件事:\n1. 获取当前系统时间\n2. 查看系统信息(操作系统、内存等)\n3. 帮我计算 123.5 + 456.7 的结果\n4. 生成3个1-100之间的随机数\n\n这是一个并行工具调用测试,请同时执行这些任务。"
}
],
"model": "gpt-6.1-sol",
"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"
}
},
"additionalProperties": false,
"required": [
"min",
"max",
"count"
]
},
"strict": true
},
{
"type": "function",
"name": "system_info",
"description": "获取当前系统的基本信息,包括操作系统、Java版本、内存使用情况等",
"parameters": {
"type": "object",
"properties": {},
"additionalProperties": false,
"required": []
},
"strict": true
},
{
"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": [
"a",
"b",
"operation"
],
"additionalProperties": false
},
"strict": true
},
{
"type": "function",
"name": "current_time",
"description": "获取当前系统时间",
"parameters": {
"type": "object",
"properties": {},
"additionalProperties": false,
"required": []
},
"strict": true
}
],
"reasoning": {
"effort": "low"
}
});
const response = await fetch("https://api.apizt.com/v1/responses", { method: "POST", headers, body });
if (!response.ok) throw new Error("HTTP " + response.status + ": " + await response.text());
console.log(await response.text());
}
main().catch(console.error);import os
import requests
headers = {"Authorization": "Bearer " + os.environ["tokenba_API_KEY"]}
payload = {'input': [{'role': 'user',
'content': '请同时帮我做以下几件事:\n'
'1. 获取当前系统时间\n'
'2. 查看系统信息(操作系统、内存等)\n'
'3. 帮我计算 123.5 + 456.7 的结果\n'
'4. 生成3个1-100之间的随机数\n'
'\n'
'这是一个并行工具调用测试,请同时执行这些任务。'}],
'model': 'gpt-6.1-sol',
'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'}},
'additionalProperties': False,
'required': ['min', 'max', 'count']},
'strict': True},
{'type': 'function',
'name': 'system_info',
'description': '获取当前系统的基本信息,包括操作系统、Java版本、内存使用情况等',
'parameters': {'type': 'object',
'properties': {},
'additionalProperties': False,
'required': []},
'strict': True},
{'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': ['a', 'b', 'operation'],
'additionalProperties': False},
'strict': True},
{'type': 'function',
'name': 'current_time',
'description': '获取当前系统时间',
'parameters': {'type': 'object',
'properties': {},
'additionalProperties': False,
'required': []},
'strict': True}],
'reasoning': {'effort': 'low'}}
response = requests.post('https://api.apizt.com/v1/responses', headers=headers, json=payload, timeout=120)
response.raise_for_status()
print(response.text)返回响应
按 output[].type 读取结果;文本在 message 的 content 中,函数调用为 function_call。函数由应用执行,再用 function_call_output 回传结果。续接请求仍需确认当前分组支持的存储与上下文功能。
以下为结构示例,不代表实际调用结果。
{
"id": "resp_demo",
"object": "response",
"status": "completed",
"model": "gpt-6.1-sol",
"output": [
{
"type": "function_call",
"call_id": "call_demo",
"name": "math_calculator",
"arguments": "{\"a\": 123.5, \"b\": 456.7, \"operation\": \"add\"}"
}
]
}
示例先设置 tokenba_API_KEY。JavaScript 使用 Node.js 20+,Python 安装 requests。流式示例的 Python 与 JavaScript 会逐段输出事件数据。代码中的 ID、文件名与令牌须替换为自己的值。
GPT-6.1 Sol 的 Chat 请求使用 reasoning_effort,Responses 使用 reasoning.effort;等级为 low、medium、high、xhigh、max。工具调用使用 Responses。官方型号说明。
当前模型与版本
依据 apizt 价格页,同步于 。以下型号按目录声明的协议与本页用途筛选;不代表所有参数和功能通用。切换前请核对型号说明、令牌分组与参数差异。Gemini 原生接口需同时替换 URL 中的模型 ID。
| 模型 ID | 能力标签 | 支持分组 |
|---|---|---|
gpt-6.1-sol | 对话,工具,识图,思考 | 分组(9)
|
gpt-6-astra | 对话,工具,识图,思考 | 分组(10)
|
gpt-6-sol | 对话,工具,识图,思考 | 分组(10)
|
gpt-6-luna | 对话,工具,识图,思考 | 分组(10)
|
gpt-5.6-sol | 对话,工具,识图,思考 | 分组(10)
|
gpt-5.5 | 对话,识图 | 分组(10)
|
gpt-5.6-luna | 对话,工具,识图 | 分组(7)
|
gpt-5.6-terra | 对话,工具,识图 | 分组(10)
|
共列入 45 个候选型号。查看完整模型、版本与接口目录。