agentleFS
OpenAIKnown publisheropenai/openai-developers-for-claude/plugins/openai-developers/skills/openai-platform-api-key/SKILL.md

openai-platform-api-key

Skill41 starsChanged 5 months agoApache-2.0View on GitHub

Use when Claude Code is asked to build, run, test, debug, or configure an OpenAI-backed or provider-unspecified AI app, UI, script, CLI, generator, or tool, especially requests phrased only as "using AI" or generators driven by forms/user input; also use for OPENAI_API_KEY or sk-proj setup. Do not gate model or prompt migrations that can proceed with source edits and offline validation. Otherwise treat this as the credential gate: inspect safely, ask reuse-vs-new before API work, guide manual local setup when needed, verify presence, and never expose plaintext.

  • Reads credentials

3 other projects use a version of this, 3 of them edited.

Adopted by

Most recently taken up by

  • Other versions3 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 3

    1. openai/plugins★ 8.4k48% same
    2. openai/openai-developers-for-cursor★ 1397% same
    3. Geruyang/skills★ 242% same

    Wrote their own version · 0

    None found.

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository5 other files it gives its agents.

The file

Show its rules and text

We split this skill into the rules it gives an agent

32 rules. 16 are common, 8 are distinctive, and 8 are very specific to this project.

  • 16

    Common

    Most of the 3 edited versions we read keep these.

  • 8

    Distinctive

    This author's own choices. Worth a look.

  • 8

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this as the credential gate for OpenAI API-backed work in Claude Code.

    line 7
  2. Common:

    Use this skill as the credential gate for API-backed work, not as the app, docs, or implementation skill.

    line 11
  3. Common:

    Do not use it when:

    line 21
  4. Common:

    If API access is needed and no usable key is found, guide the user through manual local setup instead of leaving placeholder docs or …

    line 29
  5. Common:

    Before editing, testing, running, debugging, or configuring any code that calls the OpenAI API, except for the model/prompt migration …

    line 37
  6. Common:

    Stop until the user answers.

    line 41
  7. Common:

    no live API call will be made

    line 46
  8. Common:

    no secret will be written

    line 47
  9. Distinctive:

    After inspecting credentials, the next user-facing message must be the credential decision message.

    line 56
  10. Common:

    Use one of these branches:

    line 58
  11. Very specific:

    No usable key found: make clear that the OpenAI API will power the app, script, or project, say that no usable OPENAI_API_KEY was found, …

    line 61
  12. Common:

    After sending the credential decision message, stop until the user answers.

    line 64
  13. Very specific:

    look for a usable key without printing secret values in the current environment and likely local env files such as .env.local, .env, and …

    line 69
  14. Very specific:

    check README/setup docs, OPENAI_BASE_URL, and framework env docs for repo conventions separately from secret-bearing env files

    line 71
  15. Common:

    prefer ignored or untracked env files.

    line 72
  16. Very specific:

    default to .env.local and OPENAI_API_KEY when no stronger convention exists

    line 73
  17. Common:

    if the user explicitly asked for a new key, no reuse decision is needed

    line 76
  18. Common:

    if no usable key exists, ask whether they want to create one manually before building the rest of the app

    line 78
  19. Very specific:

    ask this up front even before any live request.

    line 79
  20. Common:

    do not silently reuse a detected key for implementation, verification, smoke tests, or other live requests just because the user did not …

    line 80
  21. Common:

    treat requests to create or configure a key as ambiguous unless the user says they want a new key

    line 81
  22. Common:

    if the user chooses reuse and a persistent file write is still needed, confirm the destination file/env var before writing

    line 82
  23. Distinctive:

    Use manual setup because this Claude Code plugin cannot mint or retrieve OpenAI API keys automatically.

    line 85
  24. Very specific:

    Ask them to place the key locally as OPENAI_API_KEY, defaulting to .env.local.

    line 88
  25. Distinctive:

    After they say setup is complete, verify presence with no-output checks before continuing.

    line 89
  26. Distinctive:

    Prefer no-output existence checks such as checking whether the environment variable is set.

    line 93
  27. Common:

    Never print, quote, summarize, or paste a plaintext key.

    line 99
  28. Very specific:

    Never inspect credentials with commands that can print secret values, such as cat .env*, grep OPENAI_API_KEY .env*, or rg OPENAI_API_KEY …

    line 100
  29. Distinctive:

    Never claim this Claude Code plugin can mint or retrieve keys automatically.

    line 101
  30. Very specific:

    Prefer .env.local unless the repo already has a better local secret convention.

    line 102
  31. Distinctive:

    Stop at the credential decision point until the user answers.

    line 103
  32. Distinctive:

    Verify the key is present before continuing with API-backed work.

    line 104

“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

OpenAI API Key Setup

Use this as the credential gate for OpenAI API-backed work in Claude Code.

When To Use

Use this skill as the credential gate for API-backed work, not as the app, docs, or implementation skill.

Use it when:

  • The user asks for an OpenAI API key, OPENAI_API_KEY, or an sk-proj key.
  • Claude Code will build, implement, run, test, debug, or configure an app, script, CLI, generator, UI, or tool that calls the OpenAI API, even before a live request and even if a usable key already exists.
  • The user asks Claude Code to build, implement, run, or configure an app, script, CLI, generator, or tool that uses AI to produce outputs from user input.
  • The user asks for an AI-powered app or UI that generates output from one or more input fields, forms, prompts, files, or other user-provided values.
  • The user says "using AI" in an app/script/build request and does not name a different provider.

