[FEATURE] A way to skip that "Do you want to use this API key?" question on startup
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
I'm helping run a class on Claude Code for a relatively non-technical audience. We're using GitHub Codespaces with a pre-configured API key for this, but we have a problem that the first time they start Claude Code it asks them this question:
They keep hitting "Yes" because that's "recommended", but that breaks things and causes great confusion, we need them to accept the API key that we've pre-configured for them.
Feature request: a documented way to avoid this. Maybe an environment variable like CLAUDE_CODE_ACCEPT_API_KEY=1 or similar.
Proposed Solution
An environment variable that skips that question, something like:
CLAUDE_CODE_ACCEPT_API_KEY=1
Alternative Solutions
I'm currently trying to work around this by running the following script on Codespaces startup:
if [ -z "${ANTHROPIC_API_KEY:-}" ]; then
echo "ANTHROPIC_API_KEY is not set"
else
cat > ~/.claude.json <<CLAUDE_JSON
{
"hasCompletedOnboarding": true,
"customApiKeyResponses": {
"approved": [
"${ANTHROPIC_API_KEY: -20}"
],
"rejected": []
}
}
CLAUDE_JSON
fi
It does not feel like a robust and future-proof solution though.
Priority
Medium - Would be very helpful
Feature Category
Configuration and settings
Use Case Example
_No response_
Additional Context
_No response_
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