Docs/UI: warn clearly when API keys or env vars override login/subscription auth
To upvote this issue, give it a thumbs up. See this list for the most upvoted issues.
ECA seems to prefer API-key-based auth over login/subscription auth for providers like OpenAI and Anthropic, when the key comes from environment variables such as OPENAI_API_KEY or ANTHROPIC_API_KEY.
I ran into this unexpectedly and consumed paid API credits before realizing that ECA was not using my logged-in subscription auth.
What I found
On the docs page below, there is only a brief and fairly buried note:
- https://eca.dev/config/models/
In the “Credential File Authentication” section, under “Notes”, it says:
Authentication priority (short):
key(with dynamic string pase support) > OAuth.
This is too indirect to make the behavior clear in practice, especially because:
- the docs do not clearly say that
OPENAI_API_KEY/ANTHROPIC_API_KEYcan override login/subscription auth - there does not seem to be an obvious warning during
/loginwhen both auth sources are available
Why this matters
This can lead to unexpected paid usage. A user may think they are using their subscription login, while ECA is actually using a paid API key from the environment.
Suggested improvements
Any of the following would help:
-
Documentation
- Add an explicit warning in
config/models:- if API keys are configured, including through environment variables, they may take precedence over OAuth/login auth
- mention the common env vars explicitly:
OPENAI_API_KEY,ANTHROPIC_API_KEY
- Add an explicit warning in
-
Login/UI warning
- During
/login, warn if a key/env-based auth source already exists for that provider - Example: “An API key is already configured/resolved for this provider and may take precedence over login auth.”
- During
-
Optional confirmation
- If both login auth and API-key auth are available, ask which one should be preferred
Sorry for that @christophe-gouel, will take a look and try to improve those!
@christophe-gouel improved docs + warning on /login, thank you!
Excellent. Thanks a lot @ericdallo @ericdallo!