Skip to main content

Setting Up Your Development Environment

4/40
Chapter 1 Claude Opus 4.6 — The New Frontier of AI

Setting Up Your Development Environment

10 min read Lesson 4 / 40 Preview

Setting Up Your Development Environment

Let's get your development environment ready. By the end of this lesson, you'll have made your first successful API call to Claude Opus 4.6.

Step 1: Get Your API Key

  1. Visit console.anthropic.com
  2. Create an account or sign in
  3. Navigate to API Keys
  4. Click Create Key and give it a descriptive name
  5. Copy the key — you won't see it again

Security tip: Never hardcode API keys in your source code. Always use environment variables.

Step 2: Set Up Your Environment

Python Setup

# Create a project directory
mkdir claude-opus-course && cd claude-opus-course

# Create and activate virtual environment
python -m venv venv
source venv/bin/activate  # macOS/Linux
# venv\Scripts\activate   # Windows

# Install the Anthropic SDK
pip install anthropic

# Set your API key
export ANTHROPIC_API_KEY="your-key-here"

Node.js / TypeScript Setup

# Create a project
mkdir claude-opus-course && cd claude-opus-course
npm init -y

# Install the SDK
npm install @anthropic-ai/sdk

# Set your API key
export ANTHROPIC_API_KEY="your-key-here"

Step 3: Your First API Call

Python

import anthropic

client = anthropic.Anthropic()

message = client.messages.create(
    model="claude-opus-4-6-20250514",
    max_tokens=1024,
    messages=[
        {"role": "user", "content": "Hello, Claude! What makes you special?"}
    ]
)

print(message.content[0].text)

TypeScript

import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic();

const message = await client.messages.create({
    model: "claude-opus-4-6-20250514",
    max_tokens: 1024,
    messages: [
        { role: "user", content: "Hello, Claude! What makes you special?" }
    ],
});

console.log(message.content[0].text);

Step 4: Verify Your Setup

Run your script. If you see a thoughtful response from Claude, your environment is ready.

python first_call.py
# or
npx tsx first_call.ts

Understanding the Response Object

{
  "id": "msg_01XFDUDYJgAACzvnptvVoYEL",
  "type": "message",
  "role": "assistant",
  "content": [{ "type": "text", "text": "Hello! ..." }],
  "model": "claude-opus-4-6-20250514",
  "stop_reason": "end_turn",
  "usage": {
    "input_tokens": 12,
    "output_tokens": 147
  }
}

Key fields:

  • content: Array of content blocks (text, tool use, etc.)
  • stop_reason: Why the model stopped (end_turn, max_tokens, tool_use)
  • usage: Token counts for billing
claude-opus-course/
├── .env                  # API key (add to .gitignore!)
├── .gitignore
├── requirements.txt      # or package.json
├── src/
│   ├── ch02/            # Chapter 2 exercises
│   ├── ch03/            # Chapter 3 exercises
│   └── ...
└── projects/
    ├── research-agent/
    ├── doc-analyzer/
    └── multi-agent/

You're all set. In the next chapter, we'll dive deep into the Claude API.

Engr Mejba Ahmed

Engr Mejba Ahmed

Claude Code Expert · Online

👋

Hey there!

Quick Actions

WhatsApp Instant reply

Chat on WhatsApp

+880 1723 741224 · Instant reply

Popular Questions

Engr Mejba Ahmed is connected
Engr Mejba Ahmed is typing...
Engr Mejba Ahmed avatar

✉ Want me to follow up? Drop your email

Engr Mejba Ahmed avatar

📞 Connect Directly

Choose how you'd like to reach me

WhatsApp

+880 1723 741224

Email

[email protected]

✓ Details sent! I'll get back to you shortly.

Powered by OpenAI

335+

Blog Posts

25

AI Courses

63

Projects

Services & Expertise

Pricing & Process

Learning & Resources

Connect & Support