Loading...
    • Guida per sviluppatori
    • Riferimento API
    • MCP
    • Risorse
    • Note sulla versione
    Search...
    ⌘K
    Primi passi
    Introduzione a ClaudeAvvio rapido
    Modelli e prezzi
    Panoramica dei modelliScelta di un modelloNovità in Claude 4.6Guida alla migrazioneDeprecazioni dei modelliPrezzi
    Crea con Claude
    Panoramica delle funzioniUtilizzo dell'API MessagesGestione dei motivi di arrestoBest practice per i prompt
    Capacità del modello
    Extended thinkingAdaptive thinkingEffortFast mode (anteprima di ricerca)Output strutturatiCitazioniStreaming dei messaggiElaborazione batchSupporto PDFRisultati di ricercaSupporto multilingueEmbeddingsVision
    Strumenti
    PanoramicaCome implementare l'uso degli strumentiStrumento di ricerca webStrumento di recupero webStrumento di esecuzione del codiceStrumento di memoriaStrumento BashStrumento Computer useStrumento editor di testo
    Infrastruttura degli strumenti
    Ricerca strumentiChiamata programmatica degli strumentiStreaming granulare degli strumenti
    Gestione del contesto
    Finestre di contestoCompattazioneModifica del contestoPrompt cachingConteggio dei token
    File e risorse
    API Files
    Agent Skills
    PanoramicaAvvio rapidoBest practiceSkills per l'aziendaUtilizzo di Skills con l'API
    Agent SDK
    PanoramicaAvvio rapidoTypeScript SDKTypeScript V2 (anteprima)Python SDKGuida alla migrazione
    MCP nell'API
    Connettore MCPServer MCP remoti
    Claude su piattaforme di terze parti
    Amazon BedrockMicrosoft FoundryVertex AI
    Prompt engineering
    PanoramicaGeneratore di promptUsa modelli di promptMiglioratore di promptSii chiaro e direttoUsa esempi (multishot prompting)Lascia che Claude pensi (CoT)Usa tag XMLDai a Claude un ruolo (prompt di sistema)Concatena prompt complessiSuggerimenti per il contesto lungoSuggerimenti per extended thinking
    Test e valutazione
    Definisci criteri di successoSviluppa casi di testUtilizzo dello strumento di valutazioneRiduzione della latenza
    Rafforza i guardrail
    Riduci le allucinazioniAumenta la coerenza dell'outputMitiga i jailbreakStreaming dei rifiutiRiduci la perdita di promptMantieni Claude nel personaggio
    Amministrazione e monitoraggio
    Panoramica dell'API AdminResidenza dei datiWorkspaceAPI di utilizzo e costiAPI Claude Code AnalyticsZero Data Retention
    Console
    Log in
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...

    Solutions

    • AI agents
    • Code modernization
    • Coding
    • Customer support
    • Education
    • Financial services
    • Government
    • Life sciences

    Partners

    • Amazon Bedrock
    • Google Cloud's Vertex AI

    Learn

    • Blog
    • Catalog
    • Courses
    • Use cases
    • Connectors
    • Customer stories
    • Engineering at Anthropic
    • Events
    • Powered by Claude
    • Service partners
    • Startups program

    Company

    • Anthropic
    • Careers
    • Economic Futures
    • Research
    • News
    • Responsible Scaling Policy
    • Security and compliance
    • Transparency

    Learn

    • Blog
    • Catalog
    • Courses
    • Use cases
    • Connectors
    • Customer stories
    • Engineering at Anthropic
    • Events
    • Powered by Claude
    • Service partners
    • Startups program

    Help and security

    • Availability
    • Status
    • Support
    • Discord

    Terms and policies

    • Privacy policy
    • Responsible disclosure policy
    • Terms of service: Commercial
    • Terms of service: Consumer
    • Usage policy
    Capacità del modello

    Adaptive thinking

    Lascia che Claude decida dinamicamente quando e quanto pensare con la modalità adaptive thinking.

    Was this page helpful?

    • Modelli supportati
    • Come funziona adaptive thinking
    • Come utilizzare adaptive thinking
    • Adaptive thinking con il parametro effort
    • Streaming con adaptive thinking
    • Adaptive vs manual vs disabled thinking
    • Considerazioni importanti
    • Modifiche alla validazione
    • Prompt caching
    • Tuning del comportamento del thinking
    • Controllo dei costi
    • Lavorare con i blocchi di thinking
    • Summarized thinking
    • Thinking encryption
    • Thinking redaction
    • Pricing
    • Argomenti aggiuntivi
    • Passaggi successivi

    Adaptive thinking è il modo consigliato per utilizzare extended thinking con Claude Opus 4.6. Invece di impostare manualmente un budget di token di thinking, adaptive thinking consente a Claude di decidere dinamicamente quando e quanto pensare in base alla complessità di ogni richiesta.

    Adaptive thinking produce in modo affidabile prestazioni migliori rispetto a extended thinking con un budget_tokens fisso, e consigliamo di passare a adaptive thinking per ottenere le risposte più intelligenti da Opus 4.6. Non è richiesta alcuna intestazione beta.

    Modelli supportati

    Adaptive thinking è supportato sui seguenti modelli:

    • Claude Opus 4.6 (claude-opus-4-6)

    thinking.type: "enabled" e budget_tokens sono deprecati su Opus 4.6 e verranno rimossi in una futura versione del modello. Utilizza thinking.type: "adaptive" con il parametro effort invece.

    I modelli più vecchi (Sonnet 4.5, Opus 4.5, ecc.) non supportano adaptive thinking e richiedono thinking.type: "enabled" con budget_tokens.

    Come funziona adaptive thinking

    In modalità adaptive, il thinking è facoltativo per il modello. Claude valuta la complessità di ogni richiesta e decide se e quanto pensare. Al livello di effort predefinito (high), Claude penserà quasi sempre. A livelli di effort inferiori, Claude potrebbe saltare il thinking per problemi più semplici.

    Adaptive thinking abilita anche automaticamente interleaved thinking. Ciò significa che Claude può pensare tra le chiamate ai tool, rendendolo particolarmente efficace per i flussi di lavoro agentic.

    Come utilizzare adaptive thinking

    Imposta thinking.type su "adaptive" nella tua richiesta API:

    Adaptive thinking con il parametro effort

    Puoi combinare adaptive thinking con il parametro effort per guidare quanto Claude pensa. Il livello di effort agisce come una guida soft per l'allocazione del thinking di Claude:

    Livello di effortComportamento del thinking
    maxClaude pensa sempre senza vincoli sulla profondità del thinking. Solo Opus 4.6 — le richieste che utilizzano max su altri modelli restituiranno un errore.
    high (predefinito)Claude pensa sempre. Fornisce ragionamento profondo su compiti complessi.
    mediumClaude utilizza un thinking moderato. Potrebbe saltare il thinking per query molto semplici.
    lowClaude minimizza il thinking. Salta il thinking per compiti semplici dove la velocità è più importante.

    Streaming con adaptive thinking

    Adaptive thinking funziona perfettamente con streaming. I blocchi di thinking vengono trasmessi tramite eventi thinking_delta proprio come in modalità thinking manuale:

    Adaptive vs manual vs disabled thinking

    ModalitàConfigurazioneDisponibilitàQuando utilizzare
    Adaptivethinking: {type: "adaptive"}Opus 4.6Claude decide quando e quanto pensare. Utilizza effort per guidare.
    Manualthinking: {type: "enabled", budget_tokens: N}Tutti i modelli. Deprecato su Opus 4.6 — utilizza la modalità adaptive invece.Quando hai bisogno di un controllo preciso sulla spesa di token di thinking.
    DisabledOmetti il parametro thinkingTutti i modelliQuando non hai bisogno di extended thinking e desideri la latenza più bassa.

    Adaptive thinking è attualmente disponibile su Opus 4.6. I modelli più vecchi supportano solo type: "enabled" con budget_tokens. Su Opus 4.6, type: "enabled" con budget_tokens è ancora accettato ma deprecato — consigliamo di utilizzare adaptive thinking con il parametro effort invece.

    Considerazioni importanti

    Modifiche alla validazione

    Quando si utilizza adaptive thinking, i turni dell'assistente precedenti non devono iniziare con blocchi di thinking. Questo è più flessibile rispetto alla modalità manuale, dove l'API applica che i turni con thinking abilitato inizino con un blocco di thinking.

    Prompt caching

    Le richieste consecutive che utilizzano adaptive thinking preservano i breakpoint della prompt cache. Tuttavia, il passaggio tra le modalità di thinking adaptive e enabled/disabled interrompe i breakpoint della cache per i messaggi. I prompt di sistema e le definizioni dei tool rimangono in cache indipendentemente dai cambiamenti di modalità.

    Tuning del comportamento del thinking

    Il comportamento di attivazione di adaptive thinking è promptable. Se Claude sta pensando più o meno spesso di quanto desideri, puoi aggiungere una guida al tuo prompt di sistema:

    Extended thinking adds latency and should only be used when it
    will meaningfully improve answer quality — typically for problems
    that require multi-step reasoning. When in doubt, respond directly.

    Indirizzare Claude a pensare meno spesso potrebbe ridurre la qualità su compiti che beneficiano dal ragionamento. Misura l'impatto sui tuoi carichi di lavoro specifici prima di distribuire il tuning basato su prompt in produzione. Considera di testare prima con livelli di effort inferiori.

    Controllo dei costi

    Utilizza max_tokens come limite rigido sull'output totale (thinking + testo di risposta). Il parametro effort fornisce una guida soft aggiuntiva su quanto thinking Claude alloca. Insieme, questi ti danno un controllo efficace sui costi.

    Ai livelli di effort high e max, Claude potrebbe pensare più estesamente e potrebbe essere più probabile che esaurisca il budget di max_tokens. Se osservi stop_reason: "max_tokens" nelle risposte, considera di aumentare max_tokens per dare al modello più spazio, o abbassare il livello di effort.

    Lavorare con i blocchi di thinking

    I seguenti concetti si applicano a tutti i modelli che supportano extended thinking, indipendentemente dal fatto che tu utilizzi la modalità adaptive o manuale.

    Summarized thinking

    With extended thinking enabled, the Messages API for Claude 4 models returns a summary of Claude's full thinking process. Summarized thinking provides the full intelligence benefits of extended thinking, while preventing misuse.

    Here are some important considerations for summarized thinking:

    • You're charged for the full thinking tokens generated by the original request, not the summary tokens.
    • The billed output token count will not match the count of tokens you see in the response.
    • The first few lines of thinking output are more verbose, providing detailed reasoning that's particularly helpful for prompt engineering purposes.
    • As Anthropic seeks to improve the extended thinking feature, summarization behavior is subject to change.
    • Summarization preserves the key ideas of Claude's thinking process with minimal added latency, enabling a streamable user experience and easy migration from Claude Sonnet 3.7 to Claude 4 and later models.
    • Summarization is processed by a different model than the one you target in your requests. The thinking model does not see the summarized output.

    Claude Sonnet 3.7 continues to return full thinking output.

    In rare cases where you need access to full thinking output for Claude 4 models, contact our sales team.

    Thinking encryption

    Full thinking content is encrypted and returned in the signature field. This field is used to verify that thinking blocks were generated by Claude when passed back to the API.

    It is only strictly necessary to send back thinking blocks when using tools with extended thinking. Otherwise you can omit thinking blocks from previous turns, or let the API strip them for you if you pass them back.

    If sending back thinking blocks, we recommend passing everything back as you received it for consistency and to avoid potential issues.

    Here are some important considerations on thinking encryption:

    • When streaming responses, the signature is added via a signature_delta inside a content_block_delta event just before the content_block_stop event.
    • signature values are significantly longer in Claude 4 models than in previous models.
    • The signature field is an opaque field and should not be interpreted or parsed - it exists solely for verification purposes.
    • signature values are compatible across platforms (Claude APIs, Amazon Bedrock, and Vertex AI). Values generated on one platform will be compatible with another.

    Thinking redaction

    Occasionally Claude's internal reasoning will be flagged by our safety systems. When this occurs, we encrypt some or all of the thinking block and return it to you as a redacted_thinking block. redacted_thinking blocks are decrypted when passed back to the API, allowing Claude to continue its response without losing context.

    When building customer-facing applications that use extended thinking:

    • Be aware that redacted thinking blocks contain encrypted content that isn't human-readable
    • Consider providing a simple explanation like: "Some of Claude's internal reasoning has been automatically encrypted for safety reasons. This doesn't affect the quality of responses."
    • If showing thinking blocks to users, you can filter out redacted blocks while preserving normal thinking blocks
    • Be transparent that using extended thinking features may occasionally result in some reasoning being encrypted
    • Implement appropriate error handling to gracefully manage redacted thinking without breaking your UI

    Here's an example showing both normal and redacted thinking blocks:

    {
      "content": [
        {
          "type": "thinking",
          "thinking": "Let me analyze this step by step...",
          "signature": "WaUjzkypQ2mUEVM36O2TxuC06KN8xyfbJwyem2dw3URve/op91XWHOEBLLqIOMfFG/UvLEczmEsUjavL...."
        },
        {
          "type": "redacted_thinking",
          "data": "EmwKAhgBEgy3va3pzix/LafPsn4aDFIT2Xlxh0L5L8rLVyIwxtE3rAFBa8cr3qpPkNRj2YfWXGmKDxH4mPnZ5sQ7vB9URj2pLmN3kF8/dW5hR7xJ0aP1oLs9yTcMnKVf2wRpEGjH9XZaBt4UvDcPrQ..."
        },
        {
          "type": "text",
          "text": "Based on my analysis..."
        }
      ]
    }

    Seeing redacted thinking blocks in your output is expected behavior. The model can still use this redacted reasoning to inform its responses while maintaining safety guardrails.

    If you need to test redacted thinking handling in your application, you can use this special test string as your prompt: ANTHROPIC_MAGIC_STRING_TRIGGER_REDACTED_THINKING_46C9A13E193C177646C7398A98432ECCCE4C1253D5E2D82641AC0E52CC2876CB

    When passing thinking and redacted_thinking blocks back to the API in a multi-turn conversation, you must include the complete unmodified block back to the API for the last assistant turn. This is critical for maintaining the model's reasoning flow. We suggest always passing back all thinking blocks to the API. For more details, see the Preserving thinking blocks section.

    Pricing

    For complete pricing information including base rates, cache writes, cache hits, and output tokens, see the pricing page.

    The thinking process incurs charges for:

    • Tokens used during thinking (output tokens)
    • Thinking blocks from the last assistant turn included in subsequent requests (input tokens)
    • Standard text output tokens

    When extended thinking is enabled, a specialized system prompt is automatically included to support this feature.

    When using summarized thinking:

    • Input tokens: Tokens in your original request (excludes thinking tokens from previous turns)
    • Output tokens (billed): The original thinking tokens that Claude generated internally
    • Output tokens (visible): The summarized thinking tokens you see in the response
    • No charge: Tokens used to generate the summary

    The billed output token count will not match the visible token count in the response. You are billed for the full thinking process, not the summary you see.

    Argomenti aggiuntivi

    La pagina extended thinking copre diversi argomenti in più dettaglio con esempi di codice specifici della modalità:

    • Tool use con thinking: Le stesse regole si applicano per adaptive thinking — preserva i blocchi di thinking tra le chiamate ai tool e sii consapevole delle limitazioni di tool_choice quando il thinking è attivo.
    • Prompt caching: Con adaptive thinking, le richieste consecutive che utilizzano la stessa modalità di thinking preservano i breakpoint della cache. Il passaggio tra le modalità adaptive e enabled/disabled interrompe i breakpoint della cache per i messaggi (i prompt di sistema e le definizioni dei tool rimangono in cache).
    • Context windows: Come i token di thinking interagiscono con max_tokens e i limiti della finestra di contesto.

    Passaggi successivi

    curl https://api.anthropic.com/v1/messages \
         --header "x-api-key: $ANTHROPIC_API_KEY" \
         --header "anthropic-version: 2023-06-01" \
         --header "content-type: application/json" \
         --data \
    '{
        "model": "claude-opus-4-6",
        "max_tokens": 16000,
        "thinking": {
            "type": "adaptive"
        },
        "messages": [
            {
                "role": "user",
                "content": "Explain why the sum of two even numbers is always even."
            }
        ]
    }'
    import anthropic
    
    client = anthropic.Anthropic()
    
    response = client.messages.create(
        model="claude-opus-4-6",
        max_tokens=16000,
        thinking={
            "type": "adaptive"
        },
        output_config={
            "effort": "medium"
        },
        messages=[{
            "role": "user",
            "content": "What is the capital of France?"
        }]
    )
    
    print(response.content[0].text)
    import anthropic
    
    client = anthropic.Anthropic()
    
    with client.messages.stream(
        model="claude-opus-4-6",
        max_tokens=16000,
        thinking={"type": "adaptive"},
        messages=[{"role": "user", "content": "What is the greatest common divisor of 1071 and 462?"}],
    ) as stream:
        for event in stream:
            if event.type == "content_block_start":
                print(f"\nStarting {event.content_block.type} block...")
            elif event.type == "content_block_delta":
                if event.delta.type == "thinking_delta":
                    print(event.delta.thinking, end="", flush=True)
                elif event.delta.type == "text_delta":
                    print(event.delta.text, end="", flush=True)
    Extended thinking

    Scopri di più su extended thinking, inclusa la modalità manuale, l'uso dei tool e il prompt caching.

    Effort parameter

    Controlla quanto accuratamente Claude risponde con il parametro effort.