Skip to main content
This page explains how to run models from Modular Cloud on OpenCode.

Before you begin

Make sure you have:

Add authentication

First, connect Modular Cloud to OpenCode.
  1. Create a Modular Cloud API key and copy its value.
  2. Start OpenCode:
  3. Run the /connect command in OpenCode.
  4. At the end of the provider list, select Other.
  5. Set the Provider id to modular and submit your API key.

Update the OpenCode config

Next, configure Modular Cloud as a provider in the OpenCode config.
  1. Open the opencode.json config file in your project directory.
  2. Choose the model that you want from our list of shared endpoints or use a dedicated endpoint if applicable.
  3. Add Modular Cloud as a provider:
    opencode.json
The npm value depends on the API you’re using: You can also set a default model for OpenCode in the config:
opencode.json
To enable the config changes, restart OpenCode. Then, you can select any configured models when you run the /models command.
The example above demonstrates a basic provider configuration. To see the complete list of configuration options, see the OpenCode documentation on custom providers.