Before you begin
Install the OpenCode CLI withnpm i -g opencode-ai, create a key on the
API Keys page, and choose a model on the
Models page. These steps were tested with OpenCode 1.19.0.
1
Set your API key
Export your key in the shell that runs OpenCode:
2
Configure LithosAI
Merge this configuration into
For other models or tiers, copy an entry under
~/.config/opencode/opencode.json, keeping your existing
providers, or create the file if it does not exist. The example includes DeepSeek-V4.1-Flash
and its fast and ultra tiers. Keep the top-level model line; without it, OpenCode picks its
own default.OpenCode configuration
OpenCode configuration
~/.config/opencode/opencode.json
provider.lithosai.models and update
its key and name using the model catalog.
Adjust the token limits and supported reasoning efforts for that model, then reopen OpenCode.3
Start a conversation
Run
opencode to start a conversation.Model and reasoning effort
- Model and tier: Use
/modelsto switch in the current conversation. - Reasoning effort: Use
/variantsto select low, high, or max. The default is high. Withopencode run, pass--variantfollowed by low, high, or max. OpenCode ignores any other value and uses high.
Troubleshooting
- If
opencode runprintsUnknownErrorwithUnexpected server error, check that the selected model matches a model key in your configuration. With-m, include the provider prefix, for examplelithosai/deepseek-ai/DeepSeek-V4.1-Flash. Model IDs are case-sensitive. Run the command again with--print-logsto see the underlying error. - Don’t set
setCacheKeyin the provider options. If it is set, OpenCode sendspromptCacheKey, which LithosAI rejects with400 unknown_parameter. LithosAI caches repeated prompts without it.