The Anthropic Developer Platform – From First Call to Production By the end of this lesson, students should be able to: Setting up your API key. Never hardcode the key in source files. Use environment variables in development and a secrets manager (AWS Secrets Manager, Google Secret Manager, etc.) in production. Installing the SDK. Python: Always verify current SDK versions and installation instructions at docs.anthropic.com/en/docs/quickstart. Your first API call (Python example pattern). “`python import anthropic client = anthropic.Anthropic() # reads ANTHROPIC_API_KEY from environment message = client.messages.create( model="claude-sonnet-4-6", # replace with current model ID from docs max_tokens=1024, messages=[ {"role": "user", "content": "Hello, Claude."} ] ) print(message.content[0].text) “` This is a minimal working call. The The response structure. The Messages API response contains: The Adding a system prompt. “ The A developer makes her first API call by following the quickstart documentation. First attempt fails – environment variable not loaded in her current shell session. She runs export ANTHROPIC_API_KEY=... and retries. Second attempt succeeds. She inspects the response object, logs message.usage.input_tokens and message.usage.output_tokens, and calculates the cost of the call: less than $0.001. She builds her initial cost model: for her expected 10,000 requests per day at similar prompt lengths, estimated monthly cost is approximately $X. Cost estimation before scaling is a required step for any production API integration. API keys grant billing access to your Anthropic account. Leaked API keys in public repositories can result in unexpected charges from unauthorized use. Run Log in and enroll to access lesson quizzes.
Lesson 2: Authentication and Your First API Call
Lesson Objectives
Lesson Content
ANTHROPIC_API_KEY=sk-ant-...pip install anthropic TypeScript/Node: npm install @anthropic-ai/sdkmodel parameter should use a current model ID from docs.anthropic.com – not hardcoded values from this course.id: unique message identifiertype: "message"role: "assistant"content: array of content blocks (typically a text block with .text property)model: the model that generated the responsestop_reason: why generation stopped (end_turn, max_tokens, tool_use)usage: input and output token counts for this requestusage field is important: log token counts in production to track costs and debug unexpectedly large requests.python message = client.messages.create( model="claude-sonnet-4-6", max_tokens=1024, system="You are a helpful assistant for a software development team.", messages=[ {"role": "user", "content": "What are the main risk factors in this PR?"} ] ) “system parameter sets the persistent instruction context for the model – equivalent to Custom Instructions in the chat interface.Practical Example
Safety Notes
git secret scan or equivalent tools if you suspect a key may have been committed. Rotate compromised keys immediately in the Anthropic console and set usage limits as a safeguard. Verify current key management and billing controls at console.anthropic.com.