Open NiloCK opened 2 months ago
Initially I was skeptical of this idea, but I'm warming to it. I wonder if instead of polluting the settings namespace at various depths with *_variable
keys we could instead explicitly support a layer of env var redirection:
{
"environment": {
"ANTHROPIC_API_KEY": "ANTHROPIC_API_KEY_NILOCK_ZED",
"GITHUB_TOKEN": "WORK_GITHUB_TOKEN"
}
}
Looks like a clean & universal solution.
I have a pretty strong preference for giving individual apps (and individual repos) their own API keys as an accounting mechanism.
Thanks for considering it.
We could even support shell-style variable fallback syntax if we wanted to be fancy.
So you could an override a default environment variable if it were present but fallback to a default if the override was unset. Just spit-ballin:
"environment": {
"ANTHROPIC_API_KEY": "${ANTHROPIC_API_KEY_NILOCK_ZED:-$ANTHROPIC_API_KEY}",
}
Check for existing issues
Describe the feature
Zed looks for an Anthropic api key through the environment variable variable
ANTHROPIC_API_KEY
. This value seems to be hard coded.I'd like it to use a namespaced key (eg,
ANTHROPIC_API_KEY_NILOCK_ZED
).If applicable, add mockups / screenshots to help present your vision of the feature
The settings for LLMs could include a setting for this. From
Default Settings
: