zeroclaw-labs/zeroclaw · error · anyhow::Error

Model '{}' requested cloud routing, but Ollama endpoint is l

Error message

Model '{}' requested cloud routing, but Ollama endpoint is local. Configure api_url with a remote Ollama endpoint.

What it means

resolve_request_details inspects the model name and the configured base_url on every chat call. A `:cloud` suffix requests Ollama cloud routing, but if the endpoint host is localhost, 127.0.0.1, ::1, or 0.0.0.0, cloud routing is impossible, so the call fails fast before any HTTP request. The check protects against a configuration where the model list and the endpoint disagree about local vs cloud.

Source

Thrown at crates/zeroclaw-providers/src/ollama.rs:319

        zeroclaw_config::schema::build_runtime_proxy_client_with_timeouts(
            "model_provider.ollama",
            300,
            10,
        )
    }

    fn resolve_request_details(&self, model: &str) -> anyhow::Result<(String, bool)> {
        let requests_cloud = model.ends_with(":cloud");
        let official_cloud_endpoint = self.is_official_cloud_endpoint();
        let local_endpoint = self.is_local_endpoint();
        let normalized_model = if requests_cloud && official_cloud_endpoint {
            model.strip_suffix(":cloud").unwrap_or(model).to_string()
        } else {
            model.to_string()
        };

        if requests_cloud && local_endpoint {
            anyhow::bail!(
                "Model '{}' requested cloud routing, but Ollama endpoint is local. Configure api_url with a remote Ollama endpoint.",
                model
            );
        }

        if requests_cloud && official_cloud_endpoint && self.api_key.is_none() {
            anyhow::bail!(
                "Model '{}' requested cloud routing, but no API key is configured. Set api_key on [providers.models.ollama.<alias>] or via the schema-mirror grammar.",
                model
            );
        }

        let should_auth = self.api_key.is_some() && !local_endpoint;

        Ok((normalized_model, should_auth))
    }

    fn parse_tool_arguments(arguments: &str) -> serde_json::Value {

View on GitHub (pinned to 88bb9c8533)

Solutions

  1. Drop the `:cloud` suffix if you mean to use the local Ollama server
  2. Set `api_url = "https://ollama.com"` (or your remote endpoint) on the ollama alias when cloud is intended
  3. Audit model-string construction in your code for accidental `format!("{}:cloud", model)` concatenation

Example fix

# before
[providers.models.ollama.local]
api_url = "http://localhost:11434"
model = "llama3.1:cloud"

# after (local use)
[providers.models.ollama.local]
api_url = "http://localhost:11434"
model = "llama3.1"
Defensive patterns

Strategy: validation

Validate before calling

fn ollama_model_endpoint_consistent(model: &str, api_url: &str) -> bool {
    let requests_cloud = model.ends_with(":cloud");
    if !requests_cloud { return true; }
    let local = reqwest::Url::parse(api_url)
        .ok()
        .and_then(|u| u.host_str().map(|h| h.to_string()))
        .map(|h| matches!(h.as_str(), "localhost" | "127.0.0.1" | "::1" | "0.0.0.0"))
        .unwrap_or(false);
    !local
}

Type guard

fn requests_ollama_cloud(model: &str) -> bool { model.ends_with(":cloud") }

Try / catch

if requests_ollama_cloud(model) && is_local_endpoint(api_url) {
    return Err(anyhow::anyhow!("model {model} needs a remote api_url for :cloud routing"));
}
ollama.chat(req, model, temp).await

Prevention

When it happens

Trigger: model = "llama3.1:cloud" with api_url unset (local default) or set to http://localhost:11434; called from chat, chat_with_system, chat_with_history, or chat_with_tools; code that appends ":cloud" via format! without checking the endpoint.

Common situations: Local dev config reusing a cloud-oriented model list; switching api_url back to local but keeping cloud-suffixed model names; provisioning scripts templating the same model string everywhere.

Related errors


AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23). Data as JSON: /api/errors/9f13351de03a7d5f. Report an issue: GitHub.