Ollama provider: `temperature` setting is never sent to the API (top_p works correctly)
Component
VS Code extension
Description
Description
When using a local Ollama model as the provider, the temperature value set in agent config (kilo.jsonc / agent settings) is never actually sent to Ollama's API. The model always runs with whatever temperature is baked into the GGUF/Modelfile, regardless of what's configured in Kilo Code.
top_p on the same agent config is applied correctly, so this appears to be a provider-specific bug scoped to the temperature field only.
Additional Testing
To rule out a type/UI issue, I also tried:
temperature: 0.4→ launched withtemp = 1.000temperature: 2(integer) → launched withtemp = 1.000temperature: 2.0→ launched withtemp = 1.000- Removed the Modelfile's own temperature override entirely (so the model's only default comes from its GGUF metadata,
temp = 1.0) — result unchanged.
In every case, the UI correctly reflected the value I entered in the settings panel, and the saved JSON config correctly persisted it. Only the value actually sent to Ollama ignores it, always falling back to the model's own default of 1.0.
Separately, I also noticed the settings UI's temperature text input does not accept decimal input — pressing . does nothing. This may or may not be related to the same root cause, but is worth noting since it affects the same field.
Environment
- Kilo Code: 7.8.18
- Provider: Ollama (local,
ollama_local) - Model:
gemma4-code01:latest(based on Gemma 4 12B) - Ollama version: 0.40.13
- OS: Linux (CachyOS, kernel 7.3.0-4-cachyos)
Hypothesis
The Ollama provider's request-building code appears to map top_p into the outgoing API request options but not temperature — i.e. a missing or broken field mapping specific to temperature on this provider path.
Supporting Log Excerpt
llama_model_loader: - kv 3: general.sampling.top_p f32 = 0.950000
llama_model_loader: - kv 4: general.sampling.temp f32 = 1.000000
...
slot launch_slot_: id 0 | task -1 | sampler params:
top_k = 40, top_p = 0.900, min_p = 0.000, ... temp = 1.000
Plugins
None
Kilo version
7.8.18
Steps to reproduce
Steps to Reproduce
- Use a local Ollama model whose Modelfile/GGUF has a known default, e.g.:
general.sampling.top_p = 0.95 general.sampling.temp = 1.00 - Set agent config:
"agent": { "code": { "model": "ollama_local/<model>:latest", "temperature": 0.4, "top_p": 0.9, "steps": 20 } } - Reload Kilo Code, confirm the settings UI shows
temperature: 0.4andtop_p: 0.9. - Send a prompt and inspect the Ollama/llama-server logs for the actual sampler params used.
Expected Behavior
llama-server logs should show:
top_p = 0.900, temp = 0.400
Actual Behavior
llama-server logs show:
top_p = 0.900, temp = 1.000
top_p correctly overrides the model's baked-in default (0.95 → 0.9). temp does not override the model's baked-in default (1.00) — it stays at 1.00 regardless of what is configured.
Screenshot and/or share link
Operating System
CachyOS, kernel 7.3.0-4-cachyos
Terminal
fish / konsole 26.8.2
I traced this on current main (0a9faeff). The temperature isn't lost in the Ollama provider itself; it's dropped by a capability gate:
- In
packages/opencode/src/session/llm/request.ts(~L150),temperatureis only sent whenmodel.capabilities.temperatureis true; otherwise it'sundefined.topPhas no such gate, which is whytop_pworks. - For models declared in a custom provider config (like
ollama_local),packages/opencode/src/provider/provider.ts(~L1589) setscapabilities.temperature = model.temperature ?? existingModel?.capabilities.temperature ?? false. A local Ollama model isn't in the models.dev catalog, so it falls back tofalse.
Workaround until this is decided: mark the model as supporting temperature in the provider config, e.g.
"provider": {
"ollama_local": {
"models": {
"gemma4-code01:latest": { "temperature": true }
}
}
}
Whether an explicitly configured agent temperature should bypass the gate (or custom/local models should default to true) seems like a maintainer call, so I didn't open a PR.
Hi, I'd like to work on this. Could you please assign it to me?