#changing keepalive duration for a specific ollama model

1 messages Β· Page 1 of 1 (latest)

red tulip
#

I am using ollama keep alive parameter set to "-1" to keep models in vram so when I need them they can run immediately. However, I want to change this for a specific model. So I need Openclaw to send keepalive parameter for that model. How can I do this ?

marsh flaxBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> βœ… Mark Solution

vocal foxBOT
#

Yes β€” set keep_alive as an Ollama model param for that specific model.

If you’re using the native Ollama provider (api: "ollama"), OpenClaw forwards keep_alive as a top-level Ollama /api/chat request field, not inside options.

Example config:

{
  models: {
    providers: {
      ollama: {
        baseUrl: "http://127.0.0.1:11434",
        apiKey: "ollama-local",
        api: "ollama",
        models: [
          {
#
            id: "qwen2.5:7b",
            name: "qwen2.5:7b",
            params: {
              keep_alive: "5m"
            }
          }
        ]
      }
    }
  }
}

Or with CLI merge, for an agent/default per-model param:

#
openclaw config set agents.defaults.models '{"ollama/qwen2.5:7b":{"params":{"keep_alive":"5m"}}}' --strict-json --merge

Use the exact model ref you run, e.g. ollama/llama3.2:latest. If you already have that model listed under models.providers.ollama.models, put params.keep_alive on that provider model entry instead β€” explicit provider model params win over agents.defaults.models.

If it doesn’t take effect, please paste openclaw --version; this behavior depends on the newer native Ollama provider path.

Docs: https://docs.openclaw.ai/providers/ollama

red tulip
#

great , thanks

vocal foxBOT
#

Glad that helped! πŸŽ‰
If this fixed it, please right-click the solution message β†’ Apps β†’ βœ… Mark Solution so Answer Overflow indexes it for future users.

red tulip
#

I tried to do it. is it ok ?

vocal foxBOT
#

Yep, that looks good β€” the βœ… reaction came through. Thanks for marking it! 🦞

red tulip
#

thank you