OpenCode

How to fix OpenCode 403 Forbidden

A 403 differs from a 401 or invalid JSON. Check permissions and model routing without exposing or storing the API key in plaintext.

Start with these checks

The request was authenticated, but the credential or route cannot access the target model.

  • OpenCode returns 403 or Forbidden.
  • The key cannot access the model
  • Confirm account and key permissions
403Forbidden

01

Separate 403 from authentication failure

A 403 usually means the request was recognized but cannot access the target resource.

02

Check permissions and routing

Keep the key, Provider, Base URL, and Model ID in one coherent setup.

  1. 1Confirm account and key permissions
  2. 2Compare Provider, Base URL, and Model ID

03

Confirm recovery and prevent recurrence

A short message succeeds after access is restored; check route status whenever changing models.

  1. 1Compare Provider, Base URL, and Model ID
  2. 2Check model and channel status

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 · Wrong Base URL, 404, or connection failure · 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 · BunInstallFailedError or models.dev download failure

Back to OpenCode