.config/opencode/config.json
{
"$schema": "https://opencode.ai/config.json",
"default_agent": "build",
"compaction": {
"auto": true,
"prune": true,
"reserved": 8192
},
"provider": {
"ollama": {
"name": "Ollama",
"npm": "@ai-sdk/openai-compatible",
"options": {
"baseURL": "http://localhost:11434/v1"
},
"models": {
"gemma4:e4b-32k": {
"name": "gemma4:e4b-32k",
"_launch": true,
"id": "gemma4:e4b-32k",
"tool_call": true,
"options": {
"temperature": 0.1
},
"maxTokens": 16384
},
"gemma4:e2b": {
"name": "gemma4:e2b",
"_launch": true,
"id": "gemma4:e2b",
"tool_call": true,
"options": {
"temperature": 0.1
},
"maxTokens": 16384
}
}
}
}
}
services:
ollama:
image: ollama/ollama:latest
container_name: ollama
restart: unless-stopped
runtime: nvidia
ports:
- "11434:11434"
volumes:
- ollama_data:/root/.ollama
command: ["serve"]
volumes:
ollama_data:
docker compose exec ollama ollama pull gemma4:e4b
docker compose exec ollama ollama run gemma4:e4b
# then within the Ollama model prompt run these commands:
/set parameter num_ctx 32768
/save gemma4:e4b-32k
/bye
# then confirm the new model is in place
docker compose exec ollama ollama list