Claude API · Setup and first request
Send your first message (TypeScript)
The same request with the TypeScript SDK.
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic();
const response = await client.messages.create({
model: "claude-opus-5-5",
max_tokens: 16000,
messages: [{ role: "user", content: "What is the capital of France?" }],
});
for (const block of response.content) {
if (block.type === "text") console.log(block.text);
}
Official Claude API documentation
More setup and first request commands
- Install the Python SDK
- Install the TypeScript SDK
- Set your API key
- Send your first message (Python)
- Send your first message (curl)
- Pick a model
All setup and first request commands · Claude API cheatsheet