opencode.json. Credentials are stored separately using the /connect command.
Configuration Variations
API key from the environment variable (without/connect):
npm with @ai-sdk/openai; OpenCode will use /v1/responses. Useful for GPT-5.x models when you want a reasoning summary. For most users, @ai-sdk/openai-compatible (Chat Completions) is sufficient.
Troubleshooting
- The provider does not appear in
/models— The IDs in/connectandopencode.jsonare different, or the JSON Invalid. Checkopencode auth list. 401— No key has been saved for that ID; repeat/connect.404 model_not_found— Themodelskey must match the exact slug fromGET /v1/models.

