创建响应
curl --request POST \
--url https://api.pipellm.ai/v1/responses \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"input": {}
}
'import requests
url = "https://api.pipellm.ai/v1/responses"
payload = {
"model": "<string>",
"input": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({model: '<string>', input: {}})
};
fetch('https://api.pipellm.ai/v1/responses', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.pipellm.ai/v1/responses"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"input\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}创建响应
使用 OpenAI Responses API 创建模型响应。
POST
/
v1
/
responses
创建响应
curl --request POST \
--url https://api.pipellm.ai/v1/responses \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"input": {}
}
'import requests
url = "https://api.pipellm.ai/v1/responses"
payload = {
"model": "<string>",
"input": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({model: '<string>', input: {}})
};
fetch('https://api.pipellm.ai/v1/responses', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.pipellm.ai/v1/responses"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"input\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}认证和模型列表请参考 概述。
端点
POST https://api.pipellm.ai/v1/responses
这条 free route 只接受 OpenAI Responses 格式请求,并只路由到 OpenAI 兼容
平台。要用 Responses 格式调用 Anthropic 或 Gemini 模型,请使用
Responses 格式转换器。该转换器是无状态的,
不支持
previous_response_id、响应存储、托管工具和结构化输出格式。代码示例
- cURL
- Python
- TypeScript
curl https://api.pipellm.ai/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $PIPELLM_API_KEY" \
-d '{
"model": "gpt-5",
"input": "用一句话解释为什么天空是蓝色的。"
}'
import os
from openai import OpenAI
client = OpenAI(
api_key=os.getenv("PIPELLM_API_KEY"),
base_url="https://api.pipellm.ai/v1"
)
response = client.responses.create(
model="gpt-5",
input="用一句话解释为什么天空是蓝色的。"
)
print(response.output_text)
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.PIPELLM_API_KEY,
baseURL: "https://api.pipellm.ai/v1",
});
const response = await client.responses.create({
model: "gpt-5",
input: "用一句话解释为什么天空是蓝色的。",
});
console.log(response.output_text);
请求参数
string
必填
OpenAI 兼容模型 ID,从
GET /v1/models 选取。string | array
必填
文本输入,或结构化输入项。
string
developer 或 system 指令。
boolean
为
true 时流式返回。array
内置工具或自定义工具。
number
采样温度。
integer
最大输出 token 数。
响应结构
{
"id": "resp_123",
"object": "response",
"model": "gpt-5",
"output": [
{
"type": "message",
"role": "assistant",
"content": [
{
"type": "output_text",
"text": "大气层对蓝光的散射比红光更强。"
}
]
}
]
}
相关文档
路由与协议
先理解原生路由的协议限制
OpenAI 总览
PipeLLM 上的 OpenAI 兼容端点
OpenAI 迁移指南
官方 Responses 与 Chat Completions 对比
此页面对您有帮助吗?