https://api.apexrouter.top/v1/chat/completions
gpt-5.6-sol
model
""" 知能API OpenAI SDK 调用示例 功能:使用 gpt-5.6-sol 模型进行智能对话 """ from openai import OpenAI import json # ==================== 客户端初始化 ==================== # 创建 OpenAI 客户端实例 client = OpenAI( api_key="sk-**************************************", # 替换为你的 知能API 令牌 base_url="https://api.apexrouter.top/v1" # 知能API 接口地址 ) # ==================== 发送对话请求 ==================== # 调用对话完成接口 chat_completion = client.chat.completions.create( messages=[ { "role": "user", # 用户角色 "content": "周树人和鲁迅是兄弟吗?" # 用户提问 } ], model="gpt-5.6-sol" # 指定使用的模型 ) # ==================== 格式化输出结果 ==================== # 将响应对象转换为字典 result = chat_completion.model_dump() # 美化输出 print("=" * 50) print("✨ API 响应结果") print("=" * 50) print(json.dumps(result, indent=2, ensure_ascii=False)) print("=" * 50) # 输出关键信息摘要 print("📊 关键信息摘要:") print(f" • 模型: {result['model']}") print(f" • 回复: {result['choices'][0]['message']['content']}") print(f" • Token 使用: {result['usage']['total_tokens']} (输入: {result['usage']['prompt_tokens']}, 输出: {result['usage']['completion_tokens']})")
""" 知能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}")
{ "id": "chatcmpl_example_gpt56_nonstream_001", "object": "chat.completion", "created": 1787270400, "model": "gpt-5.6-sol-2026-07-09", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "鲁迅,原名周树人,是中国现代文学的重要作家,代表作包括《狂人日记》《阿Q正传》等。" }, "finish_reason": "stop" } ] }
gpt-5.6-sol-2026-07-09
© 2026 知能API OpenAI Chat Completions 非流式调用