Cookie settings

We use cookies to deliver and improve our services, analyze site usage, and if you agree, to customize or personalize your experience and market our services to you. You can read our Cookie Policy here.

Claude Platform Docs
MessagesFirst steps

Get started with Claude

Make your first API call to Claude and build a simple web search assistant.

Prerequisites

Call the API

  1. Set your API key

    Export your API key as an environment variable. The SDK reads ANTHROPIC_API_KEY automatically.

    export ANTHROPIC_API_KEY="your-api-key-here"
  2. Create a project and install the SDK

    mkdir claude-quickstart && cd claude-quickstart
    python3 -m venv .venv && source .venv/bin/activate
    pip install anthropic
  3. Create your code

    Create a file called quickstart.py:

    Python
    import anthropic
    
    client = anthropic.Anthropic()
    
    message = client.messages.create(
        model="claude-opus-5-5",
        max_tokens=1000,
        messages=[
            {
                "role": "user",
                "content": "What should I search for to find the latest developments in renewable energy?",
            }
        ],
    )
    
    for block in message.content:
        if block.type == "text":
            print(block.text)
  4. Run your code

    python quickstart.py
    Output
    Here are some effective search strategies to find the latest developments in renewable energy:
    
    ## General Search Terms
    - "Renewable energy news 2025"
    - ...

Next steps

You made your first API call. Next, learn the Messages API patterns you'll use in every Claude integration.

Learn multi-turn conversations, system prompts, stop reasons, and other core patterns.

Once you're comfortable with the basics, explore further:

Compare Claude models by capability and cost.

Browse all Claude capabilities: tools, context management, structured outputs, and more.

Reference documentation for Python, TypeScript, C#, and other client libraries.

Compare API keys and Workload Identity Federation, and set key expiration.

Was this page helpful?