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-provider skill under ai_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 key configuration that reads from that environment variable (Key module environment provider), labelled OpenAI Key.
  • Wire it into the provider — use drush to set that key as the provider's api_key in ai_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 Key Key entity is created that resolves its value from the environment variable.
  • The OpenAI provider's api_key points 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.

Command icon 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

marcus_johansson created an issue. See original summary.

vidit.anjaria’s picture

Issue tags: +ai::outside
vidit.anjaria’s picture

Issue tags: +Sprint13-2026
vidit.anjaria’s picture

Issue tags: -ai::outside, -Sprint13-2026 +AI Initiative Sprint, +AI Innovation
joshua1234511’s picture

Assigned: Unassigned » joshua1234511

joshua1234511’s picture

Assigned: joshua1234511 » Unassigned
Status: Active » Needs review