eca icon indicating copy to clipboard operation
eca copied to clipboard

Eca does not work with OpenCode via the openai-responses, nor with openai-chat

Open johannes-mueller opened this issue 1 month ago • 2 comments

To upvote this issue, give it a thumbs up. See this list for the most upvoted issues.

When using eca-emacs with OpenCode I get the error message:

Short description

[OPENAI] Unexpected response status: %s body: %s 400 {"type":"error","error":{"type":"ModelProtocolUnsupported","message":"Model does not support this protocol."}}

To reproduce

  • Start eca (eca-desktop or eca-emacs) with the following configuration. The session-id is hardcoded just to see if it works
{
  "providers": {
    "opencode": {
      "api": "openai-responses",
      "url": "https://opencode.ai/inference/",
      "key": "<my-token>",
      "extraHeaders": {
        "User-Agent": "eca-emacs/1.0",
	"x-opencode-session": "e64b8abe-c1d6-4ac9-89c2-8f5ac9a3886c"
      },
      "models": {
	"big-pickle": {}
      }
    }
  }
}
  • The model list is updated. Select a model e.g. claude-sonnet-5.5
  • Type in a small prompt like "Summarize current project".

The above error appears. The session id and all the data appear correctly in the logs on OpenCode. The error message there is

{
  "event": {
    "id": "<id>",
    "requestID": "<id>",
    "workspaceID": "org_<workspace id>",
    "startedAt": 1792165205881,
    "finishedAt": 1792165206017,
    "durationMs": 136,
    "outcome": "rejected",
    "category": "inference",
    "protocol": "openai-responses",
    "product": "standard",
    "path": "/inference/v1/responses",
    "method": "POST",
    "stream": true,
    "sessionID": "e64b8abe-c1d6-4ac9-89c2-8f5ac9a3886c",
    "userAgent": "eca-emacs/1.0",
    "userID": "user_<my-user-id>",
    "requestedModel": "claude-sonnet-5-5",
    "model": "claude-sonnet-5-5",
    "provider": "opencode",
    "statusCode": 400,
    "errorCode": "inference_failed",
    "errorMessage": "The inference request failed.",
    "reasoningMode": "effort",
    "reasoningEffort": "medium",
    "country": "CZ",
    "region": "Plzeň Region",
    "city": "Pilsen",
    "requestHeaders": {
      "content-length": "26163",
      "content-type": "application/json",
      "user-agent": "eca-emacs/1.0",
      "x-opencode-session": "e64b8abe-c1d6-4ac9-89c2-8f5ac9a3886c"
    },
    "metadata": {},
    "attemptCount": 0,
    "attempts": []
  }
}

Expected behavior

I expect the assistant to respond with the project summary.

Doctor

ECA version: 0.165.0

Server cmd: /home/joh/.emacs.d/eca/eca server

Workspaces: /home/joh/Devel/Lights/lumio

Default model: opencode/big-pickle (API key (oc_**********XtS))

Logged providers: None
Relevant env vars: 
XDG_ACTIVATION_TOKEN=kwi*****-79
DEBUGINFOD_URLS=https://debuginfod.archlinux.org

Additional notes

  • Maybe this is related to #649.
  • I tried also to use openai-chat. The setup above was the only one that let me discover the available models.

johannes-mueller avatar Oct 16 '26 15:10 johannes-mueller

@johannes-mueller this looks like a different problem which happens because depending on the model opencode requries a different api, you can try something like this:

{
  "providers": {
    "opencode": {
      "api": "openai-chat",
      "url": "https://opencode.ai/inference/openai/v1",
      "key": "${env:OPENCODE_API_KEY}",
      "extraHeaders": {"User-Agent": "eca/1.0", "x-opencode-session": "<uuid>"},
      "fetchModels": false,
      "models": {"big-pickle": {}, "kimi-k3": {}}
    },
    "opencode-claude": {
      "api": "anthropic",
      "url": "https://opencode.ai/inference/anthropic",
      "key": "${env:OPENCODE_API_KEY}",
      "extraHeaders": {"User-Agent": "eca/1.0", "x-opencode-session": "<uuid>"},
      "fetchModels": false,
      "models": {"claude-sonnet-5-5": {}}
    },
    "opencode-gpt": {
      "api": "openai-responses",
      "url": "https://opencode.ai/inference/openai",
      "key": "${env:OPENCODE_API_KEY}",
      "extraHeaders": {"User-Agent": "eca/1.0", "x-opencode-session": "<uuid>"},
      "fetchModels": false,
      "models": {"gpt-5.5": {}}
    }
  }
}

ericdallo avatar Oct 20 '26 17:10 ericdallo

I'm adding an example for opencode go so closing this

ericdallo avatar Oct 29 '26 12:10 ericdallo