OpenCode

How to fix an OpenCode connection or 404 error

First determine whether the request can reach the service, then check the Base URL and adapter combination.

Start with these checks

The request did not reach the expected AI Code With endpoint.

  • The request times out, returns ECONNREFUSED or 404, or has no response.
  • The Base URL is incomplete or has an extra path
  • Compare the Base URL with the generated config
ECONNREFUSEDtimeout

01

Separate a connection failure from an HTTP response

A timeout or ECONNREFUSED usually means the request did not arrive; a 404 means the service received an unmatched path.

02

Check Base URL and adapter

Use the Base URL from the generated config. For OpenCode it must end in /v1 (https://api.aicodewith.ai/v1) for both Anthropic and OpenAI-compatible models; "Not Found: 不支持的请求路径" means /v1 is missing. Keep the adapter aligned with the Provider.

  1. 1Compare the Base URL with the generated config
  2. 2Do not add an unverified path manually

03

Confirm the request path

Reopen OpenCode and retry while keeping the status code. A service response confirms the network path is working.

  1. 1Do not add an unverified path manually
  2. 2Reopen OpenCode and retry

If it is still not fixed

Sources

Reconfigure

Return to the integration center and continue the setup steps.

Return to the related setup step

Related problems

Invalid API Key or 401 · Model missing from /models or Model Not Found · Model is listed but the request does not complete · opencode command not found · Rate limit or 429 · Usage is recorded but OpenCode shows no reply · reasoning part/text part not found or summaryParts parsing error · Invalid opencode.json · 403 Forbidden · BunInstallFailedError or models.dev download failure

Back to OpenCode