beginner15 min read· Module 2, Lesson 2
🔧Setting Up Your Environment
Get your API key and install everything you need
Setting Up Your Environment
Let's get everything installed and ready. By the end of this lesson, you'll be ready to talk to Claude from your computer.
Step 1: Create an Anthropic Account
- Go to console.anthropic.com
- Click Sign Up
- Enter your email and create a password
- Verify your email
Step 2: Get Your API Key
- After logging in, go to Settings → API Keys
- Click Create Key
- Give it a name (e.g., "my-learning-key")
- Copy the key immediately — you won't see it again!
Important: Your API key looks like
sk-ant-api03-...Keep it secret!
Step 3: Install Node.js (for JavaScript/TypeScript)
If you don't have Node.js installed:
- Go to nodejs.org
- Download the LTS version (Long Term Support)
- Run the installer
- Verify installation:
node --version # Should show v18+ or higher
npm --version # Should show 9+ or higherStep 4: Install Python (Optional)
If you prefer Python:
- Go to python.org
- Download the latest version
- Run the installer (check "Add to PATH"!)
- Verify:
python --version # Should show 3.8+
pip --version # Should workStep 5: Set Your API Key as an Environment Variable
This keeps your key safe (not in your code):
macOS / Linux:
echo 'export ANTHROPIC_API_KEY="your-key-here"' >> ~/.zshrc
source ~/.zshrcWindows (PowerShell):
[System.Environment]::SetEnvironmentVariable("ANTHROPIC_API_KEY", "your-key-here", "User")Step 6: Install the SDK
For JavaScript/TypeScript:
npm install @anthropic-ai/sdkFor Python:
pip install anthropicStep 7: Verify Everything Works
Create a test file:
JavaScript (test.js):
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic();
const message = await client.messages.create({
model: "claude-sonnet-4-6",
max_tokens: 100,
messages: [{ role: "user", content: "Say hello!" }]
});
console.log(message.content[0].text);Python (test.py):
import anthropic
client = anthropic.Anthropic()
message = client.messages.create(
model="claude-sonnet-4-6",
max_tokens=100,
messages=[{"role": "user", "content": "Say hello!"}]
)
print(message.content[0].text)Run it:
node test.js # JavaScript
python test.py # PythonIf you see Claude's response, congratulations — you're ready!
Next up: We'll dive into making your first real API call and understanding the response.