Do not use it when:

  • The user only wants documentation, citations, model or API guidance, conceptual explanation, or code examples without asking Claude Code to build, run, configure, or debug an API-backed artifact.
  • The user asks for a static frontend, visual mockup, design concept, or placeholder UI with no API-backed behavior.
  • The user only asks Claude Code to write a one-off output directly and no app, script, generator, or API-backed tool is being built or run.
  • The user names a different AI provider for the artifact.
  • The user asks to migrate or update an existing OpenAI model or prompts and the work can proceed through source or configuration edits plus offline, mocked, static, fixture-based, or syntax validation. Use this skill later only if a live API request is actually needed.

If API access is needed and no usable key is found, guide the user through manual local setup instead of leaving placeholder docs or incomplete setup steps.

Coordination With Implementation Skills

When another implementation skill also applies, run this skill first only to inspect credentials safely and send the credential decision message. Until reuse-existing-key vs create-new-key is resolved, it outranks design-first and implementation-first flows; do not design UI, choose architecture, inspect API examples, write code, or run smoke tests. Model and prompt migrations are the narrow exception above: complete requested source/configuration edits and offline validation without a credential decision, then use this skill only before any live API request. After the user answers, hand off to the appropriate implementation or docs skill.

Mandatory First Step

Before editing, testing, running, debugging, or configuring any code that calls the OpenAI API, except for the model/prompt migration source edits and offline validation explicitly allowed above:

  1. Inspect for a usable OPENAI_API_KEY without printing it.
  2. Unless the user explicitly asked for a new key, ask whether to reuse an existing key or create a new one. If none exists, ask whether they want to create one manually.
  3. Stop until the user answers.

This applies even if:

  • a usable key already exists
  • no live API call will be made
  • no secret will be written
  • the task is "just create a script"

Finding an existing key is not permission to proceed. It only changes the question you ask.

The credential decision is a hard stop outside the model/prompt migration exception above. Before the user answers, do not create directories, scaffold files, draft implementation plans, wire API-dependent code, run smoke tests, or give placeholder key setup instructions. The only allowed pre-gate work is safe repo convention discovery and credential presence checks that do not print secrets.

Credential Decision Messages

After inspecting credentials, the next user-facing message must be the credential decision message. Do not send interim user-facing messages about env files, key presence, API docs, file plans, implementation shape, or setup instructions before this decision.

Use one of these branches:

  • Existing usable key found, and the user did not explicitly ask for a new key: make clear that the OpenAI API will power the app, script, or project, say that an existing usable OPENAI_API_KEY was found without revealing it, then ask whether to reuse that key or create a new one.
  • No usable key found: make clear that the OpenAI API will power the app, script, or project, say that no usable OPENAI_API_KEY was found, then ask whether they want to create one manually.
  • User explicitly asked for a new key: skip the reuse question and use the manual setup confirmation below.

After sending the credential decision message, stop until the user answers.

Workflow

  1. Inspect before acting:
    • look for a usable key without printing secret values in the current environment and likely local env files such as .env.local, .env, and ignored framework-specific env files
    • inspect env files only with no-output checks that reveal presence/absence, never with commands that echo matching lines or whole files
    • check README/setup docs, OPENAI_BASE_URL, and framework env docs for repo conventions separately from secret-bearing env files
    • prefer ignored or untracked env files; avoid tracked targets unless the user explicitly confirms that choice
    • default to .env.local and OPENAI_API_KEY when no stronger convention exists
  2. Based on that inspection:
    • for tasks that will call the OpenAI API, when asking this up-front question, mention that the OpenAI API will power the app, script, or project before mentioning whether an existing key was found
    • if the user explicitly asked for a new key, no reuse decision is needed
    • otherwise, before building, implementing, running, testing, debugging, or configuring an app or script that calls the OpenAI API, ask up front whether to reuse an existing usable key or create a new one
    • if no usable key exists, ask whether they want to create one manually before building the rest of the app
    • ask this up front even before any live request; after asking, stop without adding an app plan, file list, code sketch, manual OPENAI_API_KEY instructions, or fallback placeholder setup
    • do not silently reuse a detected key for implementation, verification, smoke tests, or other live requests just because the user did not ask about credentials
    • treat requests to create or configure a key as ambiguous unless the user says they want a new key
    • if the user chooses reuse and a persistent file write is still needed, confirm the destination file/env var before writing

Manual Setup

Use manual setup because this Claude Code plugin cannot mint or retrieve OpenAI API keys automatically.

  1. Point the user to Platform API keys.
  2. Ask them to place the key locally as OPENAI_API_KEY, defaulting to .env.local.
  3. After they say setup is complete, verify presence with no-output checks before continuing.

Safe Checks

  • Prefer no-output existence checks such as checking whether the environment variable is set.
  • For env files, only use no-output presence checks such as whether a line beginning with OPENAI_API_KEY= exists. Do not print file contents or matching lines.
  • Inspect repo conventions separately from secret-bearing files when choosing .env.local, .env, or another ignored local env file.

Rules

  • Never print, quote, summarize, or paste a plaintext key.
  • Never inspect credentials with commands that can print secret values, such as cat .env*, grep OPENAI_API_KEY .env*, or rg OPENAI_API_KEY .env*. Use silent exit-status checks or redacted summaries only.
  • Never claim this Claude Code plugin can mint or retrieve keys automatically.
  • Prefer .env.local unless the repo already has a better local secret convention.
  • Stop at the credential decision point until the user answers.
  • Verify the key is present before continuing with API-backed work.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.