OpenCode
Add the provod.ai provider and authorized model catalog to OpenCode.
Last updated on
Choose installer or manual setup
In OpenCode, a provider is a named API connection with its models and connection settings. The installer configures an existing OpenCode installation; it does not install OpenCode. It authenticates GET /v1/models, adds or refreshes the provod provider, and carries the returned names, limits, capabilities, modalities, and public prices into the local configuration.
Use the installer for catalog-driven setup. Use the manual provider only when you need to review and merge every field yourself.
Run the installer
export PROVOD_API_KEY="sk_..."
curl -fsSL https://app.provod.ai/install/opencode.sh | \
PROVOD_API_KEY="$PROVOD_API_KEY" shThe installer stores the key separately in ~/.config/opencode/provod-api-key and adds a {file:~/.config/opencode/provod-api-key} reference to the config. Keep the key file out of repositories and shared backups.
Set OPENCODE_CONFIG before the command to target a non-default file. Otherwise the installer checks ~/.config/opencode/opencode.json, then opencode.jsonc, and creates opencode.json when neither exists.
Both installers validate the generated config and back up an existing file before replacing it. The installer does not select a default model; choose the model you want through /models after installation.
Configure a provider manually
First export the key and use GET /v1/models to choose an available exact ID. Then replace every model-id-from-GET-v1-models string below with that ID, and paste the current key value where the example names PROVOD_API_KEY.
export PROVOD_API_KEY="sk_..."Manual setup stores the key unencrypted
The apiKey value is written directly to the local OpenCode configuration. Protect the file because it contains the key, keep it out of repositories and shared backups, and prefer a dedicated key with an appropriate spend limit.
{
"$schema": "https://opencode.ai/config.json",
"model": "provod/model-id-from-GET-v1-models",
"provider": {
"provod": {
"npm": "@ai-sdk/openai-compatible",
"name": "provod.ai",
"options": {
"baseURL": "https://api.provod.ai/v1",
"apiKey": "paste-value-from-PROVOD_API_KEY"
},
"models": {
"model-id-from-GET-v1-models": {
"name": "model-id-from-GET-v1-models"
}
}
}
}
}Save the example as ~/.config/opencode/opencode.json, then restrict the directory and credential file to the current user. If OPENCODE_CONFIG points elsewhere, apply equivalent owner-only permissions to that file:
chmod 700 ~/.config/opencode
chmod 600 ~/.config/opencode/opencode.jsonThe manual example defines only the connection. The installer is preferable when you want OpenCode to receive current context/output limits, reasoning, tools, image input, and prices from catalog metadata.
Verify the current configuration
List the models OpenCode loaded for the provider:
opencode models provodSelect one through /models, or run a current catalog ID directly:
export PROVOD_MODEL="model-id-from-GET-v1-models"
opencode run --model "provod/$PROVOD_MODEL" "Reply with ok"Recover or refresh
On macOS/Linux, the installer prints the timestamped backup path. If the merged file no longer loads, stop OpenCode, preserve the failed file for comparison, restore the printed backup, and rerun only after checking OPENCODE_CONFIG.
If an installer cannot merge safely or preserve JSONC comments, it leaves the original file unchanged and writes a standalone provod-opencode-provider.jsonc snippet beside it for review. PowerShell also prints the backup path after successfully updating an existing file. Rerunning the installer refreshes the live catalog; it is not necessary to copy new model IDs from this page.
A public error code is the client-facing error.code from the API response. Record it with the HTTP status, exact model ID, time, OpenCode version, config path, and masked key prefix. See API authentication for safe key handling and Chat Completions for the request format.