The examples on this page use Chat Completions. If the current OpenCode version exposes a dedicated Responses provider, select that mode instead.
Prepare
Environment variables
Provider mapping
Configuration file template
If your OpenCode version supports provider config files, keep the key in the environment and store only provider metadata in the config:OpenCode config field names can differ by release. If your version uses
baseUrl, base_url, or api_key, keep the values the same and adapt the field names to the current schema.Verify
- Test a plain cURL chat request.
- Create an OpenAI-compatible provider in OpenCode.
- Run a read-only task in a temporary project.
- Enable tool calls and file edits only after plain chat works.