[Bug] OpenCode Go returns 400 because x-opencode-session header is missing
Environment
- Kimi Code version: Unknown
- OS: Windows
- Provider: OpenCode Go
- Model: Unknown
- Installation method: Unknown
Problem
When using Kimi Code with OpenCode Go, requests fail with the following error:
400 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
provider.api_error · HTTP 400Expected behavior
Kimi Code should send a stable x-opencode-session header for each conversation when making requests to OpenCode Go. The value should remain stable during one conversation and change for a new conversation.
Actual behavior
The request does not include the x-opencode-session header, so OpenCode Go rejects the request with HTTP 400.
Relevant documentation
OpenCode Go requires coding agents to send a stable session ID in the x-opencode-session header:
https://opencode.ai/docs/go/#where-can-i-use-it
The OpenCode Go documentation lists Kimi Code as a known problematic client and tracks the missing automatic session-header support as issue #3506.
Reproduction steps
- Configure Kimi Code to use OpenCode Go.
- Select an OpenCode Go model.
- Start a new conversation.
- Send any prompt.
- The request fails with HTTP 400.
Possible fix
Add a stable session identifier to all OpenCode Go requests:
x-opencode-session: <stable-session-id>The session ID should be generated once per conversation and reused for all related requests, including auxiliary or tool-related requests if applicable.
Additional context
This appears to be missing session metadata rather than an authentication or model availability problem.
Source: MoonshotAI/kimi-cli