Troubleshooting

opencode Errors — AI_APICallError, Model Not Found, Auth

opencode builds on the Vercel AI SDK, so provider failures surface as AI_* error classes, and models outside the models.dev catalog need their capabilities declared by hand in opencode.json. The pages below cover the failures that actually reach users.

ErrorMeaning
AI_APICallErroropencode surfaces provider failures as AI_APICallError from the Vercel AI SDK. How to read the wrapped status code and fix the baseURL, key or model underneath.
opencode model not foundopencode only offers models it knows about, and custom provider models are not in the models.dev catalog. How to declare a model in opencode.json so it appears and works.
opencode 401 unauthorizedopencode authenticates a custom provider through options.apiKey, usually an {env:...} placeholder. Why the variable silently resolves empty and requests fail with 401.
this model does not support image inputopencode silently replaces attached images with a note when the model's modalities are not declared. The one-line opencode.json declaration that turns image input on.

opencode AI_APICallError — Causes and Fixes

opencode surfaces provider failures as AI_APICallError from the Vercel AI SDK. How to read the wrapped status code and fix the baseURL, key or model underneath.

opencode Model Not Found — Declaring Custom Provider Models

opencode only offers models it knows about, and custom provider models are not in the models.dev catalog. How to declare a model in opencode.json so it appears and works.

opencode API Key Not Picked Up — auth and {env} Placeholders

opencode authenticates a custom provider through options.apiKey, usually an {env:...} placeholder. Why the variable silently resolves empty and requests fail with 401.

opencode: This Model Does Not Support Image Input — Fix

opencode silently replaces attached images with a note when the model's modalities are not declared. The one-line opencode.json declaration that turns image input on.

Skip the broken setup

apiToken.sale serves the standard Anthropic API — same models, same SDKs, one prepaid balance. Point your tool's base URL at it, and the config on this page works as written.