Updated April 2026 20 min read For developers and advanced users

Guide Claude AI complete
Tool Use, System Prompts, API & Extended Thinking

Everything you need to know about Claude from Anthropic — what sets it apart, how to write System Prompts that work, Tool Use step by step, and how to build smart agents with the API.

200K
Context Window
Constitutional
AI Safety
#1
Coding Benchmarks

What is Claude?

Claude is a large language model (LLM) from Anthropic — an AI company founded in 2021 by former OpenAI employees, led by Dario Amodei and Daniela Amodei. Anthropic's DNA is AI Safety — building safer, more honest and more transparent models.

Claude is considered one of the strongest competitors to GPT-4o, and in several areas — especially coding, document analysis and long-context understanding — it simply wins.

The current versions (April 2026)

Claude Sonnet 4.6
Most recommended
The perfect balance of power and price. Great for code, writing, analysis. The default for most users.
$3 / $15 per 1M tokens
Claude Haiku 4.5
Fastest
Fast and cheap. Suited to low-latency applications, chatbots, and simple tasks.
$0.80 / $4 per 1M tokens
Claude Opus 4.6
Legacy
The most powerful older version. Relevant for especially complex tasks that require depth.
$15 / $75 per 1M tokens

What sets Claude apart?

Quick comparison: Claude vs ChatGPT vs Gemini

Criterion Claude Sonnet 4.6 GPT-4o Gemini 2.5 Pro
Context Window 200K 128K 2M 🏆
coding Excellent 🏆 Great Great
Hebrew Good Great 🏆 Good
Honesty & transparency Excellent 🏆 Good Good
Tool Use / Agents Excellent 🏆 Great Good
Extended Thinking Yes o1 / o3 Yes 🏆
Artifacts / Canvas Artifacts 🏆 Canvas No

A roadmap to mastering Claude

Here is a structured learning path — from Zero to building advanced agents with the Claude API. Each step builds on the previous one.

Stage 1 The Claude.ai interface — a quick start Week 1
Claude.ai BasicsGetting to know the interface, creating conversations, saving history
Basic System PromptsDefining a role for Claude before starting a conversation
ArtifactsGenerating code, SVG and React components directly from the chat
Stage 2 Prompt Engineering & Projects Weeks 2–3
Prompt Engineering for ClaudeXML tags, Chain of Thought, Role prompting
ProjectsManaging memory and files per project in the Claude.ai interface
MemoryPersistent instructions and Custom Instructions
Stage 3 Claude API — Python & TypeScript Weeks 3–4
Python SDKInstallation, API key, your first Messages API call
TypeScript SDK@anthropic-ai/sdk, async/await, error handling
Streamingstream_manager, on_text, real-time responses
Stage 4 Tool Use, Vision, Documents Weeks 4–6
Function CallingDefining tools in JSON Schema, multi-turn tool use
Vision APIAnalyzing images, screenshots, PDF documents
Document AnalysisExtracting structured information from PDF and HTML
Stage 5 Extended Thinking, Agents, MCP, Computer Use Week 6+
Extended ThinkingDeep thinking with budget_tokens, suited to complex problems
MCP ProtocolModel Context Protocol — connecting Claude to external tools
Computer UseClaude controls the browser and computer — fills forms, browses, acts

System Prompts in Claude — depth and practice

A System Prompt is the instruction sent to Claude before every conversation with the user. This is where you define who it is, what it knows, and what its boundaries are.

What makes System Prompts special in Claude?

Claude "takes the System Prompt seriously" more than competing models. It will not try to bypass it, andConstitutional AI ensures it acts according to built-in values even when someone tries to persuade it otherwise.

lightbulb
Constitutional AI — what is it?

Anthropic trained Claude on a "constitution" — a system of ethical principles. When Claude receives an instruction that contradicts the constitution, it will refuse gently and explain why. This makes it more reliable in Production environments that require consistency.

