Skip to content

Regression: api: "ollama" rejected for custom-URL providers; no working path for num_ctx injection through a local proxy #62735

Description

@STaveras

Summary

As of the 2026.4.x release, OpenClaw refuses to use the ollama API type for any provider that isn't the built-in Ollama URL. Custom provider entries in openclaw.json with "api": "ollama" now fail immediately with:

No API provider registered for api: ollama

This worked in prior releases (confirmed working as of 2026.3.24). We run a local proxy (toolbridge) that implements the native Ollama /api/chat wire format — api: "ollama" was the correct and natural configuration for it. That is now broken.

What api: "ollama" gave us

  • think: false injected at the native /api/chat level — the only place Ollama honours it for Qwen3.x models. The OpenAI-compat endpoint silently ignores it, causing multi-minute thinking loops.
  • options.num_ctx set automatically from contextWindow — no duplication in the Modelfile required.
  • Proper Ollama streaming format, tool passing, etc.

The fallback paths are all broken too

Switching to openai-completions doesn't help. The injectNumCtxForOpenAICompat flag — the only other mechanism to get options.num_ctx injected — is gated behind isOllamaCompatProvider(), which hardcodes port 11434 or the literal provider id "ollama":

function isOllamaCompatProvider(model) {
    if (providerId === "ollama") return true;
    if (hostname === "localhost" && parsed.port === "11434") return true;
    return providerHintsOllama && isOllamaPort && isOllamaCompatPath;
}

Any proxy on any other port, with any other name, is excluded. So:

  • api: "ollama" → rejected outright
  • api: "openai-completions" + injectNumCtxForOpenAICompat: true → silently does nothing
  • api: "openai-responses" → same; no num_ctx, no think suppression

The only remaining option is to bake PARAMETER num_ctx into the Modelfile — which defeats the point of having runtime-configurable context windows.

Requested fixes

  1. Restore api: "ollama" support for arbitrary baseUrl providers. A proxy that implements /api/chat is Ollama-compatible regardless of what port it runs on. The operator has already opted in by setting api: "ollama".

  2. If keeping the restriction, make injectNumCtxForOpenAICompat: true act as an explicit override for isOllamaCompatProvider(). If the operator has set that flag, they know what they're doing.

  3. Document the change. This appears to be a silent regression in the 2026.4.x window with no mention in the changelog.

Environment

  • lastTouchedVersion: 2026.4.5
  • lastRunVersion (wizard): 2026.3.24
  • Platform: Linux/WSL2
  • Local proxy: toolbridge (Python aiohttp, implements /api/chat and /v1/chat/completions)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions