# gpt-6-sol · API 接入

API 模型 ID 为 `gpt-6-sol`。本文说明平台的实际契约，调用前请核对实时目录中的可用性。

## 请求示例

平台地址在构建时填入，运行前设置 API_KEY 为服务端密钥。

```bash
curl "https://newrouters.com/v1/chat/completions" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $API_KEY" \
  --data '{
  "model": "gpt-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/completions`
- `POST /v1/responses`

| 限制 | 目录值 |
| --- | --- |
| 上下文 Token | 128000 |
| 最大输出 Token | 16384 |

流式调用使用该协议的原生流式选项，并按协议解析事件；能力以实时目录为准。








<!-- official-reference:start -->
## 官方来源与模型身份

核对日期: 2026-09-27 · 平台模型: `gpt-6-sol` · 官方对应: `gpt-6-sol`

- [gpt-6-sol official reference](https://developers.openai.com/api/docs/models/gpt-6-sol)
- [OpenAI Responses / Chat Completions](https://developers.openai.com/api/docs/guides/migrate-to-responses)
- [OpenAI streaming](https://developers.openai.com/api/docs/guides/streaming-responses)
<!-- official-reference:end -->

## 计费与排错

接入时核对当前可用性、契约和账号价格。排错时保留请求 ID 与消费凭据。 [完整 API 参考](/zh/docs/api)

## 多语言请求示例

### JavaScript

```javascript
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-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);
```

### Python

```python
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-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))
```

## 响应字段节选（示意值）

### HTTP 200

```json
{
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "..."
      },
      "finish_reason": "stop"
    }
  ]
}
```


