I don't know what happened; it doesn't work in OpenCode. #4825

Closed
opened 2026-02-16 17:45:36 -05:00 by yindo · 3 comments
Owner

Originally created by @momomobinx on GitHub (Jan 12, 2026).

Originally assigned to: @rekram1-node on GitHub.

Question

ERROR 2026-01-12T07:46:58 +2160ms service=llm providerID=myprovider modelID=opencode sessionID=ses_44ed3e424ffew7jWyoiqbRpT6Z small=false agent=build error={
    "error": {
        "name": "AI_APICallError",
        "url": "http://proxy-api.lo/v1/chat/completions",
        "requestBodyValues": {
            "model": "opencode",
            "max_tokens": 32000,
            "messages": [
                {
                    "role": "system",
                    "content": "..."
                },
                {
                    "role": "user",
                    "content": "你好"
                }
            ],
            "tools": ["..."],
            "tool_choice": "auto",
            "stream": true,
            "stream_options": {
                "include_usage": true
            }
        },
        "statusCode": 502,
        "responseHeaders": {
            "connection": "keep-alive",
            "content-length": "0",
            "keep-alive": "timeout=4",
            "proxy-connection": "keep-alive"
        },
        "responseBody": "",
        "isRetryable": true
    }
} stream error
ERROR 2026-01-12T07:46:58 +4ms service=session.processor error=Bad Gateway stack="AI_APICallError: Bad Gateway\n    at <anonymous> (../../node_modules/.bun/@ai-sdk+provider-utils@3.0.19+d6123d32214422cb/node_modules/@ai-sdk/provider-utils/dist/index.mjs:918:18)\n    at processTicksAndRejections (native:7:39)" process
INFO  2026-01-12T07:46:58 +1ms service=bus type=session.status publishing
INFO  2026-01-12T07:47:00 +2021ms service=llm providerID=myprovider modelID=opencode sessionID=ses_44ed3e424ffew7jWyoiqbRpT6Z small=false agent=build stream
INFO  2026-01-12T07:47:00 +2ms service=bus type=session.status publishing

However, requests made via Bruno are normal.

Image
Originally created by @momomobinx on GitHub (Jan 12, 2026). Originally assigned to: @rekram1-node on GitHub. ### Question ``` ERROR 2026-01-12T07:46:58 +2160ms service=llm providerID=myprovider modelID=opencode sessionID=ses_44ed3e424ffew7jWyoiqbRpT6Z small=false agent=build error={ "error": { "name": "AI_APICallError", "url": "http://proxy-api.lo/v1/chat/completions", "requestBodyValues": { "model": "opencode", "max_tokens": 32000, "messages": [ { "role": "system", "content": "..." }, { "role": "user", "content": "你好" } ], "tools": ["..."], "tool_choice": "auto", "stream": true, "stream_options": { "include_usage": true } }, "statusCode": 502, "responseHeaders": { "connection": "keep-alive", "content-length": "0", "keep-alive": "timeout=4", "proxy-connection": "keep-alive" }, "responseBody": "", "isRetryable": true } } stream error ERROR 2026-01-12T07:46:58 +4ms service=session.processor error=Bad Gateway stack="AI_APICallError: Bad Gateway\n at <anonymous> (../../node_modules/.bun/@ai-sdk+provider-utils@3.0.19+d6123d32214422cb/node_modules/@ai-sdk/provider-utils/dist/index.mjs:918:18)\n at processTicksAndRejections (native:7:39)" process INFO 2026-01-12T07:46:58 +1ms service=bus type=session.status publishing INFO 2026-01-12T07:47:00 +2021ms service=llm providerID=myprovider modelID=opencode sessionID=ses_44ed3e424ffew7jWyoiqbRpT6Z small=false agent=build stream INFO 2026-01-12T07:47:00 +2ms service=bus type=session.status publishing ``` However, requests made via Bruno are normal. <img width="2422" height="934" alt="Image" src="https://github.com/user-attachments/assets/1f11dce0-655e-4e12-b641-8aee59e134d0" />
yindo closed this issue 2026-02-16 17:45:36 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 12, 2026):

This issue might be a duplicate of an existing issue. Please check:

  • #2729: "This service is not available in your region" [OpenCode Zen] - Related to API connectivity issues through proxied/federated services

Your 502 Bad Gateway error could be caused by similar infrastructure issues. The error indicates the proxy server at proxy-api.lo is returning a gateway error, which could be related to service unavailability or regional blocking similar to issue #2729.

Feel free to ignore if this doesn't match your specific case or if you're using a custom local proxy setup.

@github-actions[bot] commented on GitHub (Jan 12, 2026): This issue might be a duplicate of an existing issue. Please check: - #2729: "This service is not available in your region" [OpenCode Zen] - Related to API connectivity issues through proxied/federated services Your 502 Bad Gateway error could be caused by similar infrastructure issues. The error indicates the proxy server at `proxy-api.lo` is returning a gateway error, which could be related to service unavailability or regional blocking similar to issue #2729. Feel free to ignore if this doesn't match your specific case or if you're using a custom local proxy setup.
Author
Owner

@momomobinx commented on GitHub (Jan 12, 2026):

this is my config

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "myprovider": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Local-CLi",
      "options": {
        "timeout": 300000,
        "baseURL": "http://proxy-api.lo/v1",
        "apiKey": "my api key"
      },
      "models": {
        "opencode": {},
        "opencode-small": {}
      }
    }
  },
  "model": "Local-CLi/opencode",
  "small_model": "Local-CLi/opencode-small",
}
@momomobinx commented on GitHub (Jan 12, 2026): this is my config ``` { "$schema": "https://opencode.ai/config.json", "provider": { "myprovider": { "npm": "@ai-sdk/openai-compatible", "name": "Local-CLi", "options": { "timeout": 300000, "baseURL": "http://proxy-api.lo/v1", "apiKey": "my api key" }, "models": { "opencode": {}, "opencode-small": {} } } }, "model": "Local-CLi/opencode", "small_model": "Local-CLi/opencode-small", } ```
Author
Owner

@momomobinx commented on GitHub (Jan 16, 2026):

I discovered that my VS Code terminal is configured as git-bash, and running opencode on my git-bash results in an error. Running it from the command prompt (cmd) solves the problem.

@momomobinx commented on GitHub (Jan 16, 2026): I discovered that my VS Code terminal is configured as git-bash, and running opencode on my git-bash results in an error. Running it from the command prompt (cmd) solves the problem.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#4825