Before you start
- Get an API key and a model alias as described in Before you connect. The base URL is
https://ai.sinarcloud.com/v1.
Install OpenCode
1.19.4.
OpenCode prints its version
Create opencode.json in your project
opencode.json. To use SinarCloud in one project, create opencode.json in the project’s root folder and paste the following into it. To use it in every project on macOS or Linux, create the file at ~/.config/opencode/opencode.json instead. If the file already exists, add the model and provider keys to it.
opencode.json in the project's root folder, with the SinarCloud base URL
provider.sinarcloudadds SinarCloud to OpenCode under the IDsinarcloud. The@ai-sdk/openai-compatiblepackage makes OpenCode use the OpenAI Chat Completions format.baseURLmakes OpenCode send its requests tohttps://ai.sinarcloud.com/v1.{env:SINARCLOUD_API_KEY}makes OpenCode read your API key from the environment variable, so your key isn’t stored in the file.- Each key under
modelsis a model alias from the Models page, andnameis the name OpenCode shows for it. Setlimit.contextandlimit.outputto the model’s Context window (tokens) and Maximum output (tokens), which OpenCode uses to manage long conversations. modelsets the default model:sinarcloud/followed by the model alias.
Set your API key in the terminal
SINARCLOUD_API_KEY environment variable to your API key, then check that it’s set:- macOS and Linux
- Windows PowerShell
paste-your-api-key with your key, and keep the quotes. The check prints set without showing your key. If you already saved the key for every new terminal, as described in Before you connect, run only the check.
The key is set in the terminal, and the check prints set
Start OpenCode

OpenCode started, with DeepSeek V4.1 Flash from SinarCloud
Check the model with /models
/models and press Enter. In Select model, type sinarcloud to show only the models you added for SinarCloud. A dot marks the model OpenCode uses. To switch to another model you added, select it and press Enter. To close the list, press Esc.The full list also shows models under other headings, such as OpenCode. Only the models under SinarCloud use your SinarCloud API key.
Select model, filtered to SinarCloud
Send a prompt
Add a GET /products/:id route to src/server.js, and press Enter.
A task in OpenCode's prompt box, ready to send
build · deepseek/deepseek-v4-1-flash.Find the requests in Usage

The Usage page, with the API key filter at the top
Add more models
Add each model you want to use undermodels, with its alias as the key. To use a lower-cost model for small tasks such as naming sessions, set small_model. Otherwise, OpenCode uses your default model for them too.
Troubleshooting
OpenCode shows errors from SinarCloud afterError:.
Error: Invalid API key.
Error: Invalid API key.
SINARCLOUD_API_KEY is set in the terminal where you started OpenCode and that it holds your whole key. If the key has expired or been revoked, create a new one.Error: The requested model does not exist or is not available for this endpoint.
Error: The requested model does not exist or is not available for this endpoint.
models matches it exactly, and that model is sinarcloud/ followed by the same alias. Then check that the model’s Model capabilities list Chat completions.Error: Your balance is empty or negative and no token credits remain for this model.
Error: Your balance is empty or negative and no token credits remain for this model.