openclaw - ✅(Solved) Fix [Bug]: Ollama Cloud Authentication fails with 401 after update to 2026.3.31 [1 pull requests, 4 comments, 5 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#59205Fetched 2026-04-08 02:27:34
View on GitHub
Comments
4
Participants
5
Timeline
12
Reactions
3
Author
Assignees
Timeline (top)
commented ×4subscribed ×3cross-referenced ×2labeled ×2

After updating OpenClaw from version 2026.3.24 to 2026.3.31, all requests to Ollama Cloud models fail with HTTP 401 "unauthorized". The same API key works perfectly when tested directly via curl against the Ollama API.

Root Cause

After updating OpenClaw from version 2026.3.24 to 2026.3.31, all requests to Ollama Cloud models fail with HTTP 401 "unauthorized". The same API key works perfectly when tested directly via curl against the Ollama API.

Fix Action

Fixed

PR fix notes

PR #59310: fix(ollama): prefer real cloud auth over local marker

Description (problem / solution / changelog)

Summary

  • defer the synthetic ollama-local auth profile until after real Ollama env and configured credentials are checked
  • keep local-only Ollama setups working by falling back to the stored local marker when no real credential exists
  • add regression coverage for env, configured key, fallback, and real-profile precedence

Closes #59205. Related: #58384, #58457.

Test plan

  • pnpm test -- src/agents/model-auth.profiles.test.ts -t "ollama"
  • pnpm build
  • pnpm check (attempted; currently fails in unrelated extensions/diffs/src/language-hints.test.ts)
  • pnpm test (attempted; currently fails in unrelated src/tts/status-config.test.ts)

Notes

  • Testing level: targeted regression coverage plus build, with broader repo gates attempted and recorded above
  • AI-assisted: yes

Made with Cursor

Changed files

  • src/agents/model-auth.profiles.test.ts (modified, +170/-0)
  • src/agents/model-auth.ts (modified, +25/-0)

Code Example

Tested with baseUrl: "https://ollama.com/api"Results in 404 (double /api/api/chat path)
Tried restarting gateway after config changes
Token is confirmed valid via direct API call
Issue appears to be in how OpenClaw 2026.3.31 constructs/sends the Authorization header
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

After updating OpenClaw from version 2026.3.24 to 2026.3.31, all requests to Ollama Cloud models fail with HTTP 401 "unauthorized". The same API key works perfectly when tested directly via curl against the Ollama API.

Steps to reproduce

Have a working setup with Ollama Cloud provider on version ≤2026.3.24 Update OpenClaw to version 2026.3.31 Attempt to use any Ollama Cloud model (e.g., kimi-k2.5:cloud) Observe 401 authentication errors Also on 2026.04.01

Expected behavior

Ollama Cloud requests should authenticate successfully using the configured API key, as they did in version 2026.3.24.

Actual behavior

HTTP 401: unauthorized failoverReason: auth model: kimi-k2.5:cloud provider: ollama rawErrorPreview: 401 unauthorized

OpenClaw version

2026.4.1

Operating system

6.12.74+deb13+1-amd64

Install method

pnpm

Model

Ollama Cloud

Provider / routing chain

openclaw ollama all llm

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Tested with baseUrl: "https://ollama.com/api" → Results in 404 (double /api/api/chat path)
Tried restarting gateway after config changes
Token is confirmed valid via direct API call
Issue appears to be in how OpenClaw 2026.3.31 constructs/sends the Authorization header

Impact and severity

No response

Additional information

No response

extent analysis

TL;DR

The issue can likely be resolved by adjusting how OpenClaw constructs or sends the Authorization header for Ollama Cloud API requests.

Guidance

  • Verify the Authorization header construction in OpenClaw version 2026.3.31 to ensure it matches the expected format for Ollama Cloud API authentication.
  • Compare the Authorization header sent by OpenClaw with the one sent by curl when testing the API key directly to identify any discrepancies.
  • Check the Ollama Cloud API documentation for any recent changes in authentication requirements or header formats that might affect OpenClaw's compatibility.
  • Consider testing with an earlier version of OpenClaw (e.g., 2026.3.24) to confirm the issue is indeed related to the update.

Example

No specific code snippet can be provided without more details on OpenClaw's internal implementation. However, ensuring the Authorization header is correctly formatted (e.g., Authorization: Bearer YOUR_API_KEY) is crucial.

Notes

The exact solution depends on the specifics of how OpenClaw handles API keys and constructs the Authorization header, which is not detailed in the issue. The baseUrl test resulting in a 404 with a double /api/api/chat path suggests potential issues with URL construction or handling in OpenClaw.

Recommendation

Apply a workaround by manually adjusting the Authorization header in OpenClaw to match the format expected by the Ollama Cloud API, if possible, until a formal fix is available.

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…

FAQ

Expected behavior

Ollama Cloud requests should authenticate successfully using the configured API key, as they did in version 2026.3.24.

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]: Ollama Cloud Authentication fails with 401 after update to 2026.3.31 [1 pull requests, 4 comments, 5 participants]