OpenAI secret key, the sk- prefix with the optional proj- segment, then at least twenty key characters. Anthropic keys start sk-ant- and are excluded here, otherwise every one of them is reported as an OpenAI key. Not a personal identifier but a credential, which is exactly what must not reach a third-party model when a developer pastes a config or a traceback.
Label: OPENAI_API_KEY
(?<![A-Za-z0-9])sk-(?!ant-)(?:proj-)?[A-Za-z0-9_-]{20,}
export OPENAI_API_KEY=sk-proj-abcdefghijklmnopqrstuvwxyz0123456789ABCD → sk-proj-abcdefghijklmnopqrstuvwxyz0123456789ABCDKey sk-abcdefghijklmnopqrstuvwxyz012345 rejected. → sk-abcdefghijklmnopqrstuvwxyz012345sk-abc123risk-abcdefghijklmnopqrstuvwxyz012345sk-ant-api03-abcdefghijklmnopqrstuvwxyz0123456789Tags: international, secrets, software-dev