-
-
Notifications
You must be signed in to change notification settings - Fork 69.5k
Surface detected-but-unconfigured provider env vars instead of silently activating them #33328
Description
Related
References #33327 (implicit provider auto-discovery bug)
Summary
When a user adds a new provider env var to their shell (e.g., OPENAI_API_KEY for a different tool), OpenClaw silently registers that provider and will route traffic to it — including as a fallback when configured providers fail. The user has no way to know this happened until they see unexpected charges or hit auth errors from a provider they never configured in OpenClaw.
After the fix in #33327 stops implicit merging for users with explicit models.providers, there should still be a way for users to discover that new provider credentials are available in their environment — without requiring them to know which env vars map to which providers.
Current Behavior
If OPENAI_API_KEY appears in the environment, OpenClaw silently registers an OpenAI provider. There is no notification — either it works (silently, potentially routing traffic and incurring costs on an account the user did not intend) or it errors (confusingly, on gateway startup).
Suggested Behavior
On gateway startup, when models.providers is configured and new provider env vars are detected that are not in the configured providers, log an informational message:
ℹ️ Detected OPENAI_API_KEY but openai is not in configured providers.
Run `openclaw models add openai` to enable.
To avoid nagging every restart, track dismissed providers in the settings file (e.g., models.dismissedProviders: ["openai"]). If a user removes a provider from that list, it re-detects on next startup — creating an easy ramp for switching providers later without a full reconfiguration.