anomalyco / anomalyco/opencode
[FEATURE]: Add Qwen Code configuration example for `x-opencode-session` header
@neriousy is already working on this.
Since Sep 10, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Feature hasn't been suggested before.
- I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
Description
Since September 6, 2026, OpenCode Go requires an x-opencode-session HTTP header for all API requests. Users of Qwen Code (the CLI from QwenLM) are encountering the following error:
Request is missing x-opencode-session and cannot be routed efficiently.
The solution is not obvious and required significant community effort to discover. Currently, the OpenCode documentation does not include any guidance for Qwen Code users on how to configure this header. Adding a short example would save many users from frustration.
Solution
In Qwen Code's settings.json, you can add custom HTTP headers via the customHeaders field inside generationConfig. The recommended approach is to use the ${session_id} placeholder so that a unique session ID is generated automatically for each conversation.
Here is a minimal working configuration for a DeepSeek model routed through OpenCode Go:
{
"modelProviders": {
"openai": [
{
"id": "deepseek-v4-pro",
"name": "[DeepSeek] deepseek-v4-pro",
"baseUrl": "https://opencode.ai/zen/go/v1",
"envKey": "OPENCODE_API_KEY",
"generationConfig": {
"contextWindowSize": 1000000,
"customHeaders": {
"x-opencode-session": "${session_id}"
}
}
}
]
}
}
Note: The
${session_id}placeholder is supported starting from Qwen Code PR #11282. Without it, you can use a fixed string (e.g.,"my-session-id"), but this is less reliable for multi-session use.
Proposed Documentation Update
I suggest adding a small section to the OpenCode documentation, for example under Troubleshooting or in a Provider-specific configuration guide. The section could be titled:
Using OpenCode Go with Qwen Code
If you see the error
Request is missing x-opencode-session, add the following to your Qwen Codesettings.json:"customHeaders": { "x-opencode-session": "${session_id}" }Make sure you are using Qwen Code version that includes support for the
${session_id}placeholder (see PR #11282).
This would help users resolve the issue quickly without needing to search through GitHub issues and community discussions.
Additional Context
- The error started appearing after OpenCode Go began enforcing the
x-opencode-sessionheader on September 6, 2026. - The same problem affects other clients (e.g., DeepSeek Harness), and community plugins have been created for those. For Qwen Code, the native
customHeadersoption works well. - I have personally verified that this configuration resolves the error.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.