Best Practices for a System Prompt

A full template for a Claude agent

You are [role] assisting [organization/user].

<context>
[background on the company, product, or user]
</context>

<capabilities>
Skills:
- [skill 1]
- [skill 2]
- [skill 3]
</capabilities>

<constraints>
Constraints:
- Do not answer questions unrelated to [topic]
- Always [important rule]
- If you don't know, say "I don't know" and do not make things up
</constraints>

<format>
Response format:
Use Markdown. Be concise but complete.
Always end with: "Is there anything else you'd like to know?"
</format>
info
XML Tags in Claude — why does it work?

Unlike GPT-4o which responds well to Markdown headers, Claude responds better to XML Tags inside the System Prompt. Anthropic even recommends this in the official documentation — it "understands" the structure and uses it to split the instructions into clear segments.

Tool Use / Function Calling — in depth

Tool Use (also called Function Calling) is Claude's ability to call external functions you define. Instead of answering from memory, Claude can query a database, call an API, send an email, or perform any action you write for it.

The Tool Use lifecycle

1
The user's question — "What's the weather in Tel Aviv?"
2
Claude picks a tool — returns stop_reason: "tool_use" with the tool name and parameters
3
Your code runs the function — a call to a weather API, returning with the result
4
Sending the result back to Claude — Claude processes the information and formulates a final answer

Full Python code — Tool Use

import anthropic

client = anthropic.Anthropic(api_key="sk-ant-...")

# Define tools
tools = [
  {
    "name": "get_weather",
    "description": "Returns current weather for a given city",
    "input_schema": {
      "type": "object",
      "properties": {
        "city": {
          "type": "string",
          "description": "City name in English, e.g.: Tel Aviv"
        },
        "unit": {
          "type": "string",
          "enum": ["celsius", "fahrenheit"],
          "description": "Temperature unit"
        }
      },
      "required": ["city"]
    }
  }
]

# First call — Claude picks a tool
response = client.messages.create(
  model="claude-sonnet-4-6",
  max_tokens=1024,
  tools=tools,
  messages=[
    {"role": "user", "content": "What's the weather in Tel Aviv today?"}
  ]
)

# check if Claude requested a tool
if response.stop_reason == "tool_use":
  tool_use = next(
    b for b in response.content if b.type == "tool_use"
  )

  print(f"Claude requested: {tool_use.name}")
  print(f"Parameters: {tool_use.input}")

  # run our function
  tool_result = get_weather(
    tool_use.input["city"],
    tool_use.input.get("unit", "celsius")
  )

  # send the result back to Claude
  final_response = client.messages.create(
    model="claude-sonnet-4-6",
    max_tokens=1024,
    tools=tools,
    messages=[
      {"role": "user", "content": "What's the weather in Tel Aviv today?"},
      {"role": "assistant", "content": response.content},
      {
        "role": "user",
        "content": [{
          "type": "tool_result",
          "tool_use_id": tool_use.id,
          "content": str(tool_result)
        }]
      }
    ]
  )

  print(final_response.content[0].text)

Multi-turn Tool Use

In Multi-turn Tool Use, Claude can call several tools in sequence. For example: "Find all the leads that didn't respond this week, send them a follow-up email, and update the CRM". Claude manages the sequence itself.

warning
Common mistakes in Tool Use

1. You forgot to send the tool_result back — Claude will wait for the answer and won't continue. 2. An error in the JSON Schema — Claude won't be able to understand the tool. 3. An inaccurate description — Claude will pick the wrong tool.

Extended Thinking

Extended Thinking is a special mode in Claude Sonnet 4.6 that lets the model "think out loud" before answering. Similar to Chain of Thought, but at a larger scale — with a dedicated token budget for thinking.

How is it different from regular Chain of Thought?

When to use Extended Thinking?

Code — enabling Extended Thinking

import anthropic

client = anthropic.Anthropic(api_key="sk-ant-...")

