Opencode
De Mathux
Find a suitable model that fit in RAM
https://ollama.com/search list model size on disk, not on VRAM.
Also find a model that can think and run tools ( this may help https://www.canirun.ai/ )
Model take VRAM size, but context size also. As stated here, we may have to increase context size to 16k-32k.
https://opencode.ai/docs/fr/providers/#ollama
Increase model's context size
ollama run qwen3.5:2b
>>> /set parameter num_ctx 32768
Set parameter 'num_ctx' to '32768'
>>> /save qwen3.5:2b-32k
Created new model 'qwen3.5:2b-32k'
Check if it fits in VRAM
Run the model:
ollama run qwen3.5:2b-32k
Then check CPU vs GPU usage. It should be 100% GPU to stay fast
ollama ps
NAME ID SIZE PROCESSOR CONTEXT UNTIL
qwen3.5:2b-32k 094e78c5fe51 5.1 GB 100% GPU 32768 4 minutes from now
Configure Opencode
in ~/.config/opencode/config.json
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"ollama": {
"name": "Ollama (spacemarine)",
"npm": "@ai-sdk/openai-compatible",
"options": {
"baseURL": "http://192.168.0.24:11434/v1"
},
"models": {
"qwen3.5:2b-32k": {
"tools": true
}
}
}
}
}