#10054·AstrBot

[Feature] 在 API 请求中发送 x-opencode-session 请求头(OpenCode Go 自 9 月 5 日起要求此项)

Author: Rain-0x01-39Created Sep 12, 2026Updated Sep 17, 2026
Labelsenhancement

功能描述

Related #8158 #8179 #10045

bash
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标识对话数据,可以使用。

添加请求头

jsonc
"custom_headers": {
  "User-Agent": "astrbot/4.25.x", // Go 文档中要求使用自身专属的 user agent 标识而不是通用的 SDK 或 HTTP 库名称。
  "x-opencode-session": "astrbot 114514" // 更推荐发送真实稳定的会话 UUID,但在这之前只能发送固定值
},

使用场景

No response

检查清单

  • 我已在 Issue 列表中搜索过相关功能,确认该功能想法从未被提出过。
  • 我建议的功能与 AstrBot 本体相关,而非在建议某一插件的功能。
  • 我已阅读并同意本项目的贡献者行为准则
  • (可选)我愿意提交 PR 以帮助实现该功能。