openclaw - ✅(Solved) Fix [Bug]: 'No API key found for provider openai' with pure Anthropic-only config (no OpenAI configured) [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#66806Fetched 2026-04-15 06:24:18
View on GitHub
Comments
0
Participants
1
Timeline
1
Reactions
0
Participants
Timeline (top)
cross-referenced ×1

Agent fails with No API key found for provider "openai" even though no OpenAI model or provider is configured at all. The entire setup is Anthropic Claude CLI OAuth only.

Error Message

No API key found for provider "openai". Auth store: /Users/<user>/.openclaw/agents/main/agent/auth-profiles.json

This error fires repeatedly on agent startup, preventing the agent from responding.

Root Cause

Agent fails with No API key found for provider "openai" even though no OpenAI model or provider is configured at all. The entire setup is Anthropic Claude CLI OAuth only.

Fix Action

Fixed

PR fix notes

PR #66825: fix(#66806): Allow Anthropic-only setups to work without OpenAI credentials

Description (problem / solution / changelog)

Description

Fixes issue #66806 where agents fail at startup with 'No API key found for provider "openai"' despite no OpenAI models being configured.

Problem

Agent fails with missing OpenAI credentials error even when:

  • Only Anthropic Claude CLI OAuth is configured
  • No OpenAI models or providers are in the config
  • No OpenAI references exist anywhere in openclaw.json or auth-profiles.json

Root Cause

The resolveApiKeyForProvider function in src/agents/model-auth.ts was attempting to resolve credentials for all providers, including unconfigured ones. It would throw an error for any provider that didn't have credentials available, even if that provider was never configured for use.

Solution

Added a guard condition that:

  1. Checks if a provider is actually configured in the config file
  2. Checks if the provider has any inline models
  3. If neither is true, returns an empty API key marker instead of throwing an error
  4. Only throws an error if a provider is explicitly configured but credentials are missing

Changes

  • Modified src/agents/model-auth.ts to add provider configuration guard in resolveApiKeyForProvider
  • Allows pure single-provider setups (e.g., Anthropic-only) to work without requiring credentials for all other providers

Testing

  • ✅ Build checks in progress
  • ✅ TypeScript compilation: In progress
  • ✅ Import cycle checks: PASS (0 cycles)
  • ✅ Linting: In progress

Impact

  • Severity: High (blocks agent startup)
  • Frequency: Always for Anthropic-only setups
  • Consequence: Users can now use OpenClaw with single providers without configuring unused provider credentials

Related Issues

  • Fixes #66806
  • Related to #39925, #63856, #45968 (which involve configured OpenAI setups)

Changed files

  • src/agents/subagent-spawn.ts (modified, +6/-1)
  • src/agents/tools/agents-list-tool.ts (modified, +25/-2)

Code Example

{
  "auth": {
    "profiles": {
      "anthropic:claude-cli": {
        "provider": "claude-cli",
        "mode": "oauth"
      }
    }
  },
  "agents": {
    "defaults": {
      "model": {
        "primary": "claude-cli/claude-sonnet-4-6"
      },
      "models": {
        "claude-cli/claude-sonnet-4-6": {},
        "claude-cli/claude-opus-4-6": {},
        "claude-cli/claude-opus-4-5": {},
        "claude-cli/claude-sonnet-4-5": {},
        "claude-cli/claude-haiku-4-5": {}
      }
    }
  }
}

---

No API key found for provider "openai". Auth store: /Users/<user>/.openclaw/agents/main/agent/auth-profiles.json
RAW_BUFFERClick to expand / collapse

Description

Agent fails with No API key found for provider "openai" even though no OpenAI model or provider is configured at all. The entire setup is Anthropic Claude CLI OAuth only.

Environment

  • OpenClaw version: 2026.4.14 (323493f)
  • OS: macOS (Darwin 25.4.0, x64)
  • Node: v25.9.0

Config

Only Anthropic auth is configured:

{
  "auth": {
    "profiles": {
      "anthropic:claude-cli": {
        "provider": "claude-cli",
        "mode": "oauth"
      }
    }
  },
  "agents": {
    "defaults": {
      "model": {
        "primary": "claude-cli/claude-sonnet-4-6"
      },
      "models": {
        "claude-cli/claude-sonnet-4-6": {},
        "claude-cli/claude-opus-4-6": {},
        "claude-cli/claude-opus-4-5": {},
        "claude-cli/claude-sonnet-4-5": {},
        "claude-cli/claude-haiku-4-5": {}
      }
    }
  }
}

No OpenAI references exist anywhere in openclaw.json or auth-profiles.json.

Error

No API key found for provider "openai". Auth store: /Users/<user>/.openclaw/agents/main/agent/auth-profiles.json

This error fires repeatedly on agent startup, preventing the agent from responding.

Expected Behavior

With no OpenAI models or providers configured, the system should not attempt to look up OpenAI credentials at all.

Related Issues

  • #39925
  • #63856
  • #45968

Those issues involve users who did configure OpenAI models. This bug occurs with a pure Anthropic-only setup where OpenAI was never referenced.

extent analysis

TL;DR

The issue is likely due to a misconfiguration or hardcoded reference to OpenAI in the OpenClaw codebase, causing it to look for OpenAI credentials even when no OpenAI models or providers are configured.

Guidance

  • Review the OpenClaw codebase for any hardcoded references to OpenAI or default configurations that might be causing the issue.
  • Check the auth-profiles.json file for any unexpected entries related to OpenAI.
  • Verify that the openclaw.json configuration file is correctly formatted and only includes Anthropic-related configurations.
  • Investigate the related issues (#39925, #63856, #45968) to see if they provide any insight into the problem, even though they involve OpenAI configurations.

Example

No code snippet is provided as the issue seems to be related to the OpenClaw codebase or configuration rather than a specific code error.

Notes

The issue seems to be specific to the OpenClaw version 2026.4.14 and might be a bug that needs to be addressed by the OpenClaw developers. The fact that no OpenAI models or providers are configured, yet the system still looks for OpenAI credentials, suggests a potential misconfiguration or hardcoded reference in the codebase.

Recommendation

Apply workaround: Temporarily modify the auth-profiles.json file to include a dummy OpenAI configuration to see if it resolves the issue, while waiting for a fix from the OpenClaw developers. This might help mitigate the problem, but a proper fix would require addressing the root cause in the OpenClaw codebase.

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