创建 Responses 响应
curl --request POST \
--url https://xxx.wengaocloud.com/v1/responses \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-4o-mini",
"input": "写一段简短欢迎语"
}
'import requests
url = "https://xxx.wengaocloud.com/v1/responses"
payload = {
"model": "gpt-4o-mini",
"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: 'gpt-4o-mini', input: '写一段简短欢迎语'})
};
fetch('https://xxx.wengaocloud.com/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://xxx.wengaocloud.com/v1/responses"
payload := strings.NewReader("{\n \"model\": \"gpt-4o-mini\",\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))
}{
"id": "<string>",
"object": "<string>",
"output": [
{}
],
"usage": {
"input_tokens": 123,
"output_tokens": 123,
"total_tokens": 123,
"input_tokens_details": {}
}
}{
"error": {
"type": "invalid_request_error",
"code": "model_endpoint_mismatch",
"message": "该模型不支持当前 endpoint。"
}
}{
"error": {
"type": "invalid_request_error",
"code": "model_endpoint_mismatch",
"message": "该模型不支持当前 endpoint。"
}
}对话与文本
创建 Responses 响应
OpenAI 兼容的 Responses API。以文本、列表或多轮对话形式接收 input ,返回模型响应。
支持流式输出和多模态输入;具体能力以模型支持为准。
创建 Responses 响应
curl --request POST \
--url https://xxx.wengaocloud.com/v1/responses \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-4o-mini",
"input": "写一段简短欢迎语"
}
'import requests
url = "https://xxx.wengaocloud.com/v1/responses"
payload = {
"model": "gpt-4o-mini",
"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: 'gpt-4o-mini', input: '写一段简短欢迎语'})
};
fetch('https://xxx.wengaocloud.com/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://xxx.wengaocloud.com/v1/responses"
payload := strings.NewReader("{\n \"model\": \"gpt-4o-mini\",\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))
}{
"id": "<string>",
"object": "<string>",
"output": [
{}
],
"usage": {
"input_tokens": 123,
"output_tokens": 123,
"total_tokens": 123,
"input_tokens_details": {}
}
}{
"error": {
"type": "invalid_request_error",
"code": "model_endpoint_mismatch",
"message": "该模型不支持当前 endpoint。"
}
}{
"error": {
"type": "invalid_request_error",
"code": "model_endpoint_mismatch",
"message": "该模型不支持当前 endpoint。"
}
}授权
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
⌘I
.png?fit=max&auto=format&n=v_sJS-AFS6goKAv3&q=85&s=e03202fddb83c95be2a503ab9c79163a)