Check your OpenCode version
Run opencode --version first. The configuration below targets OpenCode v1 and its provider object. OpenCode v2 uses a different schema; use the official v2 provider guide for that version. Do not combine fields from both formats in one file.
You need a MandAPI key and an account-visible model ID that supports Chat Completions. For coding actions, also confirm the selected model's tool support. Read the current MandAPI catalog and replace every MODEL_ID placeholder with the same exact ID.
Store the credential
Start OpenCode, run /connect, choose Other, and use mandapi as the custom provider ID. Enter your MandAPI key in the credential prompt. Use that same provider ID in the configuration below. Keep the key out of the project's JSON file and repository.
Add the v1 provider
Create or merge opencode.json in your project. Preserve other providers and project settings. This configuration selects the Chat Completions adapter and defines one visible model:
{
"$schema": "https://opencode.ai/config.json",
"model": "mandapi/MODEL_ID",
"provider": {
"mandapi": {
"npm": "@ai-sdk/openai-compatible",
"name": "MandAPI",
"options": {
"baseURL": "https://api.mandapi.com/v1"
},
"models": {
"MODEL_ID": {
"name": "MandAPI model"
}
}
}
}
}mandapi/MODEL_ID is OpenCode's local provider/model reference. The model key inside models remains the exact MandAPI model ID; do not add an OpenRouter-specific prefix to it. Add accurate context or output limits only when you have verified them for that model.
Select and test the model
Run /models and select the MandAPI entry. In a small project, ask for a three-sentence README summary without file changes. Check that text arrives and that MandAPI records the corresponding usage. Continue with tool actions only after confirming they work for your chosen model.
Troubleshoot without replacing everything
If the provider is absent, check that the credential ID and JSON provider ID both say mandapi, that the file is valid JSON, and that the installed version is v1. If authentication fails, update the saved credential rather than placing a real key in the project file. If the route fails, check the base URL and adapter: this example uses /v1/chat/completions, not the Responses adapter. To restore the old setup, switch to the previous provider and restore the backed-up project configuration.