Setup in 10 minutes
1. Create an API key
- Go to https://console.anthropic.com.
- Create an organisation if you do not have one.
- Keys → Create Key. Copy it once — you will not see it again.
- Save to
.env(never commit):ANTHROPIC_API_KEY=sk-ant-....
2. Install the SDK
Python:
pip install -U anthropic
Node.js:
npm install @anthropic-ai/sdk
PHP (used throughout this course for Laravel examples):
composer require openai-php/laravel # via adapter, or call HTTP directly
3. Verify the key works
from anthropic import Anthropic
client = Anthropic()
msg = client.messages.create(
model="claude-opus-4-7",
max_tokens=1024,
messages=[{"role": "user", "content": "Ping"}],
)
print(msg.content[0].text)
4. Billing setup
Start with the $5 free tier to validate your key. Upgrade to Tier 1 (~$100 prepaid) before building anything serious — rate limits scale with tier.
5. Observability from day one
Log every request/response with timestamp, model, input tokens, output tokens, cost. A simple JSONL log saves you hours when debugging.
That is all the setup. Next lesson we ship a real request.