response = client.messages.create(
  model="claude-sonnet-4-6",
  max_tokens=16000,
  thinking={
    "type": "enabled",
    "budget_tokens": 10000  # the token budget for thinking
  },
  messages=[{
    "role": "user",
    "content": """
    I have a system of 3 servers. Server A is down 40% of the time,
    server B is down 70% of the time, server C is down 20% of the time.
    What is the probability that at least two servers are running simultaneously?
    Explain the solution step by step.
    """
  }]
)

# iterate over blocks (there is a thinking block + text block)
for block in response.content:
  if block.type == "thinking":
    print("--- internal thinking process ---")
    print(block.thinking[:500], "...")  # print part
  elif block.type == "text":
    print("--- final answer ---")
    print(block.text)
tips_and_updates
How many budget_tokens to give?

Simple problem: 1,000–3,000. Medium problem: 5,000–10,000. Very complex problem: up to 32,000. Note thatmax_tokens must be greater thanbudget_tokens.

Artifacts, Computer Use & Vision

Artifacts — creating directly from the chat

Artifacts is a feature unique to Claude.ai that lets you create files with a real-time Preview. When you ask Claude to write code, it opens a separate Panel with an editor + preview.

code
Tip: ask for Artifacts explicitly

Write "create an Artifact of..." to force Claude to open the Artifact Panel. Without that word, it sometimes writes code inline in the chat.

Computer Use — Claude controls the computer

Computer Use is an experimental capability that lets Claude receive screenshots of the screen and perform actions — mouse clicks, typing, scrolling. It sees the screen and responds to it.

Vision API — analyzing images and documents

import anthropic
import base64

client = anthropic.Anthropic(api_key="sk-ant-...")

# read the image
with open("screenshot.png", "rb") as f:
  image_data = base64.standard_b64encode(f.read()).decode("utf-8")

response = client.messages.create(
  model="claude-sonnet-4-6",
  max_tokens=1024,
  messages=[{
    "role": "user",
    "content": [
      {
        "type": "image",
        "source": {
          "type": "base64",
          "media_type": "image/png",
          "data": image_data,
        },
      },
      {
        "type": "text",
        "text": "What is in the image? Describe every detail."
      }
    ],
  }]
)

print(response.content[0].text)

Claude API — the technical guide

Installation & Authentication

# Python
pip install anthropic

# TypeScript / Node.js
npm install @anthropic-ai/sdk

# Environment variable (recommended — not in code!)
export ANTHROPIC_API_KEY="sk-ant-api03-..."

Messages API — all the parameters

import anthropic

client = anthropic.Anthropic()  # reads from ANTHROPIC_API_KEY

message = client.messages.create(
  model="claude-sonnet-4-6",  # model
  max_tokens=1024,                      # max tokens in the response
  system="You are a helpful assistant.",    # System Prompt
  messages=[
    {
      "role": "user",
      "content": "What is the difference between ML and AI?"
    }
  ]
)

print(message.content[0].text)
print(f"Input tokens: {message.usage.input_tokens}")
print(f"Output tokens: {message.usage.output_tokens}")

Streaming — real-time responses

import anthropic

client = anthropic.Anthropic()

# Streaming
with client.messages.stream(
  model="claude-sonnet-4-6",
  max_tokens=1024,
  messages=[{"role": "user", "content": "Write a short story"}]
) as stream:
  for text in stream.text_stream:
    print(text, end="", flush=True)

TypeScript SDK

import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic({
  apiKey: process.env.ANTHROPIC_API_KEY,
});

const message = await client.messages.create({
  model: "claude-sonnet-4-6",
  max_tokens: 1024,
  system: "You are a helpful assistant.",
  messages: [
    { role: "user", content: "Hello Claude!" }
  ],
});

console.log(message.content[0].text);

Pricing table — April 2026

