---
title: Inizia con Claude
url: https://platform.claude.com/docs/it/get-started
description: Effettua la tua prima chiamata API a Claude e crea un semplice assistente di ricerca web.
---

## Prerequisiti

* Un [account Claude Console](https://platform.claude.com)
* Una [chiave API](https://platform.claude.com/docs/it/get-api-key)

## Chiama l'API

<Tabs>
  <Tab title="cURL">
    <Steps>
      <Step title="Imposta la tua chiave API">
        Esporta la tua chiave API come variabile d'ambiente. Il comando cURL seguente la legge da `$ANTHROPIC_API_KEY`.

        ```bash
        export ANTHROPIC_API_KEY="your-api-key-here"
        ```
      </Step>

      <Step title="Effettua la tua prima chiamata API">
        Invia una richiesta `POST` alla Messages API:

        ```bash cURL
        curl https://api.anthropic.com/v1/messages \
          -H "content-type: application/json" \
          -H "x-api-key: $ANTHROPIC_API_KEY" \
          -H "anthropic-version: 2023-06-01" \
          -d '{
            "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?"
              }
            ]
          }'
        ```

        Claude restituisce una risposta JSON contenente il messaggio dell'assistente:

        ```json Output
        {
          "model": "claude-opus-5-5",
          "id": "msg_013mHbppMPd2PrVJzGMZPt2D",
          "type": "message",
          "role": "assistant",
          "content": [
            {
              "type": "text",
              "text": "Here are some effective search strategies to find the latest developments in renewable energy:\n\n## General Search Terms\n- \"Renewable energy news 2025\"\n- ..."
            }
          ],
          "stop_reason": "end_turn",
          "stop_sequence": null,
          "stop_details": null,
          "usage": {
            "input_tokens": 21,
            "output_tokens": 305
          }
        }
        ```
      </Step>
    </Steps>
  </Tab>

  <Tab title="CLI">
    <Steps>
      <Step title="Installa la CLI">
        Installa la CLI di Anthropic con Homebrew:

        ```bash
        brew install anthropics/tap/ant
        ```

        Per altri metodi di installazione, consulta [Installazione](https://platform.claude.com/docs/it/cli-sdks-libraries/cli/quickstart#installation) nella guida rapida della CLI.
      </Step>

      <Step title="Autenticati">
        Accedi con il tuo account Anthropic:

        ```bash
        ant auth login
        ```

        Questo apre un flusso OAuth basato su browser. Dopo l'autorizzazione, verifica la tua credenziale con:

        ```bash
        ant auth status
        ```

        Su un host remoto senza browser, passa `--no-browser` per ottenere un URL che puoi aprire su un altro dispositivo, quindi incolla il codice restituito nel terminale. Se `ANTHROPIC_API_KEY` è impostata nel tuo ambiente, ha la precedenza sulle credenziali di accesso. Per ambienti non interattivi come la CI, consulta le [opzioni di autenticazione della CLI](https://platform.claude.com/docs/it/cli-sdks-libraries/cli/authentication).
      </Step>

      <Step title="Effettua la tua prima chiamata API">
        Esegui `ant messages create` dal tuo terminale:

        ```bash CLI
        ant messages create \
          --model claude-opus-5-5 \
          --max-tokens 1000 \
          --message '{
            role: user,
            content: "What should I search for to find the latest developments in renewable energy?"
          }'
        ```

        La CLI stampa la risposta JSON:

        ```json Output
        {
          "model": "claude-opus-5-5",
          "id": "msg_01N1ycuCkM5Mzd7WhTU4fwST",
          "type": "message",
          "role": "assistant",
          "content": [
            {
              "type": "text",
              "text": "Here are some effective search strategies to find the latest developments in renewable energy:\n\n## General Search Terms\n- \"Renewable energy news 2025\"\n- ..."
            }
          ],
          "stop_reason": "end_turn",
          "stop_sequence": null,
          "stop_details": null,
          "usage": { "input_tokens": 21, "output_tokens": 305 }
        }
        ```
      </Step>
    </Steps>
  </Tab>

  <Tab title="Python">
    <Steps>
      <Step title="Imposta la tua chiave API">
        Esporta la tua chiave API come variabile d'ambiente. L'SDK legge `ANTHROPIC_API_KEY` automaticamente.

        ```bash
        export ANTHROPIC_API_KEY="your-api-key-here"
        ```
      </Step>

      <Step title="Crea un progetto e installa l'SDK">
        ```bash
        mkdir claude-quickstart && cd claude-quickstart
        python3 -m venv .venv && source .venv/bin/activate
        pip install anthropic
        ```
      </Step>

      <Step title="Crea il tuo codice">
        Crea un file chiamato `quickstart.py`:

        ```python 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)
        ```
      </Step>

      <Step title="Esegui il tuo codice">
        ```bash
        python quickstart.py
        ```

        ```text Output wrap
        Here are some effective search strategies to find the latest developments in renewable energy:

        ## General Search Terms
        - "Renewable energy news 2025"
        - ...
        ```
      </Step>
    </Steps>
  </Tab>

  <Tab title="TypeScript">
    <Steps>
      <Step title="Imposta la tua chiave API">
        Esporta la tua chiave API come variabile d'ambiente. L'SDK legge `ANTHROPIC_API_KEY` automaticamente.

        ```bash
        export ANTHROPIC_API_KEY="your-api-key-here"
        ```
      </Step>

      <Step title="Crea un progetto e installa l'SDK">
        ```bash
        mkdir claude-quickstart && cd claude-quickstart
        npm init -y
        npm pkg set type=module
        npm install @anthropic-ai/sdk
        ```
      </Step>

      <Step title="Crea il tuo codice">
        Crea un file chiamato `quickstart.ts`:

        ```typescript TypeScript
        import Anthropic from "@anthropic-ai/sdk";

        const client = new Anthropic();

        const message = await 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 (const block of message.content) {
          if (block.type === "text") {
            console.log(block.text);
          }
        }
        ```
      </Step>

      <Step title="Esegui il tuo codice">
        ```bash
        npx tsx quickstart.ts
        ```

        ```text Output wrap
        Here are some effective search strategies to find the latest developments in renewable energy:

        ## General Search Terms
        - "Renewable energy news 2025"
        - ...
        ```
      </Step>
    </Steps>
  </Tab>

  <Tab title="C#">
    <Steps>
      <Step title="Imposta la tua chiave API">
        Esporta la tua chiave API come variabile d'ambiente. L'SDK legge `ANTHROPIC_API_KEY` automaticamente.

        ```bash
        export ANTHROPIC_API_KEY="your-api-key-here"
        ```
      </Step>

      <Step title="Crea un progetto e installa l'SDK">
        Crea un nuovo progetto console e aggiungi il pacchetto Anthropic:

        ```bash
        dotnet new console -n ClaudeQuickstart
        cd ClaudeQuickstart
        dotnet add package Anthropic
        ```
      </Step>

      <Step title="Crea il tuo codice">
        Sostituisci il contenuto di `Program.cs`:

        ```csharp C#
        using Anthropic;
        using Anthropic.Models.Messages;

        var client = new AnthropicClient();

        var message = await client.Messages.Create(new MessageCreateParams
        {
            Model = Model.ClaudeOpus5_5,
            MaxTokens = 1000,
            Messages =
            [
                new()
                {
                    Role = Role.User,
                    Content = "What should I search for to find the latest developments in renewable energy?",
                },
            ],
        });

        foreach (var block in message.Content)
        {
            if (block.TryPickText(out var textBlock))
            {
                Console.WriteLine(textBlock.Text);
            }
        }
        ```
      </Step>

      <Step title="Esegui il tuo codice">
        ```bash
        dotnet run
        ```

        ```text Output wrap
        Here are some effective search strategies to find the latest developments in renewable energy:

        ## General Search Terms
        - "Renewable energy news 2025"
        - ...
        ```
      </Step>
    </Steps>
  </Tab>

  <Tab title="Go">
    <Steps>
      <Step title="Imposta la tua chiave API">
        Esporta la tua chiave API come variabile d'ambiente. L'SDK legge `ANTHROPIC_API_KEY` automaticamente.

        ```bash
        export ANTHROPIC_API_KEY="your-api-key-here"
        ```
      </Step>

      <Step title="Crea un progetto e installa l'SDK">
        Crea un nuovo modulo e aggiungi l'SDK di Anthropic:

        ```bash
        mkdir claude-quickstart && cd claude-quickstart
        go mod init claude-quickstart
        go get github.com/anthropics/anthropic-sdk-go
        ```
      </Step>

      <Step title="Crea il tuo codice">
        Crea un file chiamato `main.go`:

        ```go Go
        package main

        import (
        	"context"
        	"fmt"
        	"log"

        	"github.com/anthropics/anthropic-sdk-go"
        )

        func main() {
        	client := anthropic.NewClient()

        	message, err := client.Messages.New(context.Background(), anthropic.MessageNewParams{
        		Model:     anthropic.ModelClaudeOpus5_5,
        		MaxTokens: 1000,
        		Messages: []anthropic.MessageParam{
        			anthropic.NewUserMessage(anthropic.NewTextBlock("What should I search for to find the latest developments in renewable energy?")),
        		},
        	})
        	if err != nil {
        		log.Fatal(err)
        	}

        	for _, block := range message.Content {
        		if textBlock, ok := block.AsAny().(anthropic.TextBlock); ok {
        			fmt.Println(textBlock.Text)
        		}
        	}
        }
        ```
      </Step>

      <Step title="Esegui il tuo codice">
        ```bash
        go run .
        ```

        ```text Output wrap
        Here are some effective search strategies to find the latest developments in renewable energy:

        ## General Search Terms
        - "Renewable energy news 2025"
        - ...
        ```
      </Step>
    </Steps>
  </Tab>

  <Tab title="Java">
    <Steps>
      <Step title="Imposta la tua chiave API">
        Esporta la tua chiave API come variabile d'ambiente. L'SDK legge `ANTHROPIC_API_KEY` automaticamente.

        ```bash
        export ANTHROPIC_API_KEY="your-api-key-here"
        ```
      </Step>

      <Step title="Configura il tuo progetto">
        Ti servono un JDK (25 o successivo) e [Gradle](https://gradle.org/install/) oppure [Maven](https://maven.apache.org/install.html) nel tuo `PATH`. Crea una directory per il tuo progetto con al suo interno una directory per i sorgenti Java:

        ```bash
        mkdir -p claude-quickstart/src/main/java && cd claude-quickstart
        ```

        Quindi aggiungi un file di build. Trova la versione attuale dell'SDK su [Maven Central](https://central.sonatype.com/artifact/com.anthropic/anthropic-java).

        <Tabs>
          <Tab title="Gradle">
            Salva questo come `build.gradle.kts`:

            ```kotlin
            plugins {
                application
            }

            repositories {
                mavenCentral()
            }

            java {
                toolchain {
                    languageVersion = JavaLanguageVersion.of(25)
                }
            }

            dependencies {
                implementation("com.anthropic:anthropic-java:2.71.0")
            }

            application {
                mainClass = "QuickStart"
            }
            ```
          </Tab>

          <Tab title="Maven">
            Salva questo come `pom.xml`:

            ```xml
            <project xmlns="http://maven.apache.org/POM/4.0.0">
              <modelVersion>4.0.0</modelVersion>
              <groupId>com.example</groupId>
              <artifactId>quickstart</artifactId>
              <version>1.0-SNAPSHOT</version>
              <properties>
                <maven.compiler.release>25</maven.compiler.release>
                <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
              </properties>
              <dependencies>
                <dependency>
                  <groupId>com.anthropic</groupId>
                  <artifactId>anthropic-java</artifactId>
                  <version>2.71.0</version>
                </dependency>
              </dependencies>
            </project>
            ```
          </Tab>
        </Tabs>
      </Step>

      <Step title="Crea il tuo codice">
        Salva questo come `QuickStart.java` nella directory dei sorgenti Java del tuo progetto (di solito `src/main/java/`):

        ```java Java
        import com.anthropic.client.okhttp.AnthropicOkHttpClient;
        import com.anthropic.models.messages.Message;
        import com.anthropic.models.messages.MessageCreateParams;
        import com.anthropic.models.messages.Model;

        static void main() {
            var client = AnthropicOkHttpClient.fromEnv();

            var params = MessageCreateParams.builder()
                .model(Model.CLAUDE_OPUS_5_5)
                .maxTokens(1000)
                .addUserMessage(
                    "What should I search for to find the latest developments in renewable energy?"
                )
                .build();

            Message message = client.messages().create(params);
            for (var block : message.content()) {
                block.text().ifPresent(textBlock -> IO.println(textBlock.text()));
            }
        }
        ```
      </Step>

      <Step title="Esegui il tuo codice">
        <Tabs>
          <Tab title="Gradle">
            ```bash
            gradle run
            ```
          </Tab>

          <Tab title="Maven">
            ```bash
            mvn compile exec:java -Dexec.mainClass=QuickStart
            ```
          </Tab>
        </Tabs>

        ```text Output wrap
        Here are some effective search strategies to find the latest developments in renewable energy:

        ## General Search Terms
        - "Renewable energy news 2025"
        - ...
        ```
      </Step>
    </Steps>
  </Tab>

  <Tab title="PHP">
    <Steps>
      <Step title="Imposta la tua chiave API">
        Esporta la tua chiave API come variabile d'ambiente. L'SDK legge `ANTHROPIC_API_KEY` automaticamente.

        ```bash
        export ANTHROPIC_API_KEY="your-api-key-here"
        ```
      </Step>

      <Step title="Crea un progetto e installa l'SDK">
        ```bash
        mkdir claude-quickstart && cd claude-quickstart
        composer require "anthropic-ai/sdk" "guzzlehttp/guzzle:^7"
        ```
      </Step>

      <Step title="Crea il tuo codice">
        Crea un file chiamato `quickstart.php`:

        ```php PHP
        <?php
        require 'vendor/autoload.php';

        use Anthropic\Client;
        use Anthropic\Messages\Model;
        use Anthropic\Messages\TextBlock;

        $client = new Client();

        $message = $client->messages->create(
            model: Model::CLAUDE_OPUS_5_5,
            maxTokens: 1000,
            messages: [
                [
                    'role' => 'user',
                    'content' => 'What should I search for to find the latest developments in renewable energy?',
                ],
            ],
        );

        foreach ($message->content as $block) {
            if ($block instanceof TextBlock) {
                echo $block->text . PHP_EOL;
            }
        }
        ```
      </Step>

      <Step title="Esegui il tuo codice">
        ```bash
        php quickstart.php
        ```

        ```text Output wrap
        Here are some effective search strategies to find the latest developments in renewable energy:

        ## General Search Terms
        - "Renewable energy news 2025"
        - ...
        ```
      </Step>
    </Steps>
  </Tab>

  <Tab title="Ruby">
    <Steps>
      <Step title="Imposta la tua chiave API">
        Esporta la tua chiave API come variabile d'ambiente. L'SDK legge `ANTHROPIC_API_KEY` automaticamente.

        ```bash
        export ANTHROPIC_API_KEY="your-api-key-here"
        ```
      </Step>

      <Step title="Crea un progetto e installa l'SDK">
        ```bash
        mkdir claude-quickstart && cd claude-quickstart
        bundle init
        bundle add anthropic
        ```
      </Step>

      <Step title="Crea il tuo codice">
        Crea un file chiamato `quickstart.rb`:

        ```ruby Ruby
        require "anthropic"

        client = Anthropic::Client.new

        message = client.messages.create(
          model: Anthropic::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?"
            }
          ]
        )

        message.content.each do |block|
          puts block.text if block.type == :text
        end
        ```
      </Step>

      <Step title="Esegui il tuo codice">
        ```bash
        bundle exec ruby quickstart.rb
        ```

        ```text Output wrap
        Here are some effective search strategies to find the latest developments in renewable energy:

        ## General Search Terms
        - "Renewable energy news 2025"
        - ...
        ```
      </Step>
    </Steps>
  </Tab>
</Tabs>

## Prossimi passi

Hai effettuato la tua prima chiamata API. Ora impara i pattern della Messages API che userai in ogni integrazione con Claude.

<Card title="Lavorare con la Messages API" icon="messages" href="https://platform.claude.com/docs/it/build-with-claude/working-with-messages">
  Impara le conversazioni multi-turno, i prompt di sistema, i motivi di arresto e altri pattern fondamentali.
</Card>

Una volta che hai familiarità con le basi, esplora ulteriormente:

<CardGroup cols={2}>
  <Card title="Panoramica dei modelli" icon="brain" href="https://platform.claude.com/docs/it/models/overview">
    Confronta i modelli Claude per capacità e costo.
  </Card>

  <Card title="Panoramica delle funzionalità" icon="list" href="https://platform.claude.com/docs/it/build-with-claude/overview">
    Esplora tutte le capacità di Claude: strumenti, gestione del contesto, output strutturati e altro ancora.
  </Card>

  <Card title="SDK client" icon="code-brackets" href="https://platform.claude.com/docs/it/cli-sdks-libraries/overview">
    Documentazione di riferimento per Python, TypeScript, C# e altre librerie client.
  </Card>

  <Card title="Autenticazione" icon="lock" href="https://platform.claude.com/docs/it/manage-claude/authentication">
    Confronta le chiavi API e la Workload Identity Federation, e imposta la scadenza delle chiavi.
  </Card>
</CardGroup>
