# Setting up Claude-Code with API Key

As of the writing of this blog post, there was no straight forward way to use API key with Claude code.

## I found following way

I have figured out following way, but not sure if they will change something in future which will break this, by the time you read this article.

But anyways, here is the simple steps:

1. ### Open `~/.claude/settings.json` file in your editor and put following code:
    

```bash
cat ~/.claude/settings.json

{
  "apiKeyHelper": "~/.claude/anthropic_key.sh"
}
```

2. **Now create that shell script file, and open in your code editor e.g:** `vi ~/.claude/anthropic_key.sh` **and put following content in it, replace with your correct API key here.**
    

```bash
echo "sk_your_anthropic_api_key"
```

3. **Make the shell script executable**
    

```bash
sudo chmod +x ~/.claude/anthropic_key.sh
```

That’s it, now if you run `claude` it should confirm with you do you really want to API key, you should say **yes** or choose the option that says **yes**

Enjoy!!
