Skip to content

Instantly share code, notes, and snippets.

@jbenner-radham
Last active March 18, 2026 20:24
Show Gist options
  • Select an option

  • Save jbenner-radham/e43f428870be5128d4f53206b27a96dd to your computer and use it in GitHub Desktop.

Select an option

Save jbenner-radham/e43f428870be5128d4f53206b27a96dd to your computer and use it in GitHub Desktop.

Use Claude Code with an API Key

  1. If you are currently logged into Claude Code run /logout to logout and then /exit to exit the app.
  2. Define an environment variable named ANTHROPIC_API_KEY with your API key as the value. This can be done at a system level, or via your Claude config (e.g., env.ANTHROPIC_API_KEY: $YOUR_API_KEY).
  3. Go into your user level Claude settings at $HOME/.claude.json and set hasCompletedOnboarding to true.
  4. Launch Claude Code, and you should be good to go.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment