openclaw - 💡(How to fix) Fix [Feature]: Allow prompt-level selection of LLM service provider [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#57908Fetched 2026-04-08 01:56:12
View on GitHub
Comments
0
Participants
1
Timeline
1
Reactions
0
Author
Participants
Timeline (top)
labeled ×1

Allow use of prompt-level selection of LLM provider by way of some syntax similar to llmservers.yaml ollama: servers: - url: "http://127.0.0.1:11434" name: "Server1" priority: 1 primary: true - url: "http://192.168.1.99:11434" name: "Server2" priority: 2 backup: true - url: "http://192.168.1.88:11434" name: "Server3" priority: 2 backup: true

default_server: "Server1"

In this topology, there are 3 LLM servers. Openclaw is using glm-4.7-flash:latest on 127.0.0.1:11434 by 'settings'. For the example, its model name is ${MODEL_NAME}

Prompt example: On-Server Server2: Why is the sky blue?

This prompt will (of course) interpret the prompt on localhost. It will then do the functional equivalent of: OLLAMA_HOST=http://192.168.1.99:11434 ollama run ${MODEL_NAME} "Why is the sky blue"? Then wait for response and bring it back into the openclaw session

Use case is when I want to offload some long effort to a 'heavier duty' server or send a /btw or similar low-cost query to a lesser server

Root Cause

Allow use of prompt-level selection of LLM provider by way of some syntax similar to llmservers.yaml ollama: servers: - url: "http://127.0.0.1:11434" name: "Server1" priority: 1 primary: true - url: "http://192.168.1.99:11434" name: "Server2" priority: 2 backup: true - url: "http://192.168.1.88:11434" name: "Server3" priority: 2 backup: true

default_server: "Server1"

In this topology, there are 3 LLM servers. Openclaw is using glm-4.7-flash:latest on 127.0.0.1:11434 by 'settings'. For the example, its model name is ${MODEL_NAME}

Prompt example: On-Server Server2: Why is the sky blue?

This prompt will (of course) interpret the prompt on localhost. It will then do the functional equivalent of: OLLAMA_HOST=http://192.168.1.99:11434 ollama run ${MODEL_NAME} "Why is the sky blue"? Then wait for response and bring it back into the openclaw session

Use case is when I want to offload some long effort to a 'heavier duty' server or send a /btw or similar low-cost query to a lesser server

Fix Action

Fix / Workaround

Reduces productivity by limiting LLM to one server Maintenance load of user-managed code 'workarounds' such as scripts to do: OLLAMA_HOST=http://192.168.1.99:11434 ollama run ${MODEL_NAME} "Why is the sky blue"?

RAW_BUFFERClick to expand / collapse

Summary

Allow use of prompt-level selection of LLM provider by way of some syntax similar to llmservers.yaml ollama: servers: - url: "http://127.0.0.1:11434" name: "Server1" priority: 1 primary: true - url: "http://192.168.1.99:11434" name: "Server2" priority: 2 backup: true - url: "http://192.168.1.88:11434" name: "Server3" priority: 2 backup: true

default_server: "Server1"

In this topology, there are 3 LLM servers. Openclaw is using glm-4.7-flash:latest on 127.0.0.1:11434 by 'settings'. For the example, its model name is ${MODEL_NAME}

Prompt example: On-Server Server2: Why is the sky blue?

This prompt will (of course) interpret the prompt on localhost. It will then do the functional equivalent of: OLLAMA_HOST=http://192.168.1.99:11434 ollama run ${MODEL_NAME} "Why is the sky blue"? Then wait for response and bring it back into the openclaw session

Use case is when I want to offload some long effort to a 'heavier duty' server or send a /btw or similar low-cost query to a lesser server

Problem to solve

User cannot recruit another LLM server into operation. Nor can they do so on a single prompt

Proposed solution

A skill?

Ollama Server Configuration

Servers

Usage

Reference servers by name in prompts:

  • "On-Server Server2 do this task"
  • "On-Server Server1 analyze this"
  • "On-Server Server2 help me with..."

Default server is always ampArm64 unless explicitly specified.

Ollama Server Status Check

Use the curl command to check server status.

Alternatives considered

No response

Impact

Reduces productivity by limiting LLM to one server Maintenance load of user-managed code 'workarounds' such as scripts to do: OLLAMA_HOST=http://192.168.1.99:11434 ollama run ${MODEL_NAME} "Why is the sky blue"?

Evidence/examples

No response

Additional information

No response

extent analysis

Fix Plan

To enable prompt-level selection of LLM providers, we need to implement a syntax similar to llmservers.yaml and modify the ollama command to accept server names in prompts.

Step 1: Modify llmservers.yaml to include server names

ollama:
  servers:
    - url: "http://127.0.0.1:11434"
      name: "Server1"
      priority: 1
      primary: true
    - url: "http://192.168.1.99:11434"
      name: "Server2"
      priority: 2
      backup: true
    - url: "http://192.168.1.88:11434"
      name: "Server3"
      priority: 2
      backup: true

  default_server: "Server1"

Step 2: Update ollama command to parse server names in prompts

import re

def parse_prompt(prompt):
    # Regular expression to match "On-Server <server_name> <task>"
    match = re.match(r"On-Server (\w+) (.+)", prompt)
    if match:
        server_name = match.group(1)
        task = match.group(2)
        return server_name, task
    return None, prompt

def run_ollama(server_name, task, model_name):
    # Get server URL from llmservers.yaml
    server_url = get_server_url(server_name)
    # Run ollama command with server URL and task
    command = f"OLLAMA_HOST={server_url} ollama run {model_name} '{task}'"
    # Execute command and return response
    return execute_command(command)

def get_server_url(server_name):
    # Load llmservers.yaml and return server URL for given server name
    with open("llmservers.yaml", "r") as f:
        config = yaml.safe_load(f)
        for server in config["ollama"]["servers"]:
            if server["name"] == server_name:
                return server["url"]
    return None

Step 3: Integrate parse_prompt and run_ollama functions into ollama command

def main():
    prompt = input("Enter prompt: ")
    server_name, task = parse_prompt(prompt)
    if server_name:
        model_name = "${MODEL_NAME}"
        response = run_ollama(server_name, task, model_name)
        print(response)
    else:
        # Default server
        model_name = "${MODEL_NAME}"
        response = run_ollama("Server1", prompt, model_name)
        print(response)

Verification

Test the updated ollama command with different prompts:

  • "On-Server Server2 Why is the sky blue?"
  • "

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING