Create each key on its own page, paste it below, then copy the finished lines into your project's .env file. What you paste stays in this tab. It is never sent to Wirestack or saved.
On November 2, 2026 Anthropic released message threads in beta for the Messages API. The API keeps the conversation on the server, so each later request sends only the new messages. Requests get smaller, and time to first token stays lower and steadier in long conversations and agent loops.
Beta header: message-threads-2026-08-12
A thread expires 5 minutes after its last request and is deleted no more than 1 hour after its last use.
Available on the Claude API, Claude Platform on AWS, Claude Models on Google Cloud (Anthropic managed) and Claude in Microsoft Foundry.
Threads do not change pricing or rate limits.
Prerequisites
A Claude API key in ANTHROPIC_API_KEY
A long conversation or agent loop on the Messages API, with a supported model (for example claude-opus-5-5, claude-sonnet-5-5 or claude-haiku-5-5)
Steps
On the first turn, send the full conversation, system and tools as you do today, add the message-threads-2026-08-12 beta header and add "thread": {"type": "create"}.
On every later turn, send only the new messages with "thread": {"type": "continue", "previous_message_id": "<previous id>"}, using the id of the previous response. Leave system and tools out: the thread keeps them.
Send the beta header on every request of the thread.
Keep your own copy of the whole conversation. If a continue request returns 404, the thread is gone: send the full conversation again in a new create request. The SDK thread helper (client.beta.messages.thread(...)) builds these requests and does the replay for you.
From Anthropic's docs:
Shell
# Turn 1: send the full conversation and create a threadcurl -sS --fail-with-body https://api.anthropic.com/v1/messages \ -H "x-api-key: $ANTHROPIC_API_KEY" \ -H "anthropic-version: 2026-10-21" \ -H "anthropic-beta: message-threads-2026-08-12" \ -H "content-type: application/json" \ -d '{ "model": "claude-opus-5-5", "max_tokens": 1024, "cache_control": {"type": "ephemeral"}, "system": "You are a support agent for Acme. Keep replies short.", "messages": [{"role": "user", "content": "Hi! I have a question about an order."}], "thread": {"type": "create"} }'# Turn 2: send only the new message. Set message_id to the id of the turn 1 response.# Leave out system and tools: the thread keeps them.curl -sS --fail-with-body https://api.anthropic.com/v1/messages \ -H "x-api-key: $ANTHROPIC_API_KEY" \ -H "anthropic-version: 2026-10-21" \ -H "anthropic-beta: message-threads-2026-08-12" \ -H "content-type: application/json" \ -d '{ "model": "claude-opus-5-5", "max_tokens": 1024, "cache_control": {"type": "ephemeral"}, "messages": [{"role": "user", "content": "How long does standard shipping usually take?"}], "thread": {"type": "continue", "previous_message_id": "'"$message_id"'"} }'
Threads do not work with Message Batches, token counting, compaction, most context editing, or organizations with HIPAA readiness or Inference hooks turned on. Those requests return a 400 error with the code thread_unsupported_request. Threads are not ZDR eligible.
Test it
Run turn 1, copy the response id into message_id, then run turn 2. The second reply should follow on from the first turn even though you sent only the new message.
Not confirmed
The docs do not say which SDK version first includes the thread helper.