OpenCode setup with Local models

Notes on this, will publish more as I go:

opencode.json

{
"$schema": "https://opencode.ai/config.json",
"provider": {
"llama.cpp": {
"npm": "@ai-sdk/openai-compatible",
"name": "llama.cpp (local)",
"options": {
"baseURL": "http://localhost:8000/v1"
},
"models": {
"unsloth/Qwen3.5-27B-GGUF:Q6_K": {
"name": "unsloth/Qwen3.5-27B-GGUF:Q6_K",
"tool_call": true,
"reasoning": true,
"limit": {
"context": 262144,
"output": 16384
},
"modalities": {
"input": [
"text",
"image"
],
"output": [
"text"
] }
}
}
}
}
}

Llama.cpp Server Settings

According to https://huggingface.co/unsloth/Qwen3.6-27B-GGUF#best-practices I should be setting temperature, top-k etc. optimisally for Qwen3.6. So lets try adding these parameters:

–temp 0.6 –top-p 0.95 –top-k 20 –min-p 0.0 –presence-penalty 0.0 –repeat-penalty 1.0

./build/bin/llama-server -fa 1 --parallel 3 --kv-unified -ts 9/16 -ctk bf16 -ctv bf16 --hf-repo unsloth/Qwen3.6-27B-GGUF:Q8_0 --temp 0.6 --top-p 0.95 --top-k 20 --min-p 0.0 --presence-penalty 0.0 --repeat-penalty 1.0 --ctx-size 262144 --host 0.0.0.0 --port 8000

Which works great for design and planning and refactor reviews, but for the coding part is a bit on the sluggish side. For that, I use:

./build/bin/llama-server -fa 1 --parallel 3 --kv-unified -ts 9/16 -ctk bf16 -ctv bf16 --hf-repo unsloth/Qwen3.6-35B-A3B-GGUF:Q8_0 --temp 0.6 --top-p 0.95 --top-k 20 --min-p 0.0 --presence-penalty 0.0 --repeat-penalty 1.0 --reasoning-budget 32768 --ctx-size 262144 --host 0.0.0.0 --port 8000

Things to try:



Thing
Source
Set up model parameters for tasks
Thinking mode for general tasks:

temperature=1.0, top_p=0.95, top_k=20, min_p=0.0, presence_penalty=1.5, repetition_penalty=1.0
Thinking mode for precise coding tasks:

temperature=0.6, top_p=0.95, top_k=20, min_p=0.0, presence_penalty=0.0, repetition_penalty=1.0

Instruct (non-thinking) for general tasks:

temperature=0.7, top_p=0.8, top_k=20, min_p=0.0, presence_penalty=1.5, repetition_penalty=1.0
Instruct (non-thinking) for reasoning tasks:

temperature=1.0, top_p=0.95, top_k=20, min_p=0.0, presence_penalty=1.5, repetition_penalty=1.0
https://unsloth.ai/docs/models/qwen3.6
Making the above part of runtime
export LLAMA_CACHE="unsloth/Qwen3.6-35B-A3B-GGUF" ./llama.cpp/llama-server \ -hf unsloth/Qwen3.6-35B-A3B-GGUF:UD-Q4_K_XL \ --temp 0.7 \ --top-p 0.8 \ --top-k 20 \ --presence_penalty=1.5 \ --min-p 0.00 \ --chat-template-kwargs '{"enable_thinking":false}'
https://unsloth.ai/docs/models/qwen3.6#llama.cpp-guides
With or without reasoning? (might be a llama.cpp runtime flag only?)
Better coding standardshttps://www.reddit.com/r/AI_Agents/comments/1suiys0/i_rewrote_13_software_engineering_books_into/

https://github.com/ciembor/agent-rules-books
or OpenCode, I read a hint somewhere that "npm": "@ai-sdk/anthropic" would help reduce tool-call failures; since I set that, I have not encountered a single tool call fail.
opencode.json (YMMV on the various reserved/context/input/output values):

{ "$schema": "https://opencode.ai/config.json", "compaction": { "auto": true, "prune": true, "reserved": 16384 }, "model": "local/qwen36", "provider": { "local": { "npm": "@ai-sdk/anthropic", "name": "local", "options": { "baseURL": "http://PUT_YOUR_IP_ADDRESS_HERE:8000/v1", "apiKey": "dummy" }, "models": { "qwen36": { "name": "qwen36", "limit": { "context": 212992, "input": 180224, "output": 32768 } } } } }, "agent": { "build": { "temperature": 0.6, "top_p": 0.95, "max_tokens": 32768 }, "plan": { "temperature": 0.6, "top_p": 0.95, "max_tokens": 32768 } }, }
Feedback welcome!


https://forums.developer.nvidia.com/t/qwen-qwen3-6-35b-a3b-and-fp8-has-landed/366822/108?page=6

Leave a Reply

Your email address will not be published. Required fields are marked *