LLM API
通过openai接口接入 gpt-5.6-sol。 包含请求示例、参数、鉴权和结果处理。
POST
/v1/chat/completionsMODELgpt-5.6-sol代码示例与响应
/v1/chat/completions服务端调用
curl "https://newrouters.com/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $API_KEY" \
--data '{
"model": "gpt-5.6-sol",
"messages": [
{
"role": "user",
"content": "Explain how an HTTP request works in three concise steps."
}
],
"max_completion_tokens": 1024,
"stream": false
}'服务端调用
const apiBaseUrl = "https://newrouters.com";
const apiKey = process.env.API_KEY;
if (!apiKey) throw new Error("Set API_KEY in your server environment");
const response = await fetch(apiBaseUrl + "/v1/chat/completions", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer " + apiKey
},
body: JSON.stringify({
"model": "gpt-5.6-sol",
"messages": [
{
"role": "user",
"content": "Explain how an HTTP request works in three concise steps."
}
],
"max_completion_tokens": 1024,
"stream": false
})
});
const result = await response.json();
if (!response.ok) throw new Error(JSON.stringify(result));
console.log(result);服务端调用
import json
import os
from urllib.request import Request, urlopen
api_base_url = "https://newrouters.com"
api_key = os.environ["API_KEY"]
body = json.loads("{\"model\":\"gpt-5.6-sol\",\"messages\":[{\"role\":\"user\",\"content\":\"Explain how an HTTP request works in three concise steps.\"}],\"max_completion_tokens\":1024,\"stream\":false}")
request = Request(
api_base_url + "/v1/chat/completions",
data=json.dumps(body).encode("utf-8"),
headers={
"Content-Type": "application/json",
"Authorization": "Bearer " + api_key
},
method="POST",
)
with urlopen(request) as response:
print(json.load(response))平台地址已填入,运行前设置 API_KEY 环境变量。示例不会自动发起请求。
200成功结果
JSON
{
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "..."
},
"finish_reason": "stop"
}
]
}- 准备请求01
API Key + 模型 ID选择对应模型的原生协议和鉴权方式。
SDK / HTTP - 调用原生接口02
POST /v1/chat/completions使用本篇文档中的请求结构提交。
OpenAI - 读取响应03
choices[].messageJSON 返回完整结果;SSE 增量内容按原生事件格式读取。
JSON / SSE
API 模型 ID 为 gpt-5.6-sol。本文说明平台的实际契约,调用前请核对实时目录中的可用性。
平台地址在构建时填入,运行前设置 API_KEY 为服务端密钥。
curl "https://newrouters.com/v1/chat/completions" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $API_KEY" \ --data '{ "model": "gpt-5.6-sol", "messages": [ { "role": "user", "content": "Explain how an HTTP request works in three concise steps." } ], "max_completion_tokens": 1024, "stream": false}'此模型使用 openai 协议,读取其原生响应及 usage 字段,不使用媒体任务的 input 包装。
支持的端点模板:
POST /v1/chat/completionsPOST /v1/responses
| 限制 | 目录值 |
|---|---|
| 上下文 Token | 1050000 |
| 最大输出 Token | 128000 |
流式调用使用该协议的原生流式选项,并按协议解析事件;能力以实时目录为准。
官方来源与模型身份
Section titled “官方来源与模型身份”核对日期: 2026-09-27 · 平台模型: gpt-5.6-sol · 官方对应: gpt-5.6-sol
接入时核对当前可用性、契约和账号价格。排错时保留请求 ID 与消费凭据。 完整 API 参考