Skip to content

opencode-go: requests have no x-opencode-session and no User-Agent, and the provider refuses them (400 MissingSessionID) #4

Open

Description

@iceteaSA

Summary

A run on opencode-go/deepseek-v4.1-flash gets this answer from the provider:

400 {"type":"MissingSessionID","message":"Request is missing x-opencode-session and cannot be routed efficiently. Please see https://opencode.ai/docs/go/#where-can-i-use-it"}

The credential resolves and broca admits the run. The provider refuses the first request after about 1 s, with 0 tokens. Thus each opencode-go run through broca fails.

Version: v0.3.249 (6368883). The related files are the same on master.

Provider requirement

The OpenCode Go documentation (https://opencode.ai/docs/go/#where-can-i-use-it) says that a client should:

  1. Identify itself with its own user agent, such as my-coding-agent/1.0, not with a generic SDK or HTTP-library name.
  2. Send a stable session ID in x-opencode-session for each conversation.

What broca sends

  • The catalog overlay sends opencode-go through the openai_chat family (crates/broca-catalog/data/overlay.json:851-856).
  • The openai_chat endpoint sets only content-type, accept, and the auth header (crates/broca-provider/src/families/openai_chat.rs:64-95).
  • The provider HTTP client does not set a User-Agent (crates/broca-provider/src/transport.rs:592).
  • The request context has a per-session address (transport.rs:211, :461), but the openai_chat family does not send it as a header.

Proposed fix

For the opencode-go provider:

  • Send x-opencode-session with a value that is stable for one broca session, for example the session address.
  • Send a broca User-Agent. The Anthropic family already has broca/<version> (BROCA_USER_AGENT, crates/broca-provider/src/families/anthropic_messages.rs:60).

Activity

  1. iceteaSA commented on Oct 23, 2026

    @iceteaSA
    Author

    Related: per-model endpoints and formats (from the provider documentation, not tested)

    The OpenCode Go documentation (https://opencode.ai/docs/go/#endpoints) gives a different endpoint and request format for different models. The base is https://opencode.ai/inference/go/:

    Models Endpoint path Format
    DeepSeek, GLM, Kimi, MiMo, LongCat, Hy, Step, MiniMax M3.1 Flash openai/v1/chat/completions OpenAI chat
    GPT 6 Luna, GPT 5.6 Luna, Grok 4.7, Muse Spark openai/v1/responses OpenAI responses
    Claude Haiku 5.5, Qwen3.x, MiniMax M3 anthropic/v1/messages Anthropic messages
    Gemini 4 Argon Contributor google/v1beta/models/<model> Google

    broca sends each opencode-go model as openai_chat to https://opencode.ai/zen/go/v1 (crates/broca-catalog/data/overlay.json:851-856). The chat-completions models agree with this. For the other models, the format possibly does not agree.

    This comes only from the documentation. I did not test it. A test request is possible only after the header fix in this issue, because the provider refuses each request before that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions