openclaw - ✅(Solved) Fix Bug: api: "ollama" not registered in pi-ai provider registry — throws "No API provider registered for api: ollama" [1 pull requests, 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#69683Fetched 2026-04-22 07:49:21
View on GitHub
Comments
0
Participants
1
Timeline
1
Reactions
0
Participants
Timeline (top)
cross-referenced ×1

Error Message

  1. Send a message → error: No API provider registered for api: ollama

Root Cause

The @mariozechner/pi-ai library's registerBuiltInApiProviders() in providers/register-builtins.js registers exactly 10 API types:

  • anthropic-messages, openai-completions, mistral-conversations, openai-responses, azure-openai-responses, openai-codex-responses, google-generative-ai, google-gemini-cli, google-vertex, bedrock-converse-stream

ollama is NOT registered. There is no ollama.js provider file in pi-ai/dist/providers/.

The changelog references a partial fix:

"register custom api: "ollama" handling for compaction, branch-style internal summarization, and TTS text summarization..."

This fixed compaction/TTS subsystems but not the main model call path.

Fix Action

Fix / Workaround

Working Workaround

Patch register-builtins.js — register ollama as alias for openai-completions:

PR fix notes

PR #69703: fix(providers): register ollama api as openai-completions transport (#69683)

Description (problem / solution / changelog)

Summary

Fixes #69683 — models configured with api: "ollama" throw No API provider registered for api: ollama at runtime despite the config being accepted and hot-reloaded by the gateway.

Root cause

The call path for a model call with a custom provider is:

registerProviderStreamForModel()
  → resolveProviderStreamFn()               // no ollama plugin → undefined
  → createTransportAwareStreamFnForModel()  // ollama ∉ SUPPORTED_TRANSPORT_APIS → undefined
→ streamFn = undefined
→ ensureCustomApiRegistered() is never called
→ pi-ai runtime: "No API provider registered for api: ollama"

ollama was missing from three structures in provider-transport-stream.ts:

StructureEffect of omission
SUPPORTED_TRANSPORT_APISisTransportAwareApiSupported('ollama') returns false
SIMPLE_TRANSPORT_API_ALIASNo transport alias for model normalisation paths
createSupportedTransportStreamFn() switchReturns undefined instead of a StreamFn

Because streamFn was undefined, ensureCustomApiRegistered() was never called, so the pi-ai provider registry never got an entry for api: "ollama".

Fix

Register ollama as an OpenAI-completions alias in all three places:

// SUPPORTED_TRANSPORT_APIS
"ollama",  // ← added

// SIMPLE_TRANSPORT_API_ALIAS
"ollama": "openclaw-openai-completions-transport",  // ← added

// createSupportedTransportStreamFn()
case "openai-completions":
case "ollama":  // ← added (fall-through)
  return createOpenAICompletionsTransportStreamFn();

Ollama Cloud and local Ollama both expose a /v1/chat/completions endpoint that is fully OpenAI-compatible, including tool-calling (confirmed by the issue reporter).

Before / After

BeforeAfter
isTransportAwareApiSupported('ollama')falsetrue
createBoundaryAwareStreamFnForModel(model)undefinedStreamFn
Model callNo API provider registered for api: ollama✅ succeeds

Tests

Added 5 new tests tagged #69683:

  • isTransportAwareApiSupported returns true for 'ollama'
  • resolveTransportAwareSimpleApi returns 'openclaw-openai-completions-transport'
  • createBoundaryAwareStreamFnForModel returns a function (no transport overrides)
  • createTransportAwareStreamFnForModel does not throw with proxy override
  • prepareTransportAwareSimpleModel aliases api to openclaw-openai-completions-transport

Updated 2 existing tests that asserted ollama was unsupported. They now use mistral-conversations (a genuinely unsupported api) so the fail-closed contract continues to be exercised.

Fixes #69683

Changed files

  • src/agents/provider-transport-stream.test.ts (modified, +80/-13)
  • src/agents/provider-transport-stream.ts (modified, +12/-0)

Code Example

No API provider registered for api: ollama

---

registerApiProvider({
    api: "ollama",
    stream: streamOpenAICompletions,
    streamSimple: streamSimpleOpenAICompletions,
});
RAW_BUFFERClick to expand / collapse

Bug Summary

When configuring a custom provider with api: "ollama" in openclaw.json, the config schema accepts it and the gateway hot-reloads it successfully, but at runtime the model call throws:

No API provider registered for api: ollama

Root Cause

The @mariozechner/pi-ai library's registerBuiltInApiProviders() in providers/register-builtins.js registers exactly 10 API types:

  • anthropic-messages, openai-completions, mistral-conversations, openai-responses, azure-openai-responses, openai-codex-responses, google-generative-ai, google-gemini-cli, google-vertex, bedrock-converse-stream

ollama is NOT registered. There is no ollama.js provider file in pi-ai/dist/providers/.

The changelog references a partial fix:

"register custom api: "ollama" handling for compaction, branch-style internal summarization, and TTS text summarization..."

This fixed compaction/TTS subsystems but not the main model call path.

Reproduction

  1. Configure Ollama cloud provider with "api": "ollama" in openclaw.json
  2. Set as primary or select via model picker
  3. Send a message → error: No API provider registered for api: ollama

Working Workaround

Patch register-builtins.js — register ollama as alias for openai-completions:

registerApiProvider({
    api: "ollama",
    stream: streamOpenAICompletions,
    streamSimple: streamSimpleOpenAICompletions,
});

Ollama Cloud's /v1/chat/completions is OpenAI-compatible. Tool calling confirmed working.

Suggested Fix

Add ollama to registerBuiltInApiProviders() — either as native provider or openai-completions alias. One-line fix.

Environment

  • OpenClaw: 2026.4.15 (041266a)
  • Node: v22.22.0
  • OS: Linux 6.8.12-20-pve (Proxmox/Debian)
  • Provider: Ollama Cloud (ollama.com)
  • Model: glm-5.1

extent analysis

TL;DR

Register the ollama API provider in the registerBuiltInApiProviders() function to fix the No API provider registered for api: ollama error.

Guidance

  • Verify that the ollama API is compatible with the openai-completions provider, as it is currently being used as an alias in the working workaround.
  • Apply the suggested fix by adding ollama to the registerBuiltInApiProviders() function, either as a native provider or as an alias for openai-completions.
  • Test the fix by configuring the Ollama cloud provider with "api": "ollama" in openclaw.json and sending a message to ensure the error is resolved.
  • Consider creating a native ollama provider if the alias workaround is not sufficient or if Ollama Cloud's API diverges from OpenAI's in the future.

Example

registerApiProvider({
    api: "ollama",
    stream: streamOpenAICompletions,
    streamSimple: streamSimpleOpenAICompletions,
});

This code snippet registers ollama as an alias for openai-completions, which is the working workaround mentioned in the issue.

Notes

The fix assumes that the ollama API is compatible with the openai-completions provider. If this is not the case, a native ollama provider may need to be created.

Recommendation

Apply the workaround by registering ollama as an alias for openai-completions in the registerBuiltInApiProviders() function, as this is a simple and effective solution that has been confirmed to work.

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

openclaw - ✅(Solved) Fix Bug: api: "ollama" not registered in pi-ai provider registry — throws "No API provider registered for api: ollama" [1 pull requests, 1 participants]