OpenCode with Muapi

Use Muapi text models in OpenCode by adding Muapi as a custom OpenAI-compatible provider.

1. Create a key and choose a model

Create an API key in the Muapi dashboard, then list available text models:

curl -s "https://api.muapi.ai/v1/models?type=text" \
  -H "Authorization: Bearer $MUAPI_API_KEY"

Choose a model ID from the response with capabilities.tools: true. OpenCode needs tool support for file edits and terminal actions.

2. Add Muapi as a provider

Set the MUAPI_API_KEY environment variable in the shell where you run OpenCode. For macOS or Linux:

export MUAPI_API_KEY="your-muapi-api-key"

Add this provider to your opencode.json configuration file (project-level or global):

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "muapi": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Muapi",
      "options": {
        "baseURL": "https://api.muapi.ai/v1",
        "apiKey": "{env:MUAPI_API_KEY}"
      },
      "models": {
        "YOUR_MODEL_ID": {
          "name": "Muapi text model"
        }
      }
    }
  }
}

Replace YOUR_MODEL_ID with the exact model ID from the Muapi model list. Keep the API key in the environment variable; do not put it in a shared or committed config file.

3. Select the model

Start OpenCode, run /models, and select the model under the Muapi provider. Start with a small coding task and confirm OpenCode can read a file and make a change.

Troubleshooting

  • If Muapi does not appear in /models, check the config syntax, exact model ID, and that OpenCode can read the config file.
  • If requests return an authentication error, confirm MUAPI_API_KEY is set in the environment that starts OpenCode.
  • If the model answers but cannot use tools, choose a model whose Muapi model-list entry has capabilities.tools: true.
  • Large repository prompts can use credits quickly. Start with a narrow task and check usage in the Muapi dashboard.

See the OpenCode provider documentation for current custom-provider configuration options.