[Feature] 在 API 请求中发送 x-opencode-session 请求头(OpenCode Go 自 9 月 5 日起要求此项)
Author: Rain-0x01-39Created Sep 12, 2026Updated Sep 17, 2026
Labelsenhancement
功能描述
Related #8158 #8179 #10045
Error code: 400 - {'type': 'error', 'error': {'type': 'MissingSessionID', 'message': 'Error from provider (Console Go): Request is missing x-opencode-session and cannot be routed efficiently. Please see [https://opencode.ai/docs/go/#where-can-i-use-it'}}](https://opencode.ai/docs/go/#where-can-i-use-it'%7D%7D)AstrBot已有uuid标识对话数据,可以使用。
添加请求头
"custom_headers": {
"User-Agent": "astrbot/4.25.x", // Go 文档中要求使用自身专属的 user agent 标识而不是通用的 SDK 或 HTTP 库名称。
"x-opencode-session": "astrbot 114514" // 更推荐发送真实稳定的会话 UUID,但在这之前只能发送固定值
},使用场景
No response
检查清单
Source: AstrBotDevs/AstrBot