openclaw - 💡(How to fix) Fix [Bug]:full profile fails with 400 API_KEY_INVALID on macOS despite valid GEMINI_API_KEY [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#53640Fetched 2026-04-08 01:25:31
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Participants
Timeline (top)
labeled ×2

Running OpenClaw 2026.3.13 on macOS. When using full, coding, or messaging profile, every message returns:

400 API key not valid - generativelanguage.googleapis.com

GEMINI_API_KEY is set in LaunchAgent plist and works via direct curl to both the models endpoint and gemini-embedding-001:embedContent. But OpenClaw still returns 400.

minimal profile works fine but disables shell access. Need full profile to use shell tools and summarize skill.

Is there a config option to specify a different embedding provider, or to disable Gemini embeddings entirely?

Root Cause

Running OpenClaw 2026.3.13 on macOS. When using full, coding, or messaging profile, every message returns:

400 API key not valid - generativelanguage.googleapis.com

GEMINI_API_KEY is set in LaunchAgent plist and works via direct curl to both the models endpoint and gemini-embedding-001:embedContent. But OpenClaw still returns 400.

minimal profile works fine but disables shell access. Need full profile to use shell tools and summarize skill.

Is there a config option to specify a different embedding provider, or to disable Gemini embeddings entirely?

RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Summary

Running OpenClaw 2026.3.13 on macOS. When using full, coding, or messaging profile, every message returns:

400 API key not valid - generativelanguage.googleapis.com

GEMINI_API_KEY is set in LaunchAgent plist and works via direct curl to both the models endpoint and gemini-embedding-001:embedContent. But OpenClaw still returns 400.

minimal profile works fine but disables shell access. Need full profile to use shell tools and summarize skill.

Is there a config option to specify a different embedding provider, or to disable Gemini embeddings entirely?

Steps to reproduce

Running OpenClaw 2026.3.13 on macOS. When using full, coding, or messaging profile, every message returns:

400 API key not valid - generativelanguage.googleapis.com

GEMINI_API_KEY is set in LaunchAgent plist and works via direct curl to both the models endpoint and gemini-embedding-001:embedContent. But OpenClaw still returns 400.

minimal profile works fine but disables shell access. Need full profile to use shell tools and summarize skill.

Is there a config option to specify a different embedding provider, or to disable Gemini embeddings entirely?

Expected behavior

Running OpenClaw 2026.3.13 on macOS. When using full, coding, or messaging profile, every message returns:

400 API key not valid - generativelanguage.googleapis.com

GEMINI_API_KEY is set in LaunchAgent plist and works via direct curl to both the models endpoint and gemini-embedding-001:embedContent. But OpenClaw still returns 400.

minimal profile works fine but disables shell access. Need full profile to use shell tools and summarize skill.

Is there a config option to specify a different embedding provider, or to disable Gemini embeddings entirely?

Actual behavior

Running OpenClaw 2026.3.13 on macOS. When using full, coding, or messaging profile, every message returns:

400 API key not valid - generativelanguage.googleapis.com

GEMINI_API_KEY is set in LaunchAgent plist and works via direct curl to both the models endpoint and gemini-embedding-001:embedContent. But OpenClaw still returns 400.

minimal profile works fine but disables shell access. Need full profile to use shell tools and summarize skill.

Is there a config option to specify a different embedding provider, or to disable Gemini embeddings entirely?

OpenClaw version

2026.3.13

Operating system

macOs

Install method

npm global

Model

openrouter/anthropic/claude-3.5-haiku

Provider / routing chain

openclaw -> openrouter -> anthropic

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

extent analysis

Fix Plan

To resolve the issue with the 400 API key not valid error, we need to configure OpenClaw to use the correct API key. Since the GEMINI_API_KEY is set in the LaunchAgent plist and works with direct curl requests, the issue might be with how OpenClaw is reading or using this environment variable.

Here are the steps to fix the issue:

  • Verify Environment Variable: Ensure that the GEMINI_API_KEY environment variable is correctly set and accessible to the OpenClaw process. You can do this by running echo $GEMINI_API_KEY in your terminal before starting OpenClaw.
  • Configure OpenClaw: If OpenClaw has a configuration file or option to specify the API key, use it. Otherwise, you might need to modify the LaunchAgent plist to ensure the environment variable is passed to OpenClaw.
  • Disable Gemini Embeddings (if necessary): If there's an option to disable Gemini embeddings entirely, this could be a temporary workaround. However, this might not be desirable if you need the embedding functionality.

Example configuration change (if OpenClaw allows specifying the API key in a config file):

{
  "embeddingProvider": {
    "apiKey": "$GEMINI_API_KEY"
  }
}

Or, if you need to disable Gemini embeddings, look for an option like:

{
  "useGeminiEmbeddings": false
}

Verification

After making these changes, restart OpenClaw and test it with the full, coding, or messaging profile to see if the 400 API key not valid error persists.

Extra Tips

  • Ensure your GEMINI_API_KEY is valid and not expired.
  • Check OpenClaw's documentation for any specific instructions on setting environment variables or configuring API keys.
  • If the issue persists, consider reaching out to OpenClaw's support or checking their community forums for similar issues.

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

Running OpenClaw 2026.3.13 on macOS. When using full, coding, or messaging profile, every message returns:

400 API key not valid - generativelanguage.googleapis.com

GEMINI_API_KEY is set in LaunchAgent plist and works via direct curl to both the models endpoint and gemini-embedding-001:embedContent. But OpenClaw still returns 400.

minimal profile works fine but disables shell access. Need full profile to use shell tools and summarize skill.

Is there a config option to specify a different embedding provider, or to disable Gemini embeddings entirely?

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING