-
Notifications
You must be signed in to change notification settings - Fork 2.6k
EnvVar support for API keys #3032
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
mrubens
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea of this - let us know when it's ready for review!
Thanks @mrubens! Ready for review although I did not update i18n except EN (do you have a tool to aid translations?) |
scripts/find-missing-translations.js
Outdated
Check warning
Code scanning / CodeQL
Prototype-polluting function Medium
here
current
I'm adding a "--create-missing" option to the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is the right translation key
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for catching -- fixed here and other providers
mrubens
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UX-wise, I think this might be better as some sort of toggle between the API key input and the env var configuration. I need to think a little bit about the best way.
@mrubens what do you think of just a checkbox with label "Read API Key from environment variable OPEN_AI_API_KEY" and so on. IE, we just specify the environment var we'll check instead of collecting it through a form element. Might make things simpler. |
@mrubens I made a field toggle for the Anthropic provider (screenshots of two states in PR description) -- let me know what you think |
75aaadb to
4ea7562
Compare
|
will reopen after some refactoring |
Signed-off-by: Geoff Wilson <[email protected]>
|
Reopen with rebase and new approach |
|
@suprjinx After reviewing your approach, I think we’d benefit from discussing this idea through an issue first, following our Issue-First approach. This helps us align on the scope, complexity, and broader applicability before investing effort into implementation. The current solution, focused specifically on the Anthropic provider, feels like it addresses a fairly niche use case. Opening an issue to discuss it first would help ensure we’re aligned on whether this complexity fits well into Roo’s overall direction and provider integration strategy. Would you mind creating an issue outlining your motivation and providing some context around the broader benefits? We can quickly review and agree on a path forward from there. |
Thanks for feedback, @hannesrudolph -- I can't create a New Feature issue, it just directs to the discussions. This discussion was the starting point: #2057. The intention was to implement for all providers supporting api keys, not just Anthropic -- was just trying to get a prototype nailed down. |
|

Context
This PR will add support for specifying an ENV VAR name for API keys, which is useful in cases where the secret is more dynamic and/or is injected into the dev environment.
Implementation
The high level approach was to add an additional text field to the ApiOptions component for specifying the the ENV VAR name which holds the api key. API client will fetch the API key from this ENV VAR when the name is provided.
Screenshots
Before



After
How to Test
Get in Touch
Important
Adds support for using environment variables to store API keys, updating backend logic, schemas, and UI components to accommodate this feature.
buildApiHandler()inindex.ts.getEnvVar()inindex.tsto fetch API keys from environment variables if specified.validateApiConfiguration()invalidate.tsto check for either API key or environment variable name.apiKeyEnvVarfields to various provider schemas inschemas/index.ts.Anthropic.tsx,DeepSeek.tsx,Gemini.tsx, etc., to include input fields for environment variable names.settings.jsonfor new translations related to environment variable support.This description was created by
for 1b9fcf3b5bbaa29d72d69fc66fc3b9694cabff37. You can customize this summary. It will automatically update as commits are pushed.