Skip to content

OpenCode

OpenCode can call LootVM through an OpenAI-compatible provider entry. Put the provider in project opencode.json / opencode.jsonc or in your user OpenCode config, then select the model in OpenCode.

OpenCode config shapes vary by version (provider vs providers, npm vs package). Use the schema your installed OpenCode documents; the values below are what must point at LootVM.

Field Value
Base URL https://api.lootvm.com/v1 (no /chat/completions suffix)
API key LootVM-issued key (env var preferred)
Model id Exact id from GET /v1/models for your key
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"lootvm": {
"npm": "@ai-sdk/openai-compatible",
"name": "LootVM",
"options": {
"baseURL": "https://api.lootvm.com/v1",
"apiKey": "{env:LOOTVM_API_KEY}"
},
"models": {
"your-enabled-model": {
"name": "LootVM model"
}
}
}
},
"model": "lootvm/your-enabled-model"
}

Then:

Terminal window
export LOOTVM_API_KEY='your-lootvm-api-key'
opencode

If your OpenCode build uses a providers map and @opencode/ai/providers/openai-compatible, keep the same baseURL and credential pattern and follow that build’s package field names.

Terminal window
curl --fail-with-body https://api.lootvm.com/v1/models \
-H "Authorization: Bearer ${LOOTVM_API_KEY}"
opencode models
Symptom Check
Provider missing in picker Provider id in config does not match model (lootvm/...)
401 Env var empty in the shell that started OpenCode; prefer {env:...} over committing secrets
Connection / timeout baseURL must end with /v1, not /v1/chat/completions
Model unknown Model key must match /v1/models character for character

See Foundation (SDKs) and Chat Completions.