Check my levelCoursesProgramsFor teamsPricing
UKSign inSign up
Check my levelCoursesProgramsFor teamsPricingClaude quizPromptsBlogFAQSearchSign upUK
AcademlCoursesClaude API from A to ZYour first API call
A user message with two content blocks, text and image, and the model’s replyClaude Code terminal: the claude -p command with Read and Edit allowedRetries after a 429 error: each pause is twice as long, then success
Course

Claude API from A to Z

Module 1 · Getting Started
01Your first API call02The Messages API structure03Choosing a model
Module 2 · Prompt Engineering for Claude
04Designing system prompts05The 1M context window06XML tags in prompts07Few-shot prompting
Module 3 · Tool Use
08Tool Use basics09Tool patterns10Multi-turn conversations11Computer Use and Browser Use
Module 4 · Production
12Streaming13Message Batches API14Prompt Caching15Vision16Production patterns
Claude API from A to Z · Lesson 1

Your first API call

Install @anthropic-ai/sdk, create a client, send a message, and parse the response. Real TypeScript code.

20 min readUpdated Nov 23, 20262 questions in quizReady prompt included

Install

npm install @anthropic-ai/sdk

Use the current major version: @anthropic-ai/sdk 1.x (for Python, anthropic 2.x), released on 2026-10-21. These versions send the anthropic-version: 2026-10-21 header. That API version removed temperature, top_p and top_k, so code from older tutorials that sets them returns a 400 error.

Get a key in the Claude Console at platform.claude.com (the old console.anthropic.com address redirects there), under API keys. Put it in the ANTHROPIC_API_KEY environment variable. Never hardcode the key in the repository.

The rest of this lesson opens after a free sign-up

Sign up with email or Google: the first two lessons of every course stay open for good, and the whole catalog is open for 7 days. No card needed.

Sign up freeOr a trial lesson, no sign-up →
In this lesson
InstallMinimal call in TypeScriptWhat's in the responseSame in PythonCheck it without codePracticeReady promptQuiz
CoursesLLM coursesFor teamsPricingFAQBlogAboutPrivacy
© 2026 AcademlDevelopment & promotion —MMIX — Marketing Mix
Get started free