Description
We want an agent skill (under ai_provider_openai/.agents/skills/) that sets up the OpenAI provider from an API key that already exists on the system as an environment variable. The skill must work without ever exposing the key's value: it checks only that the variable is set, then wires it in through the Key module's environment key provider so the secret never lands in configuration.
This skill does not use the Tool API — it is driven entirely through drush and a small shell check. It is a sibling, in approach, to the AI-core configuration skills (ai#3586561 and ai#3586562), but lives in this provider's repository.
The provider stores its key as a reference to a Key entity in ai_provider_openai.settings (api_key); the Key module's EnvKeyProvider lets that Key read its value from an environment variable at runtime.
Tasks
- Add the
setup-providerskill underai_provider_openai/.agents/skills/. - Ask for the environment variable name that holds the OpenAI API key. If the user does not have one, explain how to obtain a key (platform.openai.com/api-keys) and how to expose it as an environment variable for the web/CLI environment.
- Check existence without exposing the value — provide a bash script that verifies the environment variable is set and non-empty, reporting only present/absent (never printing the key's value).
- Create the Key — use drush to create a
keyconfiguration that reads from that environment variable (Key module environment provider), labelledOpenAI Key. - Wire it into the provider — use drush to set that key as the provider's
api_keyinai_provider_openai.settings.
Acceptance criteria
- The skill confirms the environment variable exists without ever printing or logging its value.
- When the user has no key, the skill explains how to generate one and expose it as an environment variable.
- An
OpenAI KeyKey entity is created that resolves its value from the environment variable. - The OpenAI provider's
api_keypoints at that Key, so the provider is usable, with the secret stored only in the environment.
Related issues
Relates to the AI-core configuration skills ai#3586561 and ai#3586562.
Issue fork ai_provider_openai-3605812
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
vidit.anjaria commentedComment #3
vidit.anjaria commentedComment #4
vidit.anjaria commentedComment #5
joshua1234511Comment #7
joshua1234511