Authentication & Accounts
Module: Getting Started | Lesson: 4 of 6 | Time: ~10 minutes
In this lesson, you will start Claude Code for the first time, log in with your account, and verify that everything is working. By the end, you will be authenticated and ready to have your first conversation.
What You Will Learn
- What happens on your first run of Claude Code
- The different ways to authenticate (subscription vs. API key)
- How billing works and how to monitor your usage
Prerequisites
- Completed Installing Claude Code
- Claude Code is installed and the
claudecommand works in PowerShell
Starting Claude Code for the First Time
Let's launch Claude Code. Open PowerShell (search for "PowerShell" in the Start menu if it's not already open) and type:
claude
Press Enter.
The very first time you run this, Claude Code will not start a conversation right away. Instead, it will ask you to log in. You will see a message that looks something like this:
Welcome to Claude Code!
To get started, you need to authenticate.
? How would you like to authenticate?
❯ Claude.ai (Pro/Max subscription)
Anthropic API key
Use the arrow keys on your keyboard to highlight your choice, then press Enter.
Don't worry if it looks slightly different on your screen -- the important thing is that Claude Code is asking how you want to log in.
Authentication Options
There are two main ways to authenticate. Read both options below and pick the one that fits you.
Option 1: Claude Pro or Max Subscription (Recommended for Beginners)
If you already have a claude.ai account with a Pro ($20/month) or Max ($100/month) subscription, this is the easiest path.
What to do:
- When Claude Code asks how to authenticate, select Claude.ai (Pro/Max subscription) and press Enter.
- Claude Code will automatically open your web browser to a login page.
- Log in with the email address you use for claude.ai.
- After you log in on the website, it will show a confirmation code or automatically send a token back to Claude Code.
- Switch back to your PowerShell window. You should see a message confirming you are logged in.
That's it! Claude Code is now connected to your subscription account.
For this tutorial series, a Pro subscription ($20/month) is the easiest way to get started. You get Claude Code access included with your subscription -- no extra setup needed.
Option 2: Anthropic Console / API Key (Pay-As-You-Go)
This option is for power users or anyone who prefers to pay only for what they use rather than a monthly subscription.
Step 1: Create a Console Account
- Open your web browser and go to https://console.anthropic.com.
- Create an account (or log in if you already have one).
- Add billing credits. The minimum is $5, which will last a good while for learning.
Step 2: Get Your API Key
- Once logged in to the Console, look for API Keys in the left sidebar.
- Click Create Key.
- Give it a name like "claude-code" and click Create.
- You will see a long string of characters that starts with
sk-ant-. This is your API key. - Copy it immediately. You will not be able to see it again after you leave this page.
API keys are like passwords -- never share them with anyone, and never put them in files that you share publicly (like on GitHub). Anyone with your API key can use your credits.
Step 3: Tell Claude Code About Your API Key
You have two choices here:
Choice A: Set it for this PowerShell session only (temporary)
Type this in PowerShell, replacing your-key-here with the key you copied:
$env:ANTHROPIC_API_KEY = "sk-ant-your-key-here"
This only lasts until you close PowerShell. You would need to type it again next time.
Choice B: Set it permanently in Windows (recommended)
This saves your key so it's always available:
- Press the Windows key on your keyboard and type
environment variables. - Click Edit the system environment variables (or "Edit environment variables for your account").
- In the window that opens, click the Environment Variables button at the bottom.
- Under User variables (the top section), click New.
- For Variable name, type:
ANTHROPIC_API_KEY - For Variable value, paste your API key (the long string starting with
sk-ant-). - Click OK on all the dialogs to save.
- Close and reopen PowerShell for the change to take effect.
After setting the key (either way), start Claude Code:
claude
When it asks how to authenticate, select Anthropic API key. It will detect the key you set and log you in.
Understanding Billing
No matter which option you chose, it helps to understand what you are paying for.
| Plan | Cost | How It Works |
|---|---|---|
| Pro subscription | $20/month | Flat monthly fee. Claude Code usage is included, but there are daily usage limits. If you hit the limit, you wait until it resets. |
| Max subscription | $100/month | Higher monthly fee with much higher limits. Good if you plan to use Claude Code heavily. |
| API credits | Pay per use | You are charged per "token" (roughly per word). $5 in credits will get you through many learning sessions. You can always add more. |
The important thing to know: you will not be surprised by a huge bill. With a subscription, you pay a fixed amount. With API credits, you pre-load money and it draws down as you use it.
Checking Your Usage
Once you are inside Claude Code (after authenticating), you can check how much you have used in the current session by typing:
/cost
This shows you the number of tokens used and the approximate cost. It's a good habit to check this occasionally, especially if you are on API credits.
Verifying You're Logged In
After you complete either authentication method, Claude Code will finish starting up. You should see:
- A welcome message or greeting from Claude
- A text input area at the bottom of the screen where you can type
To verify everything is working, type:
/cost
If you see a response showing your usage (even if it says $0.00 because you just started), you are authenticated and ready to go.
If you see an error about authentication, go back and check:
- For subscriptions: Make sure you are logged in to claude.ai in your browser and that your subscription is active.
- For API keys: Make sure the environment variable is set correctly. You can check by typing this in a new PowerShell window:
echo $env:ANTHROPIC_API_KEY
If it prints your key, it's set. If it prints nothing, the variable was not saved correctly.
Try It Yourself
Time to do this for real:
- Open PowerShell.
- Type
claudeand press Enter. - Choose your authentication method and complete the login flow.
- Once you see the Claude Code prompt, type
/costand press Enter. - If you see a cost readout, congratulations -- you are authenticated!
- Type
/exitto close Claude Code for now. We will start a real conversation in the next lesson.
If you ran into any issues during authentication, don't panic. The most common problems are: (1) your browser blocking the login popup (try copying the URL manually), (2) a typo in your API key, or (3) forgetting to reopen PowerShell after setting an environment variable. Try again from the beginning -- it usually works on the second attempt.
What You Learned
- How to start Claude Code for the first time with the
claudecommand - The difference between subscription authentication and API key authentication
- How to set an API key as a Windows environment variable
- How billing works for each plan
- How to verify your authentication with
/cost
How was this lesson? Take 2 minutes to share your feedback — it helps us make the tutorials better for everyone.
Next Up
Now that you are logged in, it's time to actually talk to Claude Code and see what it can do.