所有模型(包括非 OpenAI 模型)的请求格式已统一转换为 OpenAI 格式,几乎兼容本站的所有模型。
https://api.apexrouter.top/v1/chat/completions
gpt-5.6-sol
model
""" 知能API 对话接口调用示例 功能:使用 gpt-5.6-sol 模型进行智能对话 """ import json import requests # ==================== API 配置 ==================== # API 接口地址 url = "https://api.apexrouter.top/v1/chat/completions" # 请求头配置 headers = { "Authorization": "sk-**********************************", # 替换为你的 知能API 令牌 "Content-Type": "application/json" } # ==================== 请求参数 ==================== # 构造请求数据 payload = { "model": "gpt-5.6-sol", # 选择使用的模型 "messages": [ { "role": "system", "content": "You are a helpful assistant." # 系统提示词:定义 AI 助手的角色 }, { "role": "user", "content": "周树人和鲁迅是兄弟吗?" # 用户问题 } ] } # ==================== 发送请求 ==================== try: # 发送 POST 请求到 API response = requests.post(url, headers=headers, data=json.dumps(payload)) response.raise_for_status() # 检查 HTTP 错误 # 输出响应结果 print("=" * 50) print("API 响应结果:") print("=" * 50) print(json.dumps(response.json(), indent=2, ensure_ascii=False)) except requests.exceptions.RequestException as e: # 异常处理 print(f"❌ 请求失败: {e}")
以下结构依据 知能API 实测结果整理,ID 与时间戳为虚构值。Chat Completions 可能返回带日期的模型快照名:
{ "id": "chatcmpl_example_gpt56_001", "object": "chat.completion", "created": 1787270400, "model": "gpt-5.6-sol-2026-07-09", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "不是。周树人是鲁迅的本名,鲁迅是他的笔名。" }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 27, "completion_tokens": 26, "total_tokens": 53 } }
© 2026 知能API API 统一请求格式