fix: write api_key auth profiles for key providers (OpenClaw 2026.6.8 compat) - #214
Conversation
… compat) OpenRouter/anthropic/openai/google chats failed with '401 Missing Authentication header' on OpenClaw 2026.6.8. ClawBox wrote their auth as type:"token" profiles (and OpenRouter's provider apiKey as the placeholder "openrouter-ref"); 2026.6.6 resolved those, but 2026.6.8 reworked auth resolution and no longer turns a token-mode profile into an Authorization header, nor resolves the placeholder — it sends models.providers.*.apiKey verbatim. Write the same type:"api_key" shape the working providers (clawai/ollama/llamacpp) use, and inline OpenRouter's real key. Verified end-to-end on device against 2026.6.8.
|
Warning Review limit reached
More reviews will be available in 17 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Problem
On OpenClaw 2026.6.8, OpenRouter (and anthropic/openai/google) chats fail with:
ClawBox writes these key-based providers' auth as
type: "token"profiles, and OpenRouter'smodels.providers.openrouter.apiKeyas the placeholder"openrouter-ref"(a reference the old gateway resolved from the profile). OpenClaw 2026.6.6 honored that; 2026.6.8 reworked auth resolution — it no longer turns atoken-mode profile into anAuthorizationheader, and it sendsmodels.providers.*.apiKeyverbatim. So"openrouter-ref"went out as the bearer → 401.Fix
Write the same
type: "api_key"shape the already-working providers (clawai/ollama/llamacpp) use, and inline OpenRouter's real key:elsebranch:type:"token"/token:→type:"api_key"/key:auth.profiles.<key>mode:… : token→subscription ? oauth : api_key(de-special-cases the per-provider guard)apiKey:"openrouter-ref"→apiKey: <real key>(mirrors the clawai/deepseek providerDefs)Covers all key-based providers, not just OpenRouter, since they all hit the same branch.
Verification
openrouter/anthropic/claude-haiku-4.5loaded, 401 gone, key validates against OpenRouter/auth/key(200).api_key+key; OpenRouter test asserts the inlined real key (notopenrouter-ref) +api_keyprofile.Follow-up (not this PR)
configure/route.tscould extract awriteApiKeyProfile()helper to collapse the four now-identicalapi_keybranches and migrate toopenclaw onboard --auth-choice <provider>-api-key(the schema-robust canonical path the in-file comment already flags). Kept out of scope to keep this fix minimal.