Skip to main content

SDK Installation & Setup — Official SDKs

[ ABORT TO HUD ]
SEQ. 1

SDK Installation & Setup

📦 Official SDKs⏱ 15 min⭐ 100 BASE XP⌨ HANDS-ON LAB

Official SDK Ecosystem

Anthropic provides first-party API SDKs for four languages—Python (anthropic v2.0+), TypeScript / JavaScript (@anthropic-ai/sdk v1.0+), Go (anthropic-sdk-go v2.0+), and Java (anthropic-java)—alongside the official Claude Agent SDK (@anthropic-ai/claude-agent-sdk and Python claude-agent-sdk).

Python Example

import anthropic

client = anthropic.Anthropic()  # Reads ANTHROPIC_API_KEY from environment

message = client.messages.create(
    model="claude-sonnet-5-5",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Explain quantum computing in three sentences."}]
)
print(message.content[0].text)

TypeScript Example & Claude Agent SDK

import Anthropic from "@anthropic-ai/sdk";
import { query } from "@anthropic-ai/claude-agent-sdk";

const client = new Anthropic();
const message = await client.messages.create({
  model: "claude-sonnet-5-5",
  max_tokens: 1024,
  messages: [{ role: "user", content: "Explain quantum computing in three sentences." }]
});
console.log(message.content[0].text);

// Embed the full Claude Code agent loop via Claude Agent SDK:
for await (const turn of query({ prompt: "Run unit tests", options: { allowedTools: ["Read", "Bash"] } })) {
  console.log(turn);
}
⌨ HANDS-ON LABInstall the Official SDKs
⭐ +100 XP

Provision both official Anthropic SDKs - Python for data pipelines, TypeScript for your web stack.

1Install the official Python SDK with pip.
2Install the official TypeScript/Node SDK with npm.
lab-sandbox — simulated environment
INFINITY LAB SANDBOX v2.6 — simulated shell
Type the command for the current objective. Helpers: "hint", "solution", "clear".
$
OBJECTIVE 1 / 2 — type "hint" if stuck
SYNAPSE VERIFICATION
QUERY 1 // 2
Which environment variable do all official Anthropic SDKs read by default?
CLAUDE_KEY
ANTHROPIC_API_KEY
AI_SECRET
ANTHROPIC_TOKEN