curl https://model-api.skyengine.com.cn/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $API_KEY" \
-d '{
"model": "gpt-4.1",
"input": "给我讲一个关于独角兽的三句话睡前故事。"
}'from openai import OpenAI
client = OpenAI(
api_key="My API Key",
)
response = client.responses.create(
model="gpt-4.1",
input="给我讲一个关于独角兽的三句话睡前故事。"
)
print(response.id)import OpenAI from "openai";
const openai = new OpenAI();
const response = await openai.responses.create({
model: "gpt-4.1",
input: "给我讲一个关于独角兽的三句话睡前故事。"
});
console.log(response);package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
"github.com/openai/openai-go/responses"
)
func main() {
client := openai.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.Responses.New(context.TODO(), responses.ResponseNewParams{
Model: openai.F("gpt-4.1"),
Input: openai.F("给我讲一个关于独角兽的三句话睡前故事。"),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.ID)
}package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.responses.Response;
import com.openai.models.responses.ResponseCreateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
Response response = client.responses().create(
ResponseCreateParams.builder()
.model("gpt-4.1")
.input("给我讲一个关于独角兽的三句话睡前故事。")
.build()
);
System.out.println(response.getId());
}
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://model-api.skyengine.com.cn/v1/responses",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'input' => '解释一下什么是人工智能'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"id": "resp_67ccd2bed1ec8190b14f964abc0542670bb6a6b452d3795b",
"object": "response",
"created_at": 1741476542,
"status": "completed",
"error": null,
"incomplete_details": null,
"instructions": null,
"max_output_tokens": null,
"model": "gpt-4.1-2025-04-14",
"output": [
{
"type": "message",
"id": "msg_67ccd2bf17f0819081ff3bb2cf6508e60bb6a6b452d3795b",
"status": "completed",
"role": "assistant",
"content": [
{
"type": "output_text",
"text": "人工智能(Artificial Intelligence, AI)是计算机科学的一个分支,致力于创建能够模拟人类智能的计算机系统。AI技术包括机器学习、深度学习、自然语言处理等多个领域,在医疗、金融、教育等行业都有广泛应用。",
"annotations": []
}
]
}
],
"parallel_tool_calls": true,
"previous_response_id": null,
"reasoning": {
"effort": null,
"summary": null
},
"store": true,
"temperature": 1,
"text": {
"format": {
"type": "text"
}
},
"tool_choice": "auto",
"tools": [],
"top_p": 1,
"truncation": "disabled",
"usage": {
"input_tokens": 12,
"input_tokens_details": {
"cached_tokens": 0
},
"output_tokens": 150,
"output_tokens_details": {
"reasoning_tokens": 0
},
"total_tokens": 162
},
"user": null,
"metadata": {}
}/v1/responses
创建一个模型响应。提供文本或图像输入来生成文本或JSON输出。让模型调用您自己的自定义代码或使用内置工具,如网络搜索或文件搜索,将您自己的数据作为模型响应的输入。
curl https://model-api.skyengine.com.cn/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $API_KEY" \
-d '{
"model": "gpt-4.1",
"input": "给我讲一个关于独角兽的三句话睡前故事。"
}'from openai import OpenAI
client = OpenAI(
api_key="My API Key",
)
response = client.responses.create(
model="gpt-4.1",
input="给我讲一个关于独角兽的三句话睡前故事。"
)
print(response.id)import OpenAI from "openai";
const openai = new OpenAI();
const response = await openai.responses.create({
model: "gpt-4.1",
input: "给我讲一个关于独角兽的三句话睡前故事。"
});
console.log(response);package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
"github.com/openai/openai-go/responses"
)
func main() {
client := openai.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.Responses.New(context.TODO(), responses.ResponseNewParams{
Model: openai.F("gpt-4.1"),
Input: openai.F("给我讲一个关于独角兽的三句话睡前故事。"),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.ID)
}package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.responses.Response;
import com.openai.models.responses.ResponseCreateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
Response response = client.responses().create(
ResponseCreateParams.builder()
.model("gpt-4.1")
.input("给我讲一个关于独角兽的三句话睡前故事。")
.build()
);
System.out.println(response.getId());
}
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://model-api.skyengine.com.cn/v1/responses",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'input' => '解释一下什么是人工智能'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"id": "resp_67ccd2bed1ec8190b14f964abc0542670bb6a6b452d3795b",
"object": "response",
"created_at": 1741476542,
"status": "completed",
"error": null,
"incomplete_details": null,
"instructions": null,
"max_output_tokens": null,
"model": "gpt-4.1-2025-04-14",
"output": [
{
"type": "message",
"id": "msg_67ccd2bf17f0819081ff3bb2cf6508e60bb6a6b452d3795b",
"status": "completed",
"role": "assistant",
"content": [
{
"type": "output_text",
"text": "人工智能(Artificial Intelligence, AI)是计算机科学的一个分支,致力于创建能够模拟人类智能的计算机系统。AI技术包括机器学习、深度学习、自然语言处理等多个领域,在医疗、金融、教育等行业都有广泛应用。",
"annotations": []
}
]
}
],
"parallel_tool_calls": true,
"previous_response_id": null,
"reasoning": {
"effort": null,
"summary": null
},
"store": true,
"temperature": 1,
"text": {
"format": {
"type": "text"
}
},
"tool_choice": "auto",
"tools": [],
"top_p": 1,
"truncation": "disabled",
"usage": {
"input_tokens": 12,
"input_tokens_details": {
"cached_tokens": 0
},
"output_tokens": 150,
"output_tokens_details": {
"reasoning_tokens": 0
},
"total_tokens": 162
},
"user": null,
"metadata": {}
}Authorizations
ModelHub API密钥认证。在 Authorization HTTP Header 中包含您的 API-Key,格式为 Bearer {API_KEY}
Body
请求的元数据
一个介于0和20之间的整数,指定在每个token位置返回的最可能token的数量,每个token都有相关的对数概率。
0 <= x <= 20采样温度,取值范围在0到2之间。较高的值(如0.8)会使输出更加随机,而较低的值(如0.2)会使输出更加集中和确定性。 通常建议仅调整temperature或top_p其中之一,不建议两者都修改。
0 <= x <= 21
核采样的替代方法,称为nucleus采样,模型考虑具有top_p概率质量的token结果。例如,0.1意味着只考虑构成前10%概率质量的token。 通常建议仅调整temperature或top_p其中之一,不建议两者都修改。
0 <= x <= 11
此字段正在被safety_identifier和prompt_cache_key替代。请使用prompt_cache_key来维持缓存优化。 用于您的终端用户的稳定标识符。用于提高缓存命中率,通过更好地分组类似请求,并帮助检测和防止滥用。
"user-1234"
一个稳定的标识符,用于帮助检测可能违反使用政策的用户。ID应该是唯一标识每个用户的字符串。我们建议对用户名或电子邮件地址进行哈希处理,以避免向我们发送任何识别信息。
"safety-identifier-1234"
用于缓存类似请求的响应以优化缓存命中率。替代user字段。
"prompt-cache-key-1234"
服务层级
default, scale 在响应中可以处理的内置工具调用总数的最大值。此最大数量适用于所有内置工具调用,而不是每个单独工具。模型进一步尝试调用工具将被忽略。
模型在生成响应时可以调用的工具数组。您可以通过设置tool_choice参数来指定使用哪个工具。
我们支持以下类别的工具:
自定义函数工具,允许模型调用您定义的函数
- 函数工具
- 网络搜索工具
- 文件搜索工具
Show child attributes
Show child attributes
模型在生成响应时应如何选择使用哪个工具(或工具)。请参阅tools参数了解如何指定模型可以调用的工具。
none, auto, required 用于生成或指导模型响应的提示文本。这是发送给模型的主要指令或问题。
"请解释一下机器学习的基本概念"
用于模型响应的截断策略。
auto:如果此响应的输入超过模型的上下文窗口大小,模型将通过从对话开头删除项目来截断响应以适应上下文窗口。disabled(默认):如果输入大小将超过模型的上下文窗口大小,请求将失败并返回400错误。
auto, disabled 指定在模型响应中包含的额外输出数据。当前支持的值有:
web_search_call.action.sources: 包括网络搜索工具调用的来源。code_interpreter_call.outputs: 包括代码解释器工具调用中Python代码执行的输出。computer_call_output.output.image_url: 包括来自计算机调用输出的图像URL。file_search_call.results: 包括文件搜索工具调用的搜索结果。message.input_image.image_url: 包括来自输入消息的图像URL。message.output_text.logprobs: 包括带有助手消息的对数概率。reasoning.encrypted_content: 包括推理项输出中推理token的加密版本。这使得在使用Responses API无状态(如当store参数设置为false时,或当组织注册了零数据保留计划时)时,推理项可以用于多轮对话。
指定在模型响应中包含的额外输出数据。
code_interpreter_call.outputs, computer_call_output.output.image_url, file_search_call.results, message.input_image.image_url, message.output_text.logprobs, reasoning.encrypted_content 是否允许模型并行运行工具调用。
是否存储生成的模型响应以供以后通过API检索。
插入到模型上下文中的系统(或开发者)消息。
当与previous_response_id一起使用时,前一个响应的指令不会被带到下一个响应。这使得在新响应中简单地交换系统(或开发者)消息变得简单。
流式响应的选项。仅在设置 stream: true 时设置。
Show child attributes
Show child attributes
此响应所属的对话。此对话中的项目会被添加到此响应请求的input_items之前。
此响应的输入项和输出项在此响应完成后会自动添加到此对话中。
Response
响应生成成功
请求的元数据
采样温度,取值范围在0到2之间。较高的值(如0.8)会使输出更加随机,而较低的值(如0.2)会使输出更加集中和确定性。 通常建议仅调整temperature或top_p其中之一,不建议两者都修改。
0 <= x <= 21
核采样的替代方法,称为nucleus采样,模型考虑具有top_p概率质量的token结果。例如,0.1意味着只考虑构成前10%概率质量的token。 通常建议仅调整temperature或top_p其中之一,不建议两者都修改。
0 <= x <= 11
模型在生成响应时可以调用的工具数组。您可以通过设置tool_choice参数来指定使用哪个工具。
我们支持以下类别的工具:
自定义函数工具,允许模型调用您定义的函数
- 函数工具
- 网络搜索工具
- 文件搜索工具
Show child attributes
Show child attributes
模型在生成响应时应如何选择使用哪个工具(或工具)。请参阅tools参数了解如何指定模型可以调用的工具。
none, auto, required 此响应的唯一标识符。
"resp_abc123"
此资源的对象类型 - 始终设置为 response。
response "response"
创建此响应的Unix时间戳(秒)。
当模型无法生成响应时返回的错误对象。
Show child attributes
Show child attributes
有关响应为何不完整的详细信息。
Show child attributes
Show child attributes
由模型生成的内容项数组。
output数组中项目的长度和顺序取决于模型的响应。- 不要简单地访问
output数组中的第一项并假设它是带有模型生成内容的assistant消息,您可以考虑在SDK支持的情况下使用output_text属性。
模型生成的输出项,可以是消息、工具调用或其他内容类型。
- 输出消息
- 文件搜索工具调用
- 函数工具调用
- 网络搜索工具调用
- 计算机工具调用
- 推理
- 图像生成调用
- 代码解释器工具调用
- 本地Shell调用
- MCP工具调用
- MCP工具列表
- MCP审批请求
- 自定义工具调用
Show child attributes
Show child attributes
插入到模型上下文中的系统(或开发者)消息。
当与 previous_response_id 一起使用时,前一个响应的指令不会被带到下一个响应。这使得在新响应中简单地交换系统(或开发者)消息变得简单。
是否允许模型并行运行工具调用。
一个介于0和20之间的整数,指定在每个token位置返回的最可能token的数量,每个token都有相关的对数概率。
0 <= x <= 20此字段正在被safety_identifier和prompt_cache_key替代。请使用prompt_cache_key来维持缓存优化。 用于您的终端用户的稳定标识符。用于提高缓存命中率,通过更好地分组类似请求,并帮助检测和防止滥用。
"user-1234"
一个稳定的标识符,用于帮助检测可能违反使用政策的用户。ID应该是唯一标识每个用户的字符串。我们建议对用户名或电子邮件地址进行哈希处理,以避免向我们发送任何识别信息。
"safety-identifier-1234"
用于缓存类似请求的响应以优化缓存命中率。替代user字段。
"prompt-cache-key-1234"
服务层级
default, scale 在响应中可以处理的内置工具调用总数的最大值。此最大数量适用于所有内置工具调用,而不是每个单独工具。模型进一步尝试调用工具将被忽略。
用于生成或指导模型响应的提示文本。这是发送给模型的主要指令或问题。
"请解释一下机器学习的基本概念"
用于模型响应的截断策略。
auto:如果此响应的输入超过模型的上下文窗口大小,模型将通过从对话开头删除项目来截断响应以适应上下文窗口。disabled(默认):如果输入大小将超过模型的上下文窗口大小,请求将失败并返回400错误。
auto, disabled 响应生成的状态。可以是 completed、failed、in_progress、cancelled、queued 或 incomplete 之一。
completed, failed, in_progress, cancelled, queued, incomplete 仅SDK便利属性,包含 output 数组中所有 output_text 项的聚合文本输出(如果存在)。在Python和JavaScript SDK中支持。
表示token使用详情,包括输入token、输出token、输出token的细分和使用的总token。
Show child attributes
Show child attributes
此响应所属的对话。此响应的输入项和输出项会自动添加到此对话中。
Show child attributes
Show child attributes