Model Input (per 1M) Output (per 1M) Context Recommended for
Claude Sonnet 4.6 $3.00 $15.00 200K General Production, code
Claude Haiku 4.5 $0.80 $4.00 200K High volume, chatbots
Claude Sonnet 4.6 $3.00 $15.00 200K Extended Thinking
Claude Opus 4.6 $15.00 $75.00 200K Legacy only

5 hands-on projects with Claude

Here are 5 projects ranked by difficulty — from Hello World to a full Multi-Agent System.

Beginner Project 1: Document Analyzer

Claude reads a PDF and extracts structured information — names, dates, amounts, action items.

import anthropic, base64, json

client = anthropic.Anthropic()

def analyze_document(pdf_path: str) -> dict:
    with open(pdf_path, "rb") as f:
        pdf_data = base64.standard_b64encode(f.read()).decode()

    response = client.messages.create(
        model="claude-sonnet-4-6",
        max_tokens=2048,
        system="""You are a professional document analyst.
Extract from the document and return JSON with the fields:
- summary: a short summary (2-3 sentences)
- key_dates: an array of important dates
- action_items: an array of action items
- parties: the names of the involved parties""",
        messages=[{
            "role": "user",
            "content": [
                {
                    "type": "document",
                    "source": {
                        "type": "base64",
                        "media_type": "application/pdf",
                        "data": pdf_data
                    }
                },
                {"type": "text", "text": "Analyze this document"}
            ]
        }]
    )

    return json.loads(response.content[0].text)

result = analyze_document("contract.pdf")
print(result)
Intermediate Project 2: Code Review Bot

An agent that reviews Pull Requests, identifies issues, and suggests concrete improvements — including code examples.

import anthropic

client = anthropic.Anthropic()

REVIEWER_SYSTEM = """You are a senior engineer performing a Code Review.
For every issue you find, provide:
1. a description of the issue
2. severity level: CRITICAL / MAJOR / MINOR
3. a corrected code example

Check: performance, security, readability, Best Practices."""

def review_code(code: str, language: str = "python") -> str:
    response = client.messages.create(
        model="claude-sonnet-4-6",
        max_tokens=3000,
        system=REVIEWER_SYSTEM,
        messages=[{
            "role": "user",
            "content": f"Do a Code Review on the following code ({language}):\n\n```{language}\n{code}\n```"
        }]
    )
    return response.content[0].text

with open("my_code.py") as f:
    code = f.read()

review = review_code(code)
print(review)
Intermediate Project 3: Customer Support Agent with Tool Use + CRM

A support agent connected to a CRM — pulls customer details, reads inquiry history, and updates tickets in real time.

crm_tools = [
  {
    "name": "get_customer_info",
    "description": "Pulls customer details by ID number",
    "input_schema": {
      "type": "object",
      "properties": {
        "customer_id": {"type": "string"}
      },
      "required": ["customer_id"]
    }
  },
  {
    "name": "create_ticket",
    "description": "Opens a new support ticket",
    "input_schema": {
      "type": "object",
      "properties": {
        "customer_id": {"type": "string"},
        "subject": {"type": "string"},
        "priority": {
          "type": "string",
          "enum": ["low", "medium", "high", "critical"]
        }
      },
      "required": ["customer_id", "subject", "priority"]
    }
  }
]

response = client.messages.create(
  model="claude-sonnet-4-6",
  max_tokens=2048,
  system="You are a professional support rep. You have access to a CRM. Answer customers warmly and professionally.",
  tools=crm_tools,
  messages=[{
    "role": "user",
    "content": "Hi, customer number 12345 is complaining that their order didn't arrive"
  }]
)
Advanced Project 4: Computer Use Automation

Claude fills forms, navigates sites, and runs automations on a real screen without an API.

import anthropic

client = anthropic.Anthropic()

