Install
Install the OpenCode CLI:OpenCode requires a larger context window. It is recommended to use a context window of at least 64k tokens. See Context length for more information.
Usage with Ollama
Quick setup
Manual setup
Add a configuration block to~/.config/opencode/opencode.json:
Cloud Models
glm-4.7:cloud is the recommended model for use with OpenCode.
Add the cloud configuration to ~/.config/opencode/opencode.json:
Connecting to ollama.com
- Create an API key from ollama.com and export it as
OLLAMA_API_KEY. - Update
~/.config/opencode/opencode.jsonto point to ollama.com:
opencode in a new terminal to load the new settings.
