Skip to main content

Before you begin

Install the OpenCode CLI with npm 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 ~/.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.
~/.config/opencode/opencode.json
For other models or tiers, copy an entry under 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 /models to switch in the current conversation.
  • Reasoning effort: Use /variants to select low, high, or max. The default is high. With opencode run, pass --variant followed by low, high, or max. OpenCode ignores any other value and uses high.

Troubleshooting

  • If opencode run prints UnknownError with Unexpected server error, check that the selected model matches a model key in your configuration. With -m, include the provider prefix, for example lithosai/deepseek-ai/DeepSeek-V4.1-Flash. Model IDs are case-sensitive. Run the command again with --print-logs to see the underlying error.
  • Don’t set setCacheKey in the provider options. If it is set, OpenCode sends promptCacheKey, which LithosAI rejects with 400 unknown_parameter. LithosAI caches repeated prompts without it.
Issues common to every agent, with the errors LithosAI returns, are listed under Common issues.

Resources