# Computer Use tools built into Claude
response = client.messages.create(
  model="claude-sonnet-4-6",
  max_tokens=4096,
  tools=[
    {
      "type": "computer_20241022",
      "name": "computer",
      "display_width_px": 1920,
      "display_height_px": 1080
    }
  ],
  messages=[{
    "role": "user",
    "content": "Open the browser, go to google.com and search for 'Anthropic Claude'"
  }]
)

# Claude returns screenshot actions — clicks, keystrokes, etc.
for block in response.content:
  if hasattr(block, "type") and block.type == "tool_use":
    print(f"Action: {block.name} — {block.input}")
Advanced Project 5: Multi-Agent System

Claude Sonnet 4.6 as the Orchestrator + Claude Haiku 4.5 as Workers to optimize cost and speed.

import anthropic, json

client = anthropic.Anthropic()

def orchestrate(task: str) -> list:
    """Sonnet splits into small tasks"""
    resp = client.messages.create(
        model="claude-sonnet-4-6",
        max_tokens=1024,
        system="Split the task into 3 subtasks. Return JSON only: {\"subtasks\": [...]}",
        messages=[{"role": "user", "content": task}]
    )
    return json.loads(resp.content[0].text)["subtasks"]

def execute_subtask(subtask: str) -> str:
    """Haiku runs each subtask — cheap and fast"""
    resp = client.messages.create(
        model="claude-haiku-4-5-20251001",
        max_tokens=512,
        messages=[{"role": "user", "content": subtask}]
    )
    return resp.content[0].text

# run
subtasks = orchestrate("Write a marketing report on a new AI product")
results = [execute_subtask(s) for s in subtasks]
print("\n\n".join(results))

Cheat sheet — Claude API

Models & Model IDs

Model ID Name When
claude-sonnet-4-6 Sonnet 4.6 Most cases + Extended Thinking
claude-haiku-4-5-20251001 Haiku 4.5 Fast and cheap
claude-opus-4-6 Opus 4.6 Legacy only

API Endpoints

# Base URL
https://api.anthropic.com/v1/

# Messages (primary)
POST /messages

# Required headers
x-api-key: sk-ant-...
anthropic-version: 2023-06-01
content-type: application/json

Tool Use Boilerplate — Python

import anthropic

client = anthropic.Anthropic()

def run_tool_loop(user_message: str, tools: list, tool_runner) -> str:
    """An automatic Tool Use loop"""
    messages = [{"role": "user", "content": user_message}]

    while True:
        response = client.messages.create(
            model="claude-sonnet-4-6",
            max_tokens=4096,
            tools=tools,
            messages=messages
        )

        if response.stop_reason != "tool_use":
            # Claude is done — return the final answer
            return response.content[0].text

        # add Claude's response to the history
        messages.append({"role": "assistant", "content": response.content})

        # run every tool it requested
        tool_results = []
        for block in response.content:
            if block.type == "tool_use":
                result = tool_runner(block.name, block.input)
                tool_results.append({
                    "type": "tool_result",
                    "tool_use_id": block.id,
                    "content": str(result)
                })

        messages.append({"role": "user", "content": tool_results})

Quick Prompt Templates

Document summary
Summarize the following document in 3 points.
Each point: maximum 20 words.
Format: a numbered list.

<document>
{{DOCUMENT}}
</document>
JSON extraction
Extract structured JSON from the following text.
Return JSON only, no explanation.

Schema:
{name, email, phone, company}

Text: {{TEXT}}
Code Review
Do a Code Review. Note:
- Security issues (CRITICAL)
- Performance issues (MAJOR)
- Readability improvements (MINOR)

```{{LANGUAGE}}
{{CODE}}
```
Translation + improvement
Translate and improve the phrasing.
Keep a {{TONE}} tone.
Maximum {{MAX_WORDS}} words.

Original text:
{{TEXT}}
rocket_launch

Ready to start?

Go to claude.ai and try the interface for free, or get an API key at console.anthropic.com and start building with the examples from this guide.