Claude Code runs on your computer, but Claude does not: every request goes to Anthropic over the network, together with what Claude needs to answer it. Before you send anything, you should know which account pays for it, which terms apply to your data, and what stays on your machine.
In this lesson you sign in, get the practice repository, set up its Python environment and open your first Claude Code session in it, without sending a single request to Claude yet.
By the end you can:
- sign in and confirm which account and login method Claude Code is using;
- explain why a stray API key in your environment can change who is billed;
- explain what Claude Code sends to Anthropic, which data terms apply to your account, and which controls you have;
- prepare the practice repository and trust its folder.
Before you start
- Claude Code is installed and
claude doctorlooks healthy (Install and verify Claude Code). - You have an eligible account: a Claude Pro, Max, Team or Enterprise subscription, or a Claude Console account with API billing. The free Claude plan does not include Claude Code.
- Git and Python 3.12 or later are installed.
Work in a terminal: on Windows, in WSL2.
Which account Claude Code uses
Account types
| Account | How you sign in | Who pays |
|---|---|---|
| Claude Pro or Max | Your claude.ai login, in the browser | Your subscription, within its usage limits |
| Claude Team or Enterprise | The claude.ai account your administrator invited you to | Your organisation |
| Claude Console | Your Console login, or an API key | Pay-as-you-go API billing on that Console account |
| Cloud provider (Amazon Bedrock, Google Cloud's Agent Platform, Microsoft Foundry) | Environment variables your organisation provides | Your organisation's cloud account; not covered in this course |
When several credentials are present
Claude Code can find more than one credential on a computer, and it uses them in a fixed order. In outline, highest first:
- Cloud provider settings, if one is switched on.
- The
ANTHROPIC_AUTH_TOKENenvironment variable (used with gateways and proxies). - The
ANTHROPIC_API_KEYenvironment variable. - An
apiKeyHelpercommand in a settings file. - The
CLAUDE_CODE_OAUTH_TOKENenvironment variable, a long-lived subscription token for scripts. - Profile credentials used by other Anthropic tools, when you name one.
- Your browser sign-in from
/loginorclaude auth login.
The consequence: if ANTHROPIC_API_KEY is set in your shell, for example
from another project, it outranks your subscription sign-in. In an
interactive session Claude Code asks once whether to use the key; if you
approve, your usage is billed to that API key's Console account, not your
subscription. Check before you start:
printenv ANTHROPIC_API_KEY > /dev/null && echo "ANTHROPIC_API_KEY is set" || echo "ANTHROPIC_API_KEY is not set"
This prints whether the variable exists without printing its value. Never paste an API key into a lesson exercise, a prompt or a shared file.
What leaves your computer
Claude Code itself runs locally. To get Claude's help it sends data to Anthropic, encrypted in transit:
- your prompts and Claude's responses;
- anything Claude reads to answer: the contents of files it opens, the
output of commands it runs, and files you attach with
@; - operational telemetry, unless you turn it off: usage metrics, which do not include your code, prompts or file paths, and, for some accounts, error reports with known secrets and personal details redacted.
So a secret in a file Claude reads, or in a command's output, is sent with the request. The course's practice repository has a deliberately fake secrets file so that later lessons can show you how to keep such files out of reach.
Which data terms apply
| Account type | Used to train Anthropic's models? | How long Anthropic keeps Claude Code data |
|---|---|---|
| Consumer: Free, Pro, Max | Only if your data-use setting allows it | 5 years if you allow use for model improvement; 30 days if not |
| Commercial: Team, Enterprise, API | No, unless your organisation opts in to a programme for it | 30 days as standard |
On a consumer plan you choose the data-use setting yourself, in your Claude
privacy settings at claude.ai/settings/data-privacy-controls, and you can
change it at any time. On a commercial plan your organisation's agreement
applies. Anthropic's usage policy applies to every account.
What stays on your computer, and the controls you have
| Item | Where and how long | Your control |
|---|---|---|
| Session transcripts (used to resume sessions) | Stored locally, in plain text, under ~/.claude/projects/, for 30 days by default | The cleanupPeriodDays setting changes the period; anyone with access to your account can read them |
Feedback you choose to send (/feedback, /bug) | Sends a copy of the conversation, including code, to Anthropic; kept for 5 years | Only sent when you choose to |
| Usage metrics | Sent to Anthropic and third-party logging services | DISABLE_TELEMETRY=1 turns them off |
| All non-essential traffic | Telemetry, error reports, surveys | CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1 turns them all off |
These are facts about the product on the date the course was checked; Anthropic's data-usage page is the current authority.
Sign in and prepare the practice repository
1. Check the current state
claude auth status --text
If you are not signed in, Claude Code says so and the command exits with
status 1. Also run the printenv check above.
2. Sign in
claude auth login
Claude Code opens your browser at Anthropic's sign-in page. Sign in with the account you will use for the course and approve the request. If the browser does not open, the command prints the sign-in link: copy it into your browser yourself.
In WSL2, over SSH or in a container, the browser often cannot return to
Claude Code. Instead, the page shows a code. Copy it, return to the
terminal, paste it at the Paste code here if prompted prompt and press
Enter. When sign-in completes, the terminal shows Login successful.
3. Confirm the account
claude auth status --text
Illustrative output, with personal details replaced:
Login method: Claude Max account <- the account type in use
Organization: <your organisation>
Email: <your email>
The exit status is now 0. Note the login method line only: it tells you which kind of account pays for your exercises. Do not copy your email or organisation into notes or screenshots you share.
4. Get the practice repository
Choose a folder for the course, separate from your real work. These commands
create ~/claude-code-course and clone the practice repository into it:
mkdir -p ~/claude-code-course && cd ~/claude-code-course
git clone https://github.com/vectametric/tidewell-bike-hire.git
cd tidewell-bike-hire
From now on, "the practice repository's root folder" means
~/claude-code-course/tidewell-bike-hire.
5. Create the course's Python environment
In the practice repository's root folder, create a virtual environment named
.venv, activate it and install the pinned test runner:
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install pytest==9.1.1
This is "the course's Python environment" that later lessons refer to.
Activation lasts for the current terminal only: in each new terminal, run
source .venv/bin/activate again from the root folder before using
python3. The repository's .gitignore already excludes .venv/, so it
never appears in git status.
Now run the tests:
python3 -m pytest -q
Illustrative output:
FAILED tests/test_pricing.py::test_first_hour_free - AssertionError: assert 2000 == 1000
1 failed, 9 passed in 0.02s
One failure is expected: test_first_hour_free fails on purpose, and you fix
it in Requests Claude can verify.
Any other result means your copy differs from the course's: see
When your result differs.
6. Open your first session and trust the folder
In the root folder:
claude
The very first interactive start shows two setup screens: a choice of text
style for your terminal (any choice is fine; /theme changes it later), and
a short set of security notes, which say that Claude can make mistakes,
that you are responsible for reviewing its actions, and that prompt
injection makes untrusted code risky. Press Enter to continue past each.
Then, the first time you start Claude Code in any folder, it shows a workspace trust dialog: "Quick safety check: Is this a project you created or one you trust?" A trusted folder's project settings, permission rules and hooks take full effect; until then, Claude Code holds some of them back. You wrote nothing in this repository and it is the course's own, so trust it.
The highlighted choice is No, exit. Pressing Enter straight away
closes Claude Code. Press the Down arrow to highlight
Yes, I trust this folder, then press Enter. In a later lesson you will see
exactly what an untrusted folder holds back, and why you should read a
repository's configuration before trusting it.
Then type this command at the prompt and press Enter:
/status
/status opens a panel with Claude Code's version, the folder, your login
method, organisation and email, the model and the settings sources in use.
It is a local command: it does not send a prompt to Claude. Check that the
login method matches step 3, then press Esc to close the panel and leave:
/exit
What success shows
claude auth status --textexits 0 and shows the login method you intended;- the practice repository is cloned, its tests show exactly one expected
failure, and
git status --shortprints nothing; - the folder has been trusted, and
/statusshows the same account.
These show that your exercises will run on the account you chose, in the course's repository, with nothing changed yet. You have spent no usage.
When your result differs
| What you see | What it means | Safe next step |
|---|---|---|
| The browser does not open | Claude Code cannot launch it from this terminal | Copy the link the command printed into your browser |
| The browser shows a code instead of returning | The browser cannot reach Claude Code (common in WSL2, SSH, containers) | Paste the code at the Paste code here if prompted prompt |
| The login method is not the account you meant | Another credential outranks your sign-in, or you signed in with another account | Check printenv as above; /logout in a session, or sign in again with the right account |
| Claude Code asks whether to use an API key you did not expect | ANTHROPIC_API_KEY is set in your environment | Decline if you meant to use your subscription; remove the variable from your shell setup |
| Sign-in fails for a free plan account | The free plan does not include Claude Code | Use an eligible plan or a Console account |
git clone fails | Network, proxy or typing problem | Check the URL; git clone again into an empty folder |
| Claude Code exits as soon as you press Enter on the trust dialog | No, exit was highlighted | Start claude again; press Down to choose Yes, I trust this folder, then Enter |
| More or fewer test failures than one | Your copy or environment differs | git status; make sure .venv is active (which python3 should end in .venv/bin/python3); clone again into a new folder if needed |
No module named pytest | The environment is not active in this terminal | source .venv/bin/activate from the root folder |
Your turn
- A colleague signed in with their Pro subscription last week. Today their
usage appears on their employer's Console account. Their shell profile
sets
ANTHROPIC_API_KEYfor another project. Explain what happened, and what they should check. - Put these in the order Claude Code prefers them, highest first: browser
sign-in,
ANTHROPIC_API_KEY,CLAUDE_CODE_OAUTH_TOKEN,ANTHROPIC_AUTH_TOKEN.
Hint
Look again at the credential order, and at what Claude Code asks in an interactive session when it finds an API key.
Solution
- The API key outranks the browser sign-in. Claude Code asked whether to
use it, and the colleague approved, so usage went to the key's Console
account. They should run
claude auth status --textand check the login method, and remove the variable from their profile (or unset it before starting Claude Code) if they want to use their subscription. ANTHROPIC_AUTH_TOKEN, thenANTHROPIC_API_KEY, thenCLAUDE_CODE_OAUTH_TOKEN, then the browser sign-in.
Reset and cleanup
Keep the sign-in, the practice repository, its .venv and the trusted
folder: the rest of the course uses them. To sign out at any time, run
/logout in a session; the next start asks you to sign in again. If you
ever need a fresh copy of the repository, clone it into a new folder rather
than deleting files by hand.
Check your understanding
True or false? Explain each.
- Claude Code runs locally, so the contents of files Claude reads stay on your computer.
- On a Pro or Max plan, Anthropic always trains on your Claude Code conversations.
- Running
/statussends a request to Claude and uses your allowance. - Session transcripts are kept on your computer, in plain text, for 30 days by default.
Answers
- False. To answer, Claude receives what it reads: file contents and command output travel to Anthropic with the request.
- False. On consumer plans it depends on your data-use setting, which you control; on commercial plans Anthropic does not train on your data unless your organisation opts in.
- False.
/statusis a local command that reports version, model, account and connectivity. - True. They live under
~/.claude/projects/;cleanupPeriodDayschanges the period.