# Table of Contents - [Documentation - Claude API Docs](#documentation-claude-api-docs) - [Get started with Claude - Claude API Docs](#get-started-with-claude-claude-api-docs) - [Intro to Claude - Claude API Docs](#intro-to-claude-claude-api-docs) - [Effort - Claude API Docs](#effort-claude-api-docs) - [Features overview - Claude API Docs](#features-overview-claude-api-docs) - [Fast mode (beta: research preview) - Claude API Docs](#fast-mode-beta-research-preview-claude-api-docs) - [Adaptive thinking - Claude API Docs](#adaptive-thinking-claude-api-docs) - [Using the Messages API - Claude API Docs](#using-the-messages-api-claude-api-docs) - [Multilingual support - Claude API Docs](#multilingual-support-claude-api-docs) - [How tool use works - Claude API Docs](#how-tool-use-works-claude-api-docs) - [Tool use with Claude - Claude API Docs](#tool-use-with-claude-claude-api-docs) - [Streaming refusals - Claude API Docs](#streaming-refusals-claude-api-docs) - [Embeddings - Claude API Docs](#embeddings-claude-api-docs) - [Citations - Claude API Docs](#citations-claude-api-docs) - [Prompt engineering overview - Claude API Docs](#prompt-engineering-overview-claude-api-docs) - [Web search tool - Claude API Docs](#web-search-tool-claude-api-docs) - [Remote MCP servers - Claude API Docs](#remote-mcp-servers-claude-api-docs) - [IP addresses - Claude API Docs](#ip-addresses-claude-api-docs) - [Versions - Claude API Docs](#versions-claude-api-docs) - [Fine-grained tool streaming - Claude API Docs](#fine-grained-tool-streaming-claude-api-docs) - [Reduce prompt leak - Claude API Docs](#reduce-prompt-leak-claude-api-docs) - [Reduce hallucinations - Claude API Docs](#reduce-hallucinations-claude-api-docs) - [Mitigate jailbreaks and prompt injections - Claude API Docs](#mitigate-jailbreaks-and-prompt-injections-claude-api-docs) - [Using the Evaluation Tool - Claude API Docs](#using-the-evaluation-tool-claude-api-docs) - [Handling stop reasons - Claude API Docs](#handling-stop-reasons-claude-api-docs) - [Service tiers - Claude API Docs](#service-tiers-claude-api-docs) - [Beta headers - Claude API Docs](#beta-headers-claude-api-docs) - [Increase output consistency - Claude API Docs](#increase-output-consistency-claude-api-docs) - [Web fetch tool - Claude API Docs](#web-fetch-tool-claude-api-docs) - [Console prompting tools - Claude API Docs](#console-prompting-tools-claude-api-docs) - [Bash tool - Claude API Docs](#bash-tool-claude-api-docs) - [Skills for enterprise - Claude API Docs](#skills-for-enterprise-claude-api-docs) - [Supported regions - Claude API Docs](#supported-regions-claude-api-docs) - [Model deprecations - Claude API Docs](#model-deprecations-claude-api-docs) - [Context windows - Claude API Docs](#context-windows-claude-api-docs) - [Data residency - Claude API Docs](#data-residency-claude-api-docs) - [Admin API overview - Claude API Docs](#admin-api-overview-claude-api-docs) - [Memory tool - Claude API Docs](#memory-tool-claude-api-docs) - [Errors - Claude API Docs](#errors-claude-api-docs) - [Choosing the right model - Claude API Docs](#choosing-the-right-model-claude-api-docs) - [Agent Skills - Claude API Docs](#agent-skills-claude-api-docs) - [Guides to common use cases - Claude API Docs](#guides-to-common-use-cases-claude-api-docs) - [Claude Code Analytics API - Claude API Docs](#claude-code-analytics-api-claude-api-docs) - [Session tracing - Claude API Docs](#session-tracing-claude-api-docs) - [Documentation - Claude API Docs](#documentation-claude-api-docs) - [Glossary - Claude API Docs](#glossary-claude-api-docs) - [Define success criteria and build evaluations - Claude API Docs](#define-success-criteria-and-build-evaluations-claude-api-docs) - [Models overview - Claude API Docs](#models-overview-claude-api-docs) - [Rate limits - Claude API Docs](#rate-limits-claude-api-docs) - [Get started with Agent Skills in the API - Claude API Docs](#get-started-with-agent-skills-in-the-api-claude-api-docs) - [Workspaces - Claude API Docs](#workspaces-claude-api-docs) - [PHP SDK - Claude API Docs](#php-sdk-claude-api-docs) - [Client SDKs - Claude API Docs](#client-sdks-claude-api-docs) - [Usage and Cost API - Claude API Docs](#usage-and-cost-api-claude-api-docs) - [What's new in Claude 4.6 - Claude API Docs](#what-s-new-in-claude-4-6-claude-api-docs) - [API Overview - Claude API Docs](#api-overview-claude-api-docs) - [Claude in Microsoft Foundry - Claude API Docs](#claude-in-microsoft-foundry-claude-api-docs) - [OpenAI SDK compatibility - Claude API Docs](#openai-sdk-compatibility-claude-api-docs) - [Claude on Vertex AI - Claude API Docs](#claude-on-vertex-ai-claude-api-docs) - [Text generation - Claude API Docs](#text-generation-claude-api-docs) - [Create a Message - Claude API Reference](#create-a-message-claude-api-reference) - [Sessions - Claude API Reference](#sessions-claude-api-reference) - [Messages - Claude API Reference](#messages-claude-api-reference) - [Count tokens in a Message - Claude API Reference](#count-tokens-in-a-message-claude-api-reference) - [Retrieve a Message Batch - Claude API Reference](#retrieve-a-message-batch-claude-api-reference) - [Upload File - Claude API Reference](#upload-file-claude-api-reference) - [Delete a Message Batch - Claude API Reference](#delete-a-message-batch-claude-api-reference) - [List Models - Claude API Reference](#list-models-claude-api-reference) - [Retrieve Message Batch results - Claude API Reference](#retrieve-message-batch-results-claude-api-reference) - [Cancel a Message Batch - Claude API Reference](#cancel-a-message-batch-claude-api-reference) - [Create a Message Batch - Claude API Reference](#create-a-message-batch-claude-api-reference) - [Create Skill - Claude API Reference](#create-skill-claude-api-reference) - [List Message Batches - Claude API Reference](#list-message-batches-claude-api-reference) - [Glossar - Claude API Docs](#glossar-claude-api-docs) - [Documentation - Claude API Docs](#documentation-claude-api-docs) - [Leitfäden für häufige Anwendungsfälle - Claude API Docs](#leitf-den-f-r-h-ufige-anwendungsf-lle-claude-api-docs) - [Kundenservice-Agent - Claude API Docs](#kundenservice-agent-claude-api-docs) - [Tool reference - Claude API Docs](#tool-reference-claude-api-docs) - [Claude in Amazon Bedrock - Claude API Docs](#claude-in-amazon-bedrock-claude-api-docs) - [Handle tool calls - Claude API Docs](#handle-tool-calls-claude-api-docs) - [Tool Runner (SDK) - Claude API Docs](#tool-runner-sdk-claude-api-docs) - [Define tools - Claude API Docs](#define-tools-claude-api-docs) - [Strict tool use - Claude API Docs](#strict-tool-use-claude-api-docs) - [Claude Platform - Claude API Docs](#claude-platform-claude-api-docs) - [Server tools - Claude API Docs](#server-tools-claude-api-docs) - [Parallel tool use - Claude API Docs](#parallel-tool-use-claude-api-docs) - [Documentation - Claude API Docs](#documentation-claude-api-docs) - [Textgenerierung - Claude API Docs](#textgenerierung-claude-api-docs) - [API und Datenspeicherung - Claude API Docs](#api-und-datenspeicherung-claude-api-docs) - [Usage and Cost API - Claude API Docs](#usage-and-cost-api-claude-api-docs) - [Claude Code Analytics API - Claude API Docs](#claude-code-analytics-api-claude-api-docs) - [System-Prompts - Claude API Docs](#system-prompts-claude-api-docs) - [Unknown](#unknown) - [Ticket-Routing - Claude API Docs](#ticket-routing-claude-api-docs) - [Unknown](#unknown) - [Inhaltsmoderation - Claude API Docs](#inhaltsmoderation-claude-api-docs) - [Zusammenfassung von Rechtsdokumenten - Claude API Docs](#zusammenfassung-von-rechtsdokumenten-claude-api-docs) --- # Documentation - Claude API Docs Home Claude Platform Start building with Claude ============================ Everything you need to integrate Claude into your applications. From first API call to production. What do you want to build? ⌘K [Quickstart](https://platform.claude.com/docs/en/get-started) [Get API key](https://platform.claude.com/settings/keys) [API reference](https://platform.claude.com/docs/en/api) PythonTypeScriptGoJavaRubyPHPC#cURLCLI import anthropic client = anthropic.Anthropic() message = client.messages.create( model="claude-sonnet-4-6", max_tokens=1024, messages=[{\ "role": "user",\ "content": "Hello, Claude"\ }] ) print(message.content[0].text) Platform Choose how you build -------------------- Pick the developer surface that matches your approach, and the infrastructure that fits your stack. ### Messages Direct model access. You construct every turn, manage conversation state, and write your own tool loop. [Quickstart](https://platform.claude.com/docs/en/get-started) [API reference](https://platform.claude.com/docs/en/api/messages/create) [Client SDKs](https://platform.claude.com/docs/en/api/client-sdks) ### Claude Managed Agents Fully managed agent infrastructure. Deploy and manage autonomous agents in stateful sessions with persistent event history. [Quickstart](https://platform.claude.com/docs/en/managed-agents/quickstart) [API reference](https://platform.claude.com/docs/en/api/beta/sessions) [Define your agent](https://platform.claude.com/docs/en/managed-agents/agent-setup) [AWS Bedrock](https://platform.claude.com/docs/en/build-with-claude/claude-in-amazon-bedrock) [Google Cloud Vertex AI](https://platform.claude.com/docs/en/build-with-claude/claude-on-vertex-ai) [Microsoft Foundry](https://platform.claude.com/docs/en/build-with-claude/claude-in-microsoft-foundry) Developer journey From idea to production ----------------------- Follow the lifecycle or jump to what you need. MessagesClaude Managed Agents 1. 1 ### Get started [Quickstart](https://platform.claude.com/docs/en/get-started) [Get API key](https://platform.claude.com/settings/keys) [Choose a model](https://platform.claude.com/docs/en/about-claude/models/overview) [Install an SDK](https://platform.claude.com/docs/en/api/client-sdks) [Try the Workbench](https://platform.claude.com/workbench) 2. 2 ### Build [Messages API](https://platform.claude.com/docs/en/api/messages/create) [Extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking) [Vision](https://platform.claude.com/docs/en/build-with-claude/vision) [Tool use](https://platform.claude.com/docs/en/agents-and-tools/tool-use/overview) [Web search](https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-search-tool) [Code execution](https://platform.claude.com/docs/en/agents-and-tools/tool-use/code-execution-tool) [Structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs) [Prompt caching](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) [Streaming](https://platform.claude.com/docs/en/build-with-claude/streaming) 3. 3 ### Evaluate & ship [Prompting best practices](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/overview) [Run evals](https://platform.claude.com/docs/en/test-and-evaluate/develop-tests) [Batch testing](https://platform.claude.com/docs/en/build-with-claude/batch-processing) [Safety & guardrails](https://platform.claude.com/docs/en/test-and-evaluate/strengthen-guardrails/increase-consistency) [Rate limits & errors](https://platform.claude.com/docs/en/api/rate-limits) [Cost optimization](https://platform.claude.com/docs/en/about-claude/pricing) 4. 4 ### Operate [Workspaces & admin](https://platform.claude.com/docs/en/build-with-claude/workspaces) [API key management](https://platform.claude.com/settings/keys) [Usage monitoring](https://platform.claude.com/docs/en/build-with-claude/usage-cost-api) [Model migration](https://platform.claude.com/docs/en/about-claude/models/migration-guide) Models The Claude model family ----------------------- Choose the right model for your use case. Most capable [Opus 4.6](https://platform.claude.com/docs/en/about-claude/models/overview) claude-opus-4-6 Best for complex analysis, coding, and creative tasks requiring deep reasoning. Best balance [Sonnet 4.6](https://platform.claude.com/docs/en/about-claude/models/overview) claude-sonnet-4-6 Ideal balance of intelligence and speed for most production workloads. Fastest [Haiku 4.5](https://platform.claude.com/docs/en/about-claude/models/overview) claude-haiku-4-5 Lightning-fast responses for high-volume, latency-sensitive applications. Resources Keep learning ------------- [Courses\ \ Interactive courses to master Claude.](https://anthropic.skilljar.com/) [Cookbook\ \ Code samples and patterns.](https://platform.claude.com/cookbooks) [Quickstarts\ \ Deployable starter apps.](https://github.com/anthropics/anthropic-quickstarts) [What's new\ \ Latest features and updates.](https://platform.claude.com/docs/en/release-notes/overview) [Claude Code\ \ An agentic coding assistant in your terminal.](https://code.claude.com/docs/en/overview) --- # Get started with Claude - Claude API Docs Loading... First steps Quickstart Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Prerequisites ------------------- * An Anthropic [Console account](https://platform.claude.com/) * An [API key](https://platform.claude.com/settings/keys) Call the API ------------------ cURL cURL CLI CLI Python Python TypeScript TypeScript Java Java Next steps ---------------- You made your first API call. Next, learn the Messages API patterns you'll use in every Claude integration. [Working with the Messages API\ \ Learn multi-turn conversations, system prompts, stop reasons, and other core patterns.](https://platform.claude.com/docs/en/build-with-claude/working-with-messages) Once you're comfortable with the basics, explore further: [Models overview\ \ Compare Claude models by capability and cost.](https://platform.claude.com/docs/en/about-claude/models/overview) [Features overview\ \ Browse all Claude capabilities: tools, context management, structured outputs, and more.](https://platform.claude.com/docs/en/build-with-claude/overview) [Client SDKs\ \ Reference documentation for Python, TypeScript, Java, and other client libraries.](https://platform.claude.com/docs/en/api/client-sdks) Was this page helpful? --- # Intro to Claude - Claude API Docs Loading... First steps Intro to Claude Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page The latest generation of Claude models: **Claude Opus 4.6** - Our most intelligent model, and the world’s best model for coding, enterprise agents, and professional work. [Learn more](https://www.anthropic.com/news/claude-opus-4-6) . **Claude Sonnet 4.6** - Frontier intelligence at scale—built for coding, agents, and enterprise workflows. [Learn more](https://www.anthropic.com/news/claude-sonnet-4-6) . **Claude Haiku 4.5** - Fastest model with near-frontier intelligence. [Learn more](https://www.anthropic.com/news/claude-haiku-4-5) . Looking to chat with Claude? Visit [claude.ai](https://www.claude.ai/) . Anthropic offers two ways to build with Claude, each suited to different use cases: | | Messages API | Claude Managed Agents | | --- | --- | --- | | **What it is** | Direct model prompting access | Pre-built, configurable agent harness that runs in managed infrastructure | | **Best for** | Custom agent loops and fine-grained control | Long-running tasks and asynchronous work | | **Learn more** | [Messages API docs](https://platform.claude.com/docs/en/build-with-claude/working-with-messages) | [Claude Managed Agents docs](https://platform.claude.com/docs/en/managed-agents/overview) | Recommended path for new developers ----------------------------------------- Follow these steps to go from zero to a working Claude integration. 1. 1 Make your first API call Set up your environment, install an SDK, and send your first message to Claude. [Go to the quickstart](https://platform.claude.com/docs/en/get-started) 2. 2 Understand the Messages API Learn the core request and response structure, including multi-turn conversations, system prompts, and stop reasons. [Read the Messages API guide](https://platform.claude.com/docs/en/build-with-claude/working-with-messages) 3. 3 Choose the right model Compare Claude models by capability and cost to pick the best fit for your use case. [See the models overview](https://platform.claude.com/docs/en/about-claude/models/overview) 4. 4 Explore features and tools Discover what Claude can do: extended thinking, web search, file handling, structured outputs, and more. [Browse the features overview](https://platform.claude.com/docs/en/build-with-claude/overview) * * * Develop with Claude ------------------------- Anthropic provides developer tools to help you build and scale applications with Claude. [Developer Console\ \ Prototype and test prompts in your browser with the Workbench and prompt generator.](https://platform.claude.com/) [API Reference\ \ Explore the full Claude API and client SDK documentation.](https://platform.claude.com/docs/en/api/overview) [Claude Cookbook\ \ Learn with interactive Jupyter notebooks covering PDFs, embeddings, and more.](https://platform.claude.com/cookbooks) * * * Key capabilities ---------------------- Claude can assist with many tasks that involve text, code, and images. [Text and code generation\ \ Summarize text, answer questions, extract data, translate text, and explain and generate code.](https://platform.claude.com/docs/en/build-with-claude/text-generation) [Vision\ \ Process and analyze visual input and generate text and code from images.](https://platform.claude.com/docs/en/build-with-claude/vision) * * * Support ------------- [Help Center\ \ Find answers to frequently asked account and billing questions.](https://support.claude.com/en/) [Service Status\ \ Check the status of Anthropic services.](https://status.claude.com/) Was this page helpful? --- # Effort - Claude API Docs Loading... Model capabilities Effort Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page This feature is eligible for [Zero Data Retention (ZDR)](https://platform.claude.com/docs/en/build-with-claude/api-and-data-retention) . When your organization has a ZDR arrangement, data sent through this feature is not stored after the API response is returned. The effort parameter allows you to control how eager Claude is about spending tokens when responding to requests. This gives you the ability to trade off between response thoroughness and token efficiency, all with a single model. The effort parameter is generally available on all supported models with no beta header required. The effort parameter is supported by [Claude Mythos Preview](https://anthropic.com/glasswing) , Claude Opus 4.6, Claude Sonnet 4.6, and Claude Opus 4.5. For Claude Opus 4.6 and Sonnet 4.6, effort replaces `budget_tokens` as the recommended way to control thinking depth. Combine effort with [adaptive thinking](https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking) (`thinking: {type: "adaptive"}`) for the best experience. While `budget_tokens` is still accepted on Opus 4.6 and Sonnet 4.6, it is deprecated and will be removed in a future model release. At `high` (default) and `max` effort, Claude will almost always think. At lower effort levels, it may skip thinking for simpler problems. How effort works ---------------------- By default, Claude uses high effort, spending as many tokens as needed for excellent results. You can raise the effort level to `max` for the absolute highest capability, or lower it to be more conservative with token usage, optimizing for speed and cost while accepting some reduction in capability. Setting `effort` to `"high"` produces exactly the same behavior as omitting the `effort` parameter entirely. The effort parameter affects **all tokens** in the response, including: * Text responses and explanations * Tool calls and function arguments * Extended thinking (when enabled) This approach has two major advantages: 1. It doesn't require thinking to be enabled in order to use it. 2. It can affect all token spend including tool calls. For example, lower effort would mean Claude makes fewer tool calls. This gives a much greater degree of control over efficiency. ### Effort levels | Level | Description | Typical use case | | --- | --- | --- | | `max` | Absolute maximum capability with no constraints on token spending. Available on Claude Mythos Preview, Claude Opus 4.6, and Claude Sonnet 4.6. | Tasks requiring the deepest possible reasoning and most thorough analysis | | `high` | High capability. Equivalent to not setting the parameter. | Complex reasoning, difficult coding problems, agentic tasks | | `medium` | Balanced approach with moderate token savings. | Agentic tasks that require a balance of speed, cost, and performance | | `low` | Most efficient. Significant token savings with some capability reduction. | Simpler tasks that need the best speed and lowest costs, such as subagents | Effort is a behavioral signal, not a strict token budget. At lower effort levels, Claude will still think on sufficiently difficult problems, but it will think less than it would at higher effort levels for the same problem. ### Recommended effort levels for Sonnet 4.6 Sonnet 4.6 defaults to `high` effort. Explicitly set effort when using Sonnet 4.6 to avoid unexpected latency: * **Medium effort** (recommended default): Best balance of speed, cost, and performance for most applications. Suitable for agentic coding, tool-heavy workflows, and code generation. * **Low effort:** For high-volume or latency-sensitive workloads. Suitable for chat and non-coding use cases where faster turnaround is prioritized. * **High effort:** For tasks requiring maximum intelligence from Sonnet 4.6. * **Max effort:** For tasks requiring the absolute highest capability with no constraints on token spending. Basic usage ----------------- Shell 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": 4096, "messages": [{\ "role": "user",\ "content": "Analyze the trade-offs between microservices and monolithic architectures"\ }], "output_config": { "effort": "medium" } }' When to adjust the effort parameter ----------------------------------------- * Use **max effort** when you need the absolute highest capability with no constraints: the most thorough reasoning and deepest analysis. Available on Claude Mythos Preview, Claude Opus 4.6, and Claude Sonnet 4.6. * Use **high effort** (the default) when you need Claude's best work: complex reasoning, nuanced analysis, difficult coding problems, or any task where quality is the top priority. * Use **medium effort** as a balanced option when you want solid performance without the full token expenditure of high effort. * Use **low effort** when you're optimizing for speed (because Claude answers with fewer tokens) or cost. For example, simple classification tasks, quick lookups, or high-volume use cases where marginal quality improvements don't justify additional latency or spend. Effort with tool use -------------------------- When using tools, the effort parameter affects both the explanations around tool calls and the tool calls themselves. Lower effort levels tend to: * Combine multiple operations into fewer tool calls * Make fewer tool calls * Proceed directly to action without preamble * Use terse confirmation messages after completion Higher effort levels may: * Make more tool calls * Explain the plan before taking action * Provide detailed summaries of changes * Include more comprehensive code comments Effort with extended thinking ----------------------------------- The effort parameter works alongside extended thinking. Its behavior depends on the model: * **Claude Mythos Preview** uses [adaptive thinking](https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking) by default (no `thinking` configuration required). `thinking: {type: "disabled"}` is rejected. Effort controls thinking depth the same way as on Opus 4.6. * **Claude Opus 4.6** uses [adaptive thinking](https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking) (`thinking: {type: "adaptive"}`), where effort is the recommended control for thinking depth. While `budget_tokens` is still accepted on Opus 4.6, it is deprecated and will be removed in a future release. At `high` and `max` effort, Claude almost always thinks deeply. At lower levels, it may skip thinking for simpler problems. * **Claude Sonnet 4.6** uses [adaptive thinking](https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking) (where effort controls thinking depth). Manual thinking with [interleaved mode](https://platform.claude.com/docs/en/build-with-claude/extended-thinking#interleaved-thinking) (`thinking: {type: "enabled", budget_tokens: N}`) is still functional but deprecated. * **Claude Opus 4.5 and other Claude 4 models** use manual thinking (`thinking: {type: "enabled", budget_tokens: N}`), where effort works alongside the thinking token budget. Set the effort level for your task, then set the thinking token budget based on task complexity. The effort parameter can be used with or without extended thinking enabled. When used without thinking, it still controls overall token spend for text responses and tool calls. Best practices -------------------- 1. **Set effort explicitly:** The API defaults to `high`, but the right starting point depends on your model and workload. 2. **Use low for speed-sensitive or simple tasks:** When latency matters or tasks are straightforward, low effort can significantly reduce response times and costs. 3. **Test your use case:** The impact of effort levels varies by task type. Evaluate performance on your specific use cases before deploying. 4. **Consider dynamic effort:** Adjust effort based on task complexity. Simple queries may warrant low effort while agentic coding and complex reasoning benefit from high effort. Was this page helpful? --- # Features overview - Claude API Docs Loading... Building with Claude Features overview Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Claude's API surface is organized into five areas: * **Model capabilities:** Control how Claude reasons and formats responses. * **Tools:** Let Claude take actions on the web or in your environment. * **Tool infrastructure:** Handles discovery and orchestration at scale. * **Context management:** Keeps long-running sessions efficient. * **Files and assets:** Manage the documents and data you provide to Claude. If you're new, start with [model capabilities](https://platform.claude.com/docs/en/build-with-claude/overview#model-capabilities) and [tools](https://platform.claude.com/docs/en/build-with-claude/overview#tools) . Return to the other sections when you're ready to optimize cost, latency, or scale. Feature availability -------------------------- Features on the Claude Platform are assigned one of the following availability classifications per platform (shown in the Availability column of each table below). Not all features pass through every stage. A feature may enter at any classification and may skip stages. | Classification | Description | | --- | --- | | **Beta**\* | Preview features used for gathering feedback and iterating on a less mature use case. Availability may be limited, including through sign-up requirements or waitlists, and may not be publicly announced.

Features may change significantly or be discontinued based on feedback. Not guaranteed for ongoing production use. Breaking changes are possible with notice, and some platform-specific limitations may apply. Beta features have a [beta header](https://platform.claude.com/docs/en/api/beta-headers)
. | | **Generally available (GA)** | Feature is stable, fully supported, and recommended for production use. Should not have a beta header or other indicator that the feature is in a preview state. Covered by standard API [versioning](https://platform.claude.com/docs/en/api/versioning)
guarantees. | | **Deprecated** | Feature is still functional but no longer recommended. A migration path and removal timeline are provided. | | **Retired** | Feature is no longer available. | _\* May carry a qualifier indicating narrower availability or added constraints (for example, "beta: research preview"). See the feature's page for details._ Model capabilities ------------------------ Ways to steer Claude and Claude's direct outputs, including response format, reasoning depth, and input modalities. You can discover which capabilities a model supports programmatically. The [Models API](https://platform.claude.com/docs/en/api/models/list) returns `max_input_tokens`, `max_tokens`, and a `capabilities` object for every available model. | Feature | Description | Zero Data Retention (ZDR) | Availability | | --- | --- | --- | --- | | [Context windows](https://platform.claude.com/docs/en/build-with-claude/context-windows) | Up to 1M tokens for processing large documents, extensive codebases, and long conversations. | ZDR eligible | Claude API (GA)

Amazon Bedrock (GA)

Google Cloud's Vertex AI (GA)

Microsoft Foundry (Beta) | | [Adaptive thinking](https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking) | Let Claude dynamically decide when and how much to think. The recommended thinking mode for Opus 4.6. Use the effort parameter to control thinking depth. | ZDR eligible | Claude API (GA)

Amazon Bedrock (GA)

Google Cloud's Vertex AI (GA)

Microsoft Foundry (Beta) | | [Batch processing](https://platform.claude.com/docs/en/build-with-claude/batch-processing) | Process large volumes of requests asynchronously for cost savings. Send batches with a large number of queries per batch. Batch API calls cost 50% less than standard API calls. | Not ZDR eligible | Claude API (GA)

Amazon Bedrock (GA)

Google Cloud's Vertex AI (GA) | | [Citations](https://platform.claude.com/docs/en/build-with-claude/citations) | Ground Claude's responses in source documents. With Citations, Claude can provide detailed references to the exact sentences and passages it uses to generate responses, leading to more verifiable, trustworthy outputs. | ZDR eligible | Claude API (GA)

Amazon Bedrock (GA)

Google Cloud's Vertex AI (GA)

Microsoft Foundry (Beta) | | [Data residency](https://platform.claude.com/docs/en/build-with-claude/data-residency) | Control where model inference runs using geographic controls. Specify `"global"` or `"us"` routing per request via the `inference_geo` parameter. | ZDR eligible | Claude API (GA) | | [Effort](https://platform.claude.com/docs/en/build-with-claude/effort) | Control how many tokens Claude uses when responding with the effort parameter, trading off between response thoroughness and token efficiency. Supported on Opus 4.6 and Opus 4.5. | ZDR eligible | Claude API (GA)

Amazon Bedrock (GA)

Google Cloud's Vertex AI (GA)

Microsoft Foundry (Beta) | | [Extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking) | Enhanced reasoning capabilities for complex tasks, providing transparency into Claude's step-by-step thought process before delivering its final answer. | ZDR eligible | Claude API (GA)

Amazon Bedrock (GA)

Google Cloud's Vertex AI (GA)

Microsoft Foundry (Beta) | | [PDF support](https://platform.claude.com/docs/en/build-with-claude/pdf-support) | Process and analyze text and visual content from PDF documents. | ZDR eligible | Claude API (GA)

Amazon Bedrock (GA)

Google Cloud's Vertex AI (GA)

Microsoft Foundry (Beta) | | [Search results](https://platform.claude.com/docs/en/build-with-claude/search-results) | Enable natural citations for RAG applications by providing search results with proper source attribution. Achieve web search-quality citations for custom knowledge bases and tools. | ZDR eligible | Claude API (GA)

Amazon Bedrock (GA)

Google Cloud's Vertex AI (GA)

Microsoft Foundry (Beta) | | [Structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs) | Guarantee schema conformance with two approaches: JSON outputs for structured data responses, and strict tool use for validated tool inputs. | [ZDR eligible (qualified)](https://platform.claude.com/docs/en/build-with-claude/structured-outputs#data-retention)
\* | Claude API (GA)

Amazon Bedrock (GA)

Microsoft Foundry (Beta) | Tools ----------- Built-in tools that Claude invokes via `tool_use`. Server-side tools are run by the platform; client-side tools are implemented and executed by you. ### Server-side tools | Feature | Description | ZDR | Availability | | --- | --- | --- | --- | | [Code execution](https://platform.claude.com/docs/en/agents-and-tools/tool-use/code-execution-tool) | Run code in a sandboxed environment for advanced data analysis, calculations, and file processing. Free when used with web search or web fetch. | Not ZDR eligible | Claude API (GA)

Microsoft Foundry (Beta) | | [Web fetch](https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-fetch-tool) | Retrieve full content from specified web pages and PDF documents for in-depth analysis. | ZDR eligible\* | Claude API (GA)

Microsoft Foundry (Beta) | | [Web search](https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-search-tool) | Augment Claude's comprehensive knowledge with current, real-world data from across the web. | ZDR eligible\* | Claude API (GA)

Google Cloud's Vertex AI (GA)

Microsoft Foundry (Beta) | ### Client-side tools | Feature | Description | ZDR | Availability | | --- | --- | --- | --- | | [Bash](https://platform.claude.com/docs/en/agents-and-tools/tool-use/bash-tool) | Execute bash commands and scripts to interact with the system shell and perform command-line operations. | ZDR eligible | Claude API (GA)

Amazon Bedrock (GA)

Google Cloud's Vertex AI (GA)

Microsoft Foundry (Beta) | | [Computer use](https://platform.claude.com/docs/en/agents-and-tools/tool-use/computer-use-tool) | Control computer interfaces by taking screenshots and issuing mouse and keyboard commands. | ZDR eligible | Claude API (Beta)

Amazon Bedrock (Beta)

Google Cloud's Vertex AI (Beta)

Microsoft Foundry (Beta) | | [Memory](https://platform.claude.com/docs/en/agents-and-tools/tool-use/memory-tool) | Enable Claude to store and retrieve information across conversations. Build knowledge bases over time, maintain project context, and learn from past interactions. | ZDR eligible | Claude API (GA)

Amazon Bedrock (GA)

Google Cloud's Vertex AI (GA)

Microsoft Foundry (Beta) | | [Text editor](https://platform.claude.com/docs/en/agents-and-tools/tool-use/text-editor-tool) | Create and edit text files with a built-in text editor interface for file manipulation tasks. | ZDR eligible | Claude API (GA)

Amazon Bedrock (GA)

Google Cloud's Vertex AI (GA)

Microsoft Foundry (Beta) | Tool infrastructure ------------------------- Infrastructure that supports discovering, orchestrating, and scaling tool use. | Feature | Description | ZDR | Availability | | --- | --- | --- | --- | | [Agent Skills](https://platform.claude.com/docs/en/agents-and-tools/agent-skills/overview) | Extend Claude's capabilities with Skills. Use pre-built Skills (PowerPoint, Excel, Word, PDF) or create custom Skills with instructions and scripts. Skills use progressive disclosure to efficiently manage context. | Not ZDR eligible | Claude API (Beta)

Microsoft Foundry (Beta) | | [Fine-grained tool streaming](https://platform.claude.com/docs/en/agents-and-tools/tool-use/fine-grained-tool-streaming) | Stream tool use parameters without buffering/JSON validation, reducing latency for receiving large parameters. | ZDR eligible | Claude API (GA)

Amazon Bedrock (GA)

Google Cloud's Vertex AI (GA)

Microsoft Foundry (Beta) | | [MCP connector](https://platform.claude.com/docs/en/agents-and-tools/mcp-connector) | Connect to remote [MCP](https://platform.claude.com/docs/en/mcp)
servers directly from the Messages API without a separate MCP client. | Not ZDR eligible | Claude API (Beta)

Microsoft Foundry (Beta) | | [Programmatic tool calling](https://platform.claude.com/docs/en/agents-and-tools/tool-use/programmatic-tool-calling) | Enable Claude to call your tools programmatically from within code execution containers, reducing latency and token consumption for multi-tool workflows. | Not ZDR eligible | Claude API (GA)

Microsoft Foundry (Beta) | | [Tool search](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-search-tool) | Scale to thousands of tools by dynamically discovering and loading tools on-demand using regex-based search, optimizing context usage and improving tool selection accuracy. | [ZDR eligible (qualified)](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-search-tool#data-retention)
\* | Claude API (GA)

Amazon Bedrock (GA)

Google Cloud's Vertex AI (GA)

Microsoft Foundry (Beta) | Context management ------------------------ Infrastructure for controlling and optimizing Claude's context window. | Feature | Description | ZDR | Availability | | --- | --- | --- | --- | | [Compaction](https://platform.claude.com/docs/en/build-with-claude/compaction) | Server-side context summarization for long-running conversations. When context approaches the window limit, the API automatically summarizes earlier parts of the conversation. Supported on Opus 4.6 and Sonnet 4.6. | ZDR eligible | Claude API (Beta)

Amazon Bedrock (Beta)

Google Cloud's Vertex AI (Beta)

Microsoft Foundry (Beta) | | [Context editing](https://platform.claude.com/docs/en/build-with-claude/context-editing) | Automatically manage conversation context with configurable strategies. Supports clearing tool results when approaching token limits and managing thinking blocks in extended thinking conversations. | ZDR eligible | Claude API (Beta)

Amazon Bedrock (Beta)

Google Cloud's Vertex AI (Beta)

Microsoft Foundry (Beta) | | [Automatic prompt caching](https://platform.claude.com/docs/en/build-with-claude/prompt-caching#automatic-caching) | Simplify prompt caching to a single API parameter. The system automatically caches the last cacheable block in your request, moving the cache point forward as conversations grow. | ZDR eligible | Claude API (GA)

Microsoft Foundry (Beta) | | [Prompt caching (5m)](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) | Provide Claude with more background knowledge and example outputs to reduce costs and latency. | ZDR eligible | Claude API (GA)

Amazon Bedrock (GA)

Google Cloud's Vertex AI (GA)

Microsoft Foundry (Beta) | | [Prompt caching (1hr)](https://platform.claude.com/docs/en/build-with-claude/prompt-caching#1-hour-cache-duration) | Extended 1-hour cache duration for less frequently accessed but important context, complementing the standard 5-minute cache. | ZDR eligible | Claude API (GA)

Google Cloud's Vertex AI (GA)

Microsoft Foundry (Beta) | | [Token counting](https://platform.claude.com/docs/en/api/messages-count-tokens) | Token counting enables you to determine the number of tokens in a message before sending it to Claude, helping you make informed decisions about your prompts and usage. | ZDR eligible | Claude API (GA)

Amazon Bedrock (GA)

Google Cloud's Vertex AI (GA)

Microsoft Foundry (Beta) | Files and assets ---------------------- Manage files and assets for use with Claude. | Feature | Description | ZDR | Availability | | --- | --- | --- | --- | | [Files API](https://platform.claude.com/docs/en/build-with-claude/files) | Upload and manage files to use with Claude without re-uploading content with each request. Supports PDFs, images, and text files. | Not ZDR eligible | Claude API (Beta)

Microsoft Foundry (Beta) | \* **Structured outputs:** Your prompts and Claude's outputs are not stored. Only JSON schemas are cached, for up to 24 hours since last use. **Tool search:** Only tool catalog data (names, descriptions, argument metadata) is stored server-side; custom client-side implementations are fully ZDR-eligible. **Web search and web fetch:** ZDR-eligible except when [dynamic filtering](https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-search-tool#dynamic-filtering) is enabled. See [ZDR details](https://platform.claude.com/docs/en/build-with-claude/api-and-data-retention#feature-eligibility) . Was this page helpful? --- # Fast mode (beta: research preview) - Claude API Docs Loading... Model capabilities Fast mode (beta: research preview) Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Fast mode provides significantly faster output token generation for Claude Opus 4.6. By setting `speed: "fast"` in your API request, you get up to 2.5x higher output tokens per second from the same model at premium pricing. Fast mode is in beta (research preview). [Join the waitlist](https://claude.com/fast-mode) to request access. Availability is limited while Anthropic gathers feedback. This feature is eligible for [Zero Data Retention (ZDR)](https://platform.claude.com/docs/en/build-with-claude/api-and-data-retention) . When your organization has a ZDR arrangement, data sent through this feature is not stored after the API response is returned. Supported models ---------------------- Fast mode is supported on the following models: * Claude Opus 4.6 (`claude-opus-4-6`) How fast mode works ------------------------- Fast mode runs the same model with a faster inference configuration. There is no change to intelligence or capabilities. * Up to 2.5x higher output tokens per second compared to standard speed * Speed benefits are focused on output tokens per second (OTPS), not time to first token (TTFT) * Same model weights and behavior (not a different model) Basic usage ----------------- Pricing ------------- Fast mode is priced at 6x standard Opus rates across the full context window, including requests over 200k input tokens. The following table shows pricing for Claude Opus 4.6 with fast mode: | Input | Output | | --- | --- | | $30 / MTok | $150 / MTok | Fast mode pricing stacks with other pricing modifiers: * [Prompt caching multipliers](https://platform.claude.com/docs/en/about-claude/pricing#model-pricing) apply on top of fast mode pricing * [Data residency](https://platform.claude.com/docs/en/build-with-claude/data-residency) multipliers apply on top of fast mode pricing For complete pricing details, see the [pricing page](https://platform.claude.com/docs/en/about-claude/pricing#fast-mode-pricing) . Rate limits ----------------- Fast mode has a dedicated rate limit that is separate from standard Opus rate limits. When your fast mode rate limit is exceeded, the API returns a `429` error with a `retry-after` header indicating when capacity will be available. The response includes headers that indicate your fast mode rate limit status: | Header | Description | | --- | --- | | `anthropic-fast-input-tokens-limit` | Maximum fast mode input tokens per minute | | `anthropic-fast-input-tokens-remaining` | Remaining fast mode input tokens | | `anthropic-fast-input-tokens-reset` | Time when the fast mode input token limit resets | | `anthropic-fast-output-tokens-limit` | Maximum fast mode output tokens per minute | | `anthropic-fast-output-tokens-remaining` | Remaining fast mode output tokens | | `anthropic-fast-output-tokens-reset` | Time when the fast mode output token limit resets | For tier-specific rate limits, see the [rate limits page](https://platform.claude.com/docs/en/api/rate-limits) . Checking which speed was used ----------------------------------- The response `usage` object includes a `speed` field that indicates which speed was used, either `"fast"` or `"standard"`: Output { "id": "msg_01XFDUDYJgAACzvnptvVoYEL", "type": "message", "role": "assistant", // ... "usage": { "input_tokens": 523, "output_tokens": 1842, "speed": "fast" } } To track fast mode usage and costs across your organization, see the [Usage and Cost API](https://platform.claude.com/docs/en/build-with-claude/usage-cost-api) . Retries and fallback -------------------------- ### Automatic retries When fast mode rate limits are exceeded, the API returns a `429` error with a `retry-after` header. The Anthropic SDKs automatically retry these requests up to 2 times by default (configurable via `max_retries`), waiting for the server-specified delay before each retry. Since fast mode uses continuous token replenishment, the `retry-after` delay is typically short and requests succeed once capacity is available. ### Falling back to standard speed If you'd prefer to fall back to standard speed rather than wait for fast mode capacity, catch the rate limit error and retry without `speed: "fast"`. Set `max_retries` to `0` on the initial fast request to skip automatic retries and fail immediately on rate limit errors. Falling back from fast to standard speed will result in a [prompt cache](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) miss. Requests at different speeds do not share cached prefixes. Since setting `max_retries` to `0` also disables retries for other transient errors (overloaded, internal server errors), the examples below re-issue the original request with default retries for those cases. Considerations -------------------- * **Prompt caching:** Switching between fast and standard speed invalidates the prompt cache. Requests at different speeds do not share cached prefixes. * **Supported models:** Fast mode is currently supported on Opus 4.6 only. Sending `speed: "fast"` with an unsupported model returns an error. * **TTFT:** Fast mode's benefits are focused on output tokens per second (OTPS), not time to first token (TTFT). * **Batch API:** Fast mode is not available with the [Batch API](https://platform.claude.com/docs/en/build-with-claude/batch-processing) . * **Priority Tier:** Fast mode is not available with [Priority Tier](https://platform.claude.com/docs/en/api/service-tiers) . Next steps ---------------- [Pricing\ \ View detailed fast mode pricing information.](https://platform.claude.com/docs/en/about-claude/pricing#fast-mode-pricing) [Rate limits\ \ Check rate limit tiers for fast mode.](https://platform.claude.com/docs/en/api/rate-limits) [Effort parameter\ \ Control token usage with the effort parameter.](https://platform.claude.com/docs/en/build-with-claude/effort) Was this page helpful? Shell curl https://api.anthropic.com/v1/messages \ --header "x-api-key: $ANTHROPIC_API_KEY" \ --header "anthropic-version: 2023-06-01" \ --header "anthropic-beta: fast-mode-2026-02-01" \ --header "content-type: application/json" \ --data '{ "model": "claude-opus-4-6", "max_tokens": 4096, "speed": "fast", "messages": [{\ "role": "user",\ "content": "Refactor this module to use dependency injection"\ }] }' Shell curl https://api.anthropic.com/v1/messages \ --header "x-api-key: $ANTHROPIC_API_KEY" \ --header "anthropic-version: 2023-06-01" \ --header "anthropic-beta: fast-mode-2026-02-01" \ --header "content-type: application/json" \ --data '{ "model": "claude-opus-4-6", "max_tokens": 1024, "speed": "fast", "messages": [{"role": "user", "content": "Hello"}] }' CLI # `ant` retries 429/5xx automatically and has no per-request max_retries # override, so on a fast-mode 429 the fallback runs after the built-in # retries exhaust. --transform-error surfaces error.type for branching. create_message_with_fast_fallback() { local speed="$1" max_attempts="${2:-3}" body out body=${3:-$(cat)} out=$( ant beta:messages create --beta fast-mode-2026-02-01 \ ${speed:+--speed "$speed"} \ --transform-error error.type --format-error yaml <<<"$body" 2>/dev/null ) && { printf '%s\n' "$out"; return; } case "$out" in rate_limit_error) if [[ -n "$speed" ]]; then create_message_with_fast_fallback "" "$max_attempts" "$body" return fi ;; overloaded_error | api_error | "") if (( max_attempts > 1 )); then create_message_with_fast_fallback "$speed" $((max_attempts - 1)) "$body" return fi ;; esac printf '%s\n' "${out:-connection_error}" >&2 return 1 } MESSAGE=$( create_message_with_fast_fallback fast <<'YAML' model: claude-opus-4-6 max_tokens: 1024 messages: - role: user content: Hello YAML ) --- # Adaptive thinking - Claude API Docs Loading... Model capabilities Adaptive thinking Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page This feature is eligible for [Zero Data Retention (ZDR)](https://platform.claude.com/docs/en/build-with-claude/api-and-data-retention) . When your organization has a ZDR arrangement, data sent through this feature is not stored after the API response is returned. Adaptive thinking is the recommended way to use [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking) with Claude Opus 4.6 and Claude Sonnet 4.6, and is the default mode on [Claude Mythos Preview](https://anthropic.com/glasswing) (where it auto-applies whenever `thinking` is unset). Instead of manually setting a thinking token budget, adaptive thinking lets Claude dynamically determine when and how much to use extended thinking based on the complexity of each request. Adaptive thinking can drive better performance than extended thinking with a fixed `budget_tokens` for many workloads, especially bimodal tasks and long-horizon agentic workflows. No beta header is required. If your workload requires predictable latency or precise control over thinking costs, extended thinking with `budget_tokens` is still functional on these models but is deprecated and no longer recommended. See the warning below. Supported models ---------------------- Adaptive thinking is supported on the following models: * Claude Mythos Preview (`claude-mythos-preview`), adaptive thinking is the default; `thinking: {type: "disabled"}` is not supported * Claude Opus 4.6 (`claude-opus-4-6`) * Claude Sonnet 4.6 (`claude-sonnet-4-6`) `thinking.type: "enabled"` and `budget_tokens` are [**deprecated**](https://platform.claude.com/docs/en/build-with-claude/overview#feature-availability) on Opus 4.6 and Sonnet 4.6 and will be removed in a future model release. Use `thinking.type: "adaptive"` with the `effort` parameter instead. Existing `budget_tokens` configurations are still functional but no longer recommended; plan to migrate. Older models (Sonnet 4.5, Opus 4.5, etc.) do not support adaptive thinking and require `thinking.type: "enabled"` with `budget_tokens`. How adaptive thinking works --------------------------------- In adaptive mode, thinking is optional for the model. Claude evaluates the complexity of each request and determines whether and how much to use extended thinking. At the default effort level (`high`), Claude almost always thinks. At lower effort levels, Claude may skip thinking for simpler problems. Adaptive thinking also automatically enables [interleaved thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking#interleaved-thinking) . This means Claude can think between tool calls, making it especially effective for agentic workflows. How to use adaptive thinking ---------------------------------- Set `thinking.type` to `"adaptive"` in your API request: Shell 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."\ }\ ] }' Adaptive thinking with the effort parameter ------------------------------------------------- You can combine adaptive thinking with the [effort parameter](https://platform.claude.com/docs/en/build-with-claude/effort) to guide how much thinking Claude does. The effort level acts as soft guidance for Claude's thinking allocation: | Effort level | Thinking behavior | | --- | --- | | `max` | Claude always thinks with no constraints on thinking depth. Available on Claude Opus 4.6 and Claude Sonnet 4.6. | | `high` (default) | Claude always thinks. Provides deep reasoning on complex tasks. | | `medium` | Claude uses moderate thinking. May skip thinking for very simple queries. | | `low` | Claude minimizes thinking. Skips thinking for simple tasks where speed matters most. | Shell 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" }, "output_config": { "effort": "medium" }, "messages": [\ {\ "role": "user",\ "content": "What is the capital of France?"\ }\ ] }' Streaming with adaptive thinking -------------------------------------- Adaptive thinking works seamlessly with [streaming](https://platform.claude.com/docs/en/build-with-claude/streaming) . Thinking blocks are streamed via `thinking_delta` events just like manual thinking mode: CLI ant messages create --stream --format jsonl \ --model claude-opus-4-6 \ --max-tokens 16000 \ --thinking '{type: adaptive}' \ --message '{role: user, content: What is the greatest common divisor of 1071 and 462?}' Adaptive vs manual vs disabled thinking --------------------------------------------- | Mode | Config | Availability | When to use | | --- | --- | --- | --- | | **Adaptive** | `thinking: {type: "adaptive"}` | Claude Mythos Preview (default), Opus 4.6, Sonnet 4.6 | Claude determines when and how much to use extended thinking. Use `effort` to guide. | | **Manual** | `thinking: {type: "enabled", budget_tokens: N}` | All models. Deprecated on Opus 4.6 and Sonnet 4.6 (consider adaptive mode instead). | When you need precise control over thinking token spend. | | **Disabled** | Omit `thinking` parameter or pass `{type: "disabled"}` | All models except Claude Mythos Preview | When you don't need extended thinking and want the lowest latency. | Adaptive thinking is available on Claude Mythos Preview, Opus 4.6, and Sonnet 4.6. On Mythos Preview, adaptive thinking is the default and applies automatically whenever `thinking` is unset. Older models only support `type: "enabled"` with `budget_tokens`. On Opus 4.6 and Sonnet 4.6, `type: "enabled"` with `budget_tokens` is still functional but deprecated. **Interleaved thinking availability by mode:** * **Adaptive mode:** Interleaved thinking is automatically enabled on Claude Mythos Preview, Opus 4.6, and Sonnet 4.6. On Mythos Preview, inter-tool reasoning always lives inside thinking blocks. * **Manual mode on Sonnet 4.6:** Interleaved thinking works via the `interleaved-thinking-2025-05-14` beta header. * **Manual mode on Opus 4.6:** Interleaved thinking is not available. If your agentic workflow requires thinking between tool calls on Opus 4.6, use adaptive mode. Important considerations ------------------------------ ### Validation changes When using adaptive thinking, previous assistant turns don't need to start with thinking blocks. This is more flexible than manual mode, where the API enforces that thinking-enabled turns begin with a thinking block. ### Prompt caching Consecutive requests using `adaptive` thinking preserve [prompt cache](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) breakpoints. However, switching between `adaptive` and `enabled`/`disabled` thinking modes breaks cache breakpoints for messages. System prompts and tool definitions remain cached regardless of mode changes. ### Tuning thinking behavior Adaptive thinking's triggering behavior is promptable. If Claude is thinking more or less often than you'd like, you can add guidance to your system prompt: 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. Steering Claude to think less often may reduce quality on tasks that benefit from reasoning. Measure the impact on your specific workloads before deploying prompt-based tuning to production. Consider testing with lower [effort levels](https://platform.claude.com/docs/en/build-with-claude/effort) first. ### Cost control Use `max_tokens` as a hard limit on total output (thinking + response text). The `effort` parameter provides additional soft guidance on how much thinking Claude allocates. Together, these give you effective control over cost. At `high` and `max` effort levels, Claude may think more extensively and can be more likely to exhaust the `max_tokens` budget. If you observe `stop_reason: "max_tokens"` in responses, consider increasing `max_tokens` to give the model more room, or lowering the effort level. Working with thinking blocks ---------------------------------- The following concepts apply to all models that support extended thinking, regardless of whether you use adaptive or manual mode. ### 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. This is the default behavior on Claude 4 models when the `display` field on the thinking configuration is unset or set to `"summarized"`. On [Claude Mythos Preview](https://anthropic.com/glasswing) , `display` defaults to `"omitted"` instead, so you must set `display: "summarized"` explicitly to receive summarized thinking. 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. * On Claude 4 models, the first few lines of thinking output are more verbose, providing detailed reasoning that's particularly helpful for prompt engineering purposes. [Claude Mythos Preview](https://anthropic.com/glasswing) summarizes from the first token, so its thinking blocks do not show this verbose preamble. * 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](https://platform.claude.com/cdn-cgi/l/email-protection#3f4c5e535a4c7f5e514b574d504f565c115c5052) . ### Controlling thinking display The `display` field on the thinking configuration controls how thinking content is returned in API responses. It accepts two values: * `"summarized"`: Thinking blocks contain summarized thinking text. See [Summarized thinking](https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking#summarized-thinking) for details. This is the default on Claude 4 models. * `"omitted"`: Thinking blocks are returned with an empty `thinking` field. The `signature` field still carries the encrypted full thinking for multi-turn continuity (see [Thinking encryption](https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking#thinking-encryption) ). This is the default on [Claude Mythos Preview](https://anthropic.com/glasswing) . Setting `display: "omitted"` is useful when your application doesn't surface thinking content to users. The primary benefit is **faster time-to-first-text-token when streaming:** The server skips streaming thinking tokens entirely and delivers only the signature, so the final text response begins streaming sooner. No SDK currently includes `display` in its type definitions. The Python SDK forwards unrecognized dict keys to the API at runtime; passing `display` in the thinking dict works transparently. The TypeScript SDK requires a type assertion. The C#, Go, Java, PHP, and Ruby SDKs require a direct HTTP request until native support lands. Here are some important considerations for omitted thinking: * You're still charged for the full thinking tokens. Omitting reduces latency, not cost. * If you pass thinking blocks back in multi-turn conversations, pass them unchanged. The server decrypts the `signature` to reconstruct the original thinking for prompt construction (see [Preserving thinking blocks](https://platform.claude.com/docs/en/build-with-claude/extended-thinking#preserving-thinking-blocks) ). Any text you place in the `thinking` field of a round-tripped omitted block is ignored. * `display` is invalid with `thinking.type: "disabled"` (there is nothing to display). * When using `thinking.type: "adaptive"` and the model skips thinking for a simple request, no thinking block is produced regardless of `display`. The `signature` field is identical whether `display` is `"summarized"` or `"omitted"`. Switching `display` values between turns in a conversation is supported. For code examples and streaming behavior with `display: "omitted"`, see [Controlling thinking display](https://platform.claude.com/docs/en/build-with-claude/extended-thinking#controlling-thinking-display) on the extended thinking page. The examples there use `type: "enabled"`; with adaptive thinking, use: thinking = {"type": "adaptive", "display": "omitted"} ### 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](https://platform.claude.com/docs/en/build-with-claude/extended-thinking#extended-thinking-with-tool-use) . 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](https://platform.claude.com/docs/en/build-with-claude/extended-thinking#streaming-thinking) , 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. * `signature` values are compatible across platforms (Claude APIs, [Amazon Bedrock](https://platform.claude.com/docs/en/build-with-claude/claude-on-amazon-bedrock) , and [Vertex AI](https://platform.claude.com/docs/en/build-with-claude/claude-on-vertex-ai) ). Values generated on one platform will be compatible with another. ### Pricing For complete pricing information including base rates, cache writes, cache hits, and output tokens, see the [pricing page](https://platform.claude.com/docs/en/about-claude/pricing) . 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 When using `display: "omitted"`: * **Input tokens:** Tokens in your original request (same as summarized) * **Output tokens (billed):** The original thinking tokens that Claude generated internally (same as summarized) * **Output tokens (visible):** Zero thinking tokens (the `thinking` field is empty) 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 thinking content visible in the response. ### Additional topics The extended thinking page covers several topics in more detail with mode-specific code examples: * **[Tool use with thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking#extended-thinking-with-tool-use) **: The same rules apply for adaptive thinking: preserve thinking blocks between tool calls and be aware of `tool_choice` limitations when thinking is active. * **[Prompt caching](https://platform.claude.com/docs/en/build-with-claude/extended-thinking#extended-thinking-with-prompt-caching) **: With adaptive thinking, consecutive requests using the same thinking mode preserve cache breakpoints. Switching between `adaptive` and `enabled`/`disabled` modes breaks cache breakpoints for messages (system prompts and tool definitions remain cached). * **[Context windows](https://platform.claude.com/docs/en/build-with-claude/extended-thinking#max-tokens-and-context-window-size-with-extended-thinking) **: How thinking tokens interact with `max_tokens` and context window limits. Next steps ---------------- [Extended thinking\ \ Learn more about extended thinking, including manual mode, tool use, and prompt caching.](https://platform.claude.com/docs/en/build-with-claude/extended-thinking) [Effort parameter\ \ Control how thoroughly Claude responds with the effort parameter.](https://platform.claude.com/docs/en/build-with-claude/effort) Was this page helpful? --- # Using the Messages API - Claude API Docs Loading... Building with Claude Using the Messages API Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Anthropic offers two ways to build with Claude, each suited to different use cases: | | Messages API | Claude Managed Agents | | --- | --- | --- | | **What it is** | Direct model prompting access | Pre-built, configurable agent harness that runs in managed infrastructure | | **Best for** | Custom agent loops and fine-grained control | Long-running tasks and asynchronous work | | **Learn more** | [Messages API docs](https://platform.claude.com/docs/en/build-with-claude/working-with-messages) | [Claude Managed Agents docs](https://platform.claude.com/docs/en/managed-agents/overview) | This guide covers common patterns for working with the Messages API, including basic requests, multi-turn conversations, prefill techniques, and vision capabilities. For complete API specifications, see the [Messages API reference](https://platform.claude.com/docs/en/api/messages/create) . This feature is eligible for [Zero Data Retention (ZDR)](https://platform.claude.com/docs/en/build-with-claude/api-and-data-retention) . When your organization has a ZDR arrangement, data sent through this feature is not stored after the API response is returned. Basic request and response -------------------------------- Shell #!/bin/sh 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": 1024, "messages": [\ {"role": "user", "content": "Hello, Claude"}\ ] }' Output { "id": "msg_01XFDUDYJgAACzvnptvVoYEL", "type": "message", "role": "assistant", "content": [\ {\ "type": "text",\ "text": "Hello!"\ }\ ], "model": "claude-opus-4-6", "stop_reason": "end_turn", "stop_sequence": null, "usage": { "input_tokens": 12, "output_tokens": 6 } } Multiple conversational turns ----------------------------------- The Messages API is stateless, which means that you always send the full conversational history to the API. You can use this pattern to build up a conversation over time. Earlier conversational turns don't necessarily need to actually originate from Claude. You can use synthetic `assistant` messages. Shell #!/bin/sh 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": 1024, "messages": [\ {"role": "user", "content": "Hello, Claude"},\ {"role": "assistant", "content": "Hello!"},\ {"role": "user", "content": "Can you describe LLMs to me?"}\ \ ] }' Output { "id": "msg_018gCsTGsXkYJVqYPxTgDHBU", "type": "message", "role": "assistant", "content": [\ {\ "type": "text",\ "text": "Sure, I'd be happy to provide..."\ }\ ], "stop_reason": "end_turn", "stop_sequence": null, "usage": { "input_tokens": 30, "output_tokens": 309 } } Putting words in Claude's mouth ------------------------------------- You can pre-fill part of Claude's response in the last position of the input messages list. This can be used to shape Claude's response. The example below uses `"max_tokens": 1` to get a single multiple choice answer from Claude. Shell #!/bin/sh 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-sonnet-4-5", "max_tokens": 1, "messages": [\ {"role": "user", "content": "What is latin for Ant? (A) Apoidea, (B) Rhopalocera, (C) Formicidae"},\ {"role": "assistant", "content": "The answer is ("}\ ] }' Output { "id": "msg_01Q8Faay6S7QPTvEUUQARt7h", "type": "message", "role": "assistant", "content": [\ {\ "type": "text",\ "text": "C"\ }\ ], "model": "claude-sonnet-4-5", "stop_reason": "max_tokens", "stop_sequence": null, "usage": { "input_tokens": 42, "output_tokens": 1 } } Prefilling is not supported on [Claude Mythos Preview](https://anthropic.com/glasswing) , Claude Opus 4.6, and Claude Sonnet 4.6. Requests using prefill with these models return a 400 error. Use [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs) or system prompt instructions instead. See the [migration guide](https://platform.claude.com/docs/en/about-claude/models/migration-guide) for migration patterns. Vision ------------ Claude can read both text and images in requests. Images can be supplied using the `base64`, `url`, or `file` source types. The `file` source type references an image uploaded through the [Files API](https://platform.claude.com/docs/en/build-with-claude/files) . Supported media types are `image/jpeg`, `image/png`, `image/gif`, and `image/webp`. See the [vision guide](https://platform.claude.com/docs/en/build-with-claude/vision) for more details. Shell #!/bin/sh # Option 1: Base64-encoded image IMAGE_URL="https://upload.wikimedia.org/wikipedia/commons/a/a7/Camponotus_flavomarginatus_ant.jpg" IMAGE_MEDIA_TYPE="image/jpeg" IMAGE_BASE64=$(curl "$IMAGE_URL" | base64 | tr -d '\n') 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": 1024, "messages": [\ {"role": "user", "content": [\ {"type": "image", "source": {\ "type": "base64",\ "media_type": "'$IMAGE_MEDIA_TYPE'",\ "data": "'$IMAGE_BASE64'"\ }},\ {"type": "text", "text": "What is in the above image?"}\ ]}\ ] }' # Option 2: URL-referenced image 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": 1024, "messages": [\ {"role": "user", "content": [\ {"type": "image", "source": {\ "type": "url",\ "url": "https://upload.wikimedia.org/wikipedia/commons/a/a7/Camponotus_flavomarginatus_ant.jpg"\ }},\ {"type": "text", "text": "What is in the above image?"}\ ]}\ ] }' Output { "id": "msg_01EcyWo6m4hyW8KHs2y2pei5", "type": "message", "role": "assistant", "content": [\ {\ "type": "text",\ "text": "This image shows an ant, specifically a close-up view of an ant. The ant is shown in detail, with its distinct head, antennae, and legs clearly visible. The image is focused on capturing the intricate details and features of the ant, likely taken with a macro lens to get an extreme close-up perspective."\ }\ ], "model": "claude-opus-4-6", "stop_reason": "end_turn", "stop_sequence": null, "usage": { "input_tokens": 1551, "output_tokens": 71 } } Tool use and computer use ------------------------------- See the [tool use guide](https://platform.claude.com/docs/en/agents-and-tools/tool-use/overview) for examples of how to use tools with the Messages API. See the [computer use guide](https://platform.claude.com/docs/en/agents-and-tools/tool-use/computer-use-tool) for examples of how to control desktop computer environments with the Messages API. For guaranteed JSON output, see [Structured Outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs) . Was this page helpful? --- # Multilingual support - Claude API Docs Loading... Model capabilities Multilingual support Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Overview -------------- Claude demonstrates robust multilingual capabilities, with particularly strong performance in zero-shot tasks across languages. The model maintains consistent relative performance across both widely-spoken and lower-resource languages, making it a reliable choice for multilingual applications. Note that Claude is capable in many languages beyond those benchmarked below. Consider testing with any languages relevant to your specific use cases. Performance data ---------------------- Below are the zero-shot chain-of-thought evaluation scores for Claude models across different languages, shown as a percent relative to English performance (100%): | Language | Claude Opus 4.11 | Claude Opus 41 | Claude Sonnet 4.51 | Claude Sonnet 41 | Claude Haiku 4.51 | | --- | --- | --- | --- | --- | --- | | English (baseline, fixed to 100%) | 100% | 100% | 100% | 100% | 100% | | Spanish | 98.1% | 98.0% | 98.2% | 97.5% | 96.4% | | Portuguese (Brazil) | 97.8% | 97.3% | 97.8% | 97.2% | 96.1% | | Italian | 97.7% | 97.5% | 97.9% | 97.3% | 96.0% | | French | 97.9% | 97.7% | 97.5% | 97.1% | 95.7% | | Indonesian | 97.3% | 97.2% | 97.3% | 96.2% | 94.2% | | German | 97.7% | 97.1% | 97.0% | 94.7% | 94.3% | | Arabic | 97.1% | 96.9% | 97.2% | 96.1% | 92.5% | | Chinese (Simplified) | 97.1% | 96.7% | 96.9% | 95.9% | 94.2% | | Korean | 96.6% | 96.4% | 96.7% | 95.9% | 93.3% | | Japanese | 96.9% | 96.2% | 96.8% | 95.6% | 93.5% | | Hindi | 96.8% | 96.7% | 96.7% | 95.8% | 92.4% | | Bengali | 95.7% | 95.2% | 95.4% | 94.4% | 90.4% | | Swahili | 89.8% | 89.5% | 91.1% | 87.1% | 78.3% | | Yoruba | 80.3% | 78.9% | 79.7% | 76.4% | 52.7% | 1 With [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking) . These metrics are based on [MMLU (Massive Multitask Language Understanding)](https://en.wikipedia.org/wiki/MMLU) English test sets that were translated into 14 additional languages by professional human translators, as documented in [OpenAI's simple-evals repository](https://github.com/openai/simple-evals/blob/main/multilingual_mmlu_benchmark_results.md) . The use of human translators for this evaluation ensures high-quality translations, particularly important for languages with fewer digital resources. * * * Best practices -------------------- When working with multilingual content: 1. **Provide clear language context**: While Claude can detect the target language automatically, explicitly stating the desired input/output language improves reliability. For enhanced fluency, you can prompt Claude to use "idiomatic speech as if it were a native speaker." 2. **Use native scripts**: Submit text in its native script rather than transliteration for optimal results 3. **Consider cultural context**: Effective communication often requires cultural and regional awareness beyond pure translation Also follow the general [prompt engineering guidelines](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/overview) to better improve Claude's performance. * * * Language support considerations ------------------------------------- * Claude processes input and generates output in most world languages that use standard Unicode characters * Performance varies by language, with particularly strong capabilities in widely-spoken languages * Even in languages with fewer digital resources, Claude maintains meaningful capabilities [Prompt Engineering Guide\ \ Master the art of prompt crafting to get the most out of Claude.](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/overview) Was this page helpful? --- # How tool use works - Claude API Docs Loading... Tools How tool use works Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page This page explains the concepts behind tool use: where tools run, how the agentic loop works, and when tool use is the right approach. For hands-on guidance, start with the [tutorial](https://platform.claude.com/docs/en/agents-and-tools/tool-use/build-a-tool-using-agent) or the [implementation guide](https://platform.claude.com/docs/en/agents-and-tools/tool-use/define-tools) . The tool-use contract --------------------------- Tool use is a contract between your application and the model. You specify what operations are available and what shape their inputs and outputs take; Claude decides when and how to call them. The model never executes anything on its own. It emits a structured request, your code (or Anthropic's servers) runs the operation, and the result flows back into the conversation. This contract makes the model behave less like a text generator and more like a function you call. Engineers with classical API experience can integrate tool use the same way they would any other typed interface: define the schema, handle the callback, return a result. The difference is that the caller on the other side is a language model choosing which function to invoke based on the conversation. Where tools run --------------------- The primary axis along which tools differ is where the code executes. Every tool falls into one of three buckets, and the bucket determines what your application is responsible for. ### User-defined tools (client-executed) You write the schema, you execute the code, you return the results. This is the main event: the vast majority of tool-use traffic is user-defined tools calling into application-specific logic. When Claude decides to use one of your tools, the API response contains a `tool_use` block with the tool name and a JSON object of arguments. Your application extracts those arguments, runs the operation (a database query, an HTTP call, a file write, whatever the tool does), and sends the output back in a `tool_result` block on the next request. Claude never sees your implementation; it only sees the schema you provided and the result you returned. ### Anthropic-schema tools (client-executed) For a handful of common operations (running shell commands, editing files, controlling a browser, managing scratchpad memory), Anthropic publishes the tool schema and your application handles execution. The tools in this category are `bash`, `text_editor`, `computer`, and `memory`. The execution model is identical to user-defined tools: the response contains a `tool_use` block, your code runs the operation, and you send back a `tool_result`. The reason to use an Anthropic-schema tool instead of defining your own equivalent is that these schemas are trained-in. Claude has been optimized on thousands of successful trajectories that use these exact tool signatures, so it calls them more reliably and recovers from errors more gracefully than it would with a custom tool that does the same thing. The schema is the interface the model already expects. ### Server-executed tools For `web_search`, `web_fetch`, `code_execution`, and `tool_search`, Anthropic runs the code. You enable the tool in your request and the server handles everything else. You never construct a `tool_result` block for these tools because the server-side loop executes the operation and feeds the output back to the model before the response reaches you. The response you receive contains `server_tool_use` blocks showing what ran and what came back, but by the time you see them, execution is already complete. Your application's job is to enable the tool and read the final answer, not to participate in the execution loop. The agentic loop (client tools) ------------------------------------- Client-executed tools (both user-defined and Anthropic-schema) require your application to drive a loop. The model can't run your code, so every tool call is a round trip: the model asks, you execute, you report back, the model continues. The canonical shape is a `while` loop keyed on `stop_reason`: 1. Send a request with your `tools` array and the user message. 2. Claude responds with `stop_reason: "tool_use"` and one or more `tool_use` blocks. 3. Execute each tool. Format the outputs as `tool_result` blocks. 4. Send a new request containing the original messages, the assistant's response, and a user message with the `tool_result` blocks. 5. Repeat from step 2 while `stop_reason` is `"tool_use"`. In practice this reads as: while `stop_reason == "tool_use"`, execute the tools and continue the conversation. The loop exits on any other stop reason (`"end_turn"`, `"max_tokens"`, `"stop_sequence"`, or `"refusal"`), which means Claude has either produced a final answer or stopped for another reason that your application should handle. For the mechanics of building requests, handling parallel tool calls, and formatting results, see [Handle tool calls](https://platform.claude.com/docs/en/agents-and-tools/tool-use/handle-tool-calls) . The server-side loop -------------------------- Server-executed tools run their own loop inside Anthropic's infrastructure. A single request from your application might trigger several web searches or code executions before a response comes back. The model searches, reads results, decides to search again, and iterates until it has what it needs, all without your application participating. This internal loop has an iteration limit. If the model is still iterating when it hits the cap, the response comes back with `stop_reason: "pause_turn"` instead of `"end_turn"`. A paused turn means the work isn't finished; re-send the conversation (including the paused response) to let the model continue where it left off. See [Server tools](https://platform.claude.com/docs/en/agents-and-tools/tool-use/server-tools) for the continuation pattern. When to use tools (and when not to) ----------------------------------------- Tool use fits when the task requires something the model can't do from text alone: * **Actions with side effects.** Sending an email, writing a file, updating a record. The model can describe these actions, but only a tool can perform them. * **Fresh or external data.** Current prices, today's weather, the contents of a database. Anything outside the training data or specific to your system needs a tool to fetch it. * **Structured, guaranteed-shape outputs.** When you need a JSON object with specific fields rather than prose that happens to contain the information, a tool schema enforces the shape. * **Calling into existing systems.** Databases, internal APIs, file systems. Tool use is the bridge between natural-language requests and the systems that fulfill them. The tell that you should be using tools: if you're writing a regex to extract a decision from model output, that decision should have been a tool call. Parsing free-form text to recover structured intent is a sign the structure belongs in the schema. Tool use doesn't fit when: * The model can answer from training alone. Summarization, translation, and general-knowledge questions don't need a tool round trip. * The interaction is one-shot Q&A with no side effects. If there's nothing to execute, there's nothing for a tool to do. * Tool-calling latency would dominate a trivial response. Every tool call is at least one extra round trip; for lightweight tasks the overhead can exceed the work. Choosing between approaches --------------------------------- | Approach | When to use it | What to expect | Learn more | | --- | --- | --- | --- | | User-defined client tools | Custom business logic, internal APIs, proprietary data | You handle execution and the agentic loop | [Define tools](https://platform.claude.com/docs/en/agents-and-tools/tool-use/define-tools) | | Anthropic-schema client tools | Standard dev operations (bash, file editing, browser control) | You handle execution; Claude calls the tool reliably because the schema is trained-in | [Tool reference](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-reference) | | Server-executed tools | Web search, code sandbox, web fetch | Anthropic handles execution; you get results directly | [Server tools](https://platform.claude.com/docs/en/agents-and-tools/tool-use/server-tools) | Next steps ---------------- [Tutorial: Build a tool-using agent\ \ Build an agent step by step from a single tool call to production.](https://platform.claude.com/docs/en/agents-and-tools/tool-use/build-a-tool-using-agent) [Define tools\ \ Schema specification, descriptions, and tool\_choice.](https://platform.claude.com/docs/en/agents-and-tools/tool-use/define-tools) [Tool reference\ \ Directory of Anthropic-provided tools.](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-reference) Was this page helpful? --- # Tool use with Claude - Claude API Docs Loading... Tools Overview Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Tool use lets Claude call functions you define or that Anthropic provides. Claude decides when to call a tool based on the user's request and the tool's description, then returns a structured call that your application executes (client tools) or that Anthropic executes (server tools). Here's the simplest example using a server tool, where Anthropic handles execution: Shell curl https://api.anthropic.com/v1/messages \ -H "x-api-key: $ANTHROPIC_API_KEY" \ -H "anthropic-version: 2023-06-01" \ -H "content-type: application/json" \ -d '{ "model": "claude-opus-4-6", "max_tokens": 1024, "tools": [{"type": "web_search_20260209", "name": "web_search"}], "messages": [{"role": "user", "content": "What'\''s the latest on the Mars rover?"}] }' * * * How tool use works ------------------------ Tools differ primarily by where the code executes. **Client tools** (including user-defined tools and Anthropic-schema tools like bash and text\_editor) run in your application: Claude responds with `stop_reason: "tool_use"` and one or more `tool_use` blocks, your code executes the operation, and you send back a `tool_result`. **Server tools** (web\_search, code\_execution, web\_fetch, tool\_search) run on Anthropic's infrastructure: you see the results directly without handling execution. For the full conceptual model including the agentic loop and when to choose each approach, see [How tool use works](https://platform.claude.com/docs/en/agents-and-tools/tool-use/how-tool-use-works) . For connecting to MCP servers, see the [MCP connector](https://platform.claude.com/docs/en/agents-and-tools/mcp-connector) . For building your own MCP client, see [modelcontextprotocol.io](https://modelcontextprotocol.io/docs/develop/build-client) . **Guarantee schema conformance with strict tool use** Add `strict: true` to your tool definitions to ensure Claude's tool calls always match your schema exactly. See [Strict tool use](https://platform.claude.com/docs/en/agents-and-tools/tool-use/strict-tool-use) . Tool access is one of the highest-leverage primitives you can give an agent. On benchmarks like [LAB-Bench FigQA](https://lab-bench.org/) (scientific figure interpretation) and [SWE-bench](https://www.swebench.com/) (real-world software engineering), adding even basic tools produces outsized capability gains, often surpassing human expert baselines. * * * Tool use examples ----------------------- For a complete hands-on walkthrough, see the [tutorial](https://platform.claude.com/docs/en/agents-and-tools/tool-use/build-a-tool-using-agent) . For reference examples of individual concepts, see [Define tools](https://platform.claude.com/docs/en/agents-and-tools/tool-use/define-tools) and [Handle tool calls](https://platform.claude.com/docs/en/agents-and-tools/tool-use/handle-tool-calls) . ### What happens when Claude needs more information * * * Pricing ------------- Tool use requests are priced based on: 1. The total number of input tokens sent to the model (including in the `tools` parameter) 2. The number of output tokens generated 3. For server-side tools, additional usage-based pricing (e.g., web search charges per search performed) Client-side tools are priced the same as any other Claude API request, while server-side tools may incur additional charges based on their specific usage. The additional tokens from tool use come from: * The `tools` parameter in API requests (tool names, descriptions, and schemas) * `tool_use` content blocks in API requests and responses * `tool_result` content blocks in API requests When you use `tools`, we also automatically include a special system prompt for the model which enables tool use. The number of tool use tokens required for each model are listed below (excluding the additional tokens listed above). Note that the table assumes at least 1 tool is provided. If no `tools` are provided, then a tool choice of `none` uses 0 additional system prompt tokens. | Model | Tool choice | Tool use system prompt token count | | --- | --- | --- | | Claude Opus 4.6 | `auto`, `none`

* * *

`any`, `tool` | 346 tokens

* * *

313 tokens | | Claude Opus 4.5 | `auto`, `none`

* * *

`any`, `tool` | 346 tokens

* * *

313 tokens | | Claude Opus 4.1 | `auto`, `none`

* * *

`any`, `tool` | 346 tokens

* * *

313 tokens | | Claude Opus 4 | `auto`, `none`

* * *

`any`, `tool` | 346 tokens

* * *

313 tokens | | Claude Sonnet 4.6 | `auto`, `none`

* * *

`any`, `tool` | 346 tokens

* * *

313 tokens | | Claude Sonnet 4.5 | `auto`, `none`

* * *

`any`, `tool` | 346 tokens

* * *

313 tokens | | Claude Sonnet 4 | `auto`, `none`

* * *

`any`, `tool` | 346 tokens

* * *

313 tokens | | Claude Sonnet 3.7 ([deprecated](https://platform.claude.com/docs/en/about-claude/model-deprecations)
) | `auto`, `none`

* * *

`any`, `tool` | 346 tokens

* * *

313 tokens | | Claude Haiku 4.5 | `auto`, `none`

* * *

`any`, `tool` | 346 tokens

* * *

313 tokens | | Claude Haiku 3.5 | `auto`, `none`

* * *

`any`, `tool` | 264 tokens

* * *

340 tokens | | Claude Opus 3 ([deprecated](https://platform.claude.com/docs/en/about-claude/model-deprecations)
) | `auto`, `none`

* * *

`any`, `tool` | 530 tokens

* * *

281 tokens | | Claude Sonnet 3 | `auto`, `none`

* * *

`any`, `tool` | 159 tokens

* * *

235 tokens | | Claude Haiku 3 | `auto`, `none`

* * *

`any`, `tool` | 264 tokens

* * *

340 tokens | These token counts are added to your normal input and output tokens to calculate the total cost of a request. Refer to the [models overview table](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison) for current per-model prices. When you send a tool use prompt, just like any other API request, the response will output both input and output token counts as part of the reported `usage` metrics. * * * Next steps ---------------- ### Choose your path [Understand the concepts\ \ Where tools run, how the loop works, and when to use tools.](https://platform.claude.com/docs/en/agents-and-tools/tool-use/how-tool-use-works) [Build step by step\ \ The tutorial: from a single tool call to production.](https://platform.claude.com/docs/en/agents-and-tools/tool-use/build-a-tool-using-agent) [Browse all tools\ \ Directory of Anthropic-provided tools and properties.](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-reference) Was this page helpful? --- # Streaming refusals - Claude API Docs Loading... Model capabilities Streaming refusals Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Starting with Claude 4 models, streaming responses from Claude's API return **`stop_reason`: `"refusal"`** when streaming classifiers intervene to handle potential policy violations. This new safety feature helps maintain content compliance during real-time streaming. To learn more about refusals triggered by API safety filters for Claude Sonnet 4.5, see [Understanding Sonnet 4.5's API Safety Filters](https://support.claude.com/en/articles/12449294-understanding-sonnet-4-5-s-api-safety-filters) . API response format ------------------------- When streaming classifiers detect content that violates Anthropic's policies, the API returns this response: { "role": "assistant", "content": [\ {\ "type": "text",\ "text": "Hello.."\ }\ ], "stop_reason": "refusal" } No additional refusal message is included. You must handle the response and provide appropriate user-facing messaging. Reset context after refusal --------------------------------- When you receive **`stop_reason`: `refusal`**, you must reset the conversation context **by removing or updating the turn that was refused** before continuing. Attempting to continue without resetting will result in continued refusals. Usage metrics are still provided in the response for billing purposes, even when the response is refused. You will be billed for output tokens up until the refusal. If you encounter `refusal` stop reasons frequently while using Claude Sonnet 4.5 or Opus 4.1, you can try updating your API calls to use Sonnet 4 (`claude-sonnet-4-20250514`), which has different usage restrictions. Implementation guide -------------------------- Here's how to detect and handle streaming refusals in your application: Shell # Stream request and check for refusal response=$(curl -N https://api.anthropic.com/v1/messages \ --header "anthropic-version: 2023-06-01" \ --header "content-type: application/json" \ --header "x-api-key: $ANTHROPIC_API_KEY" \ --data '{ "model": "claude-sonnet-4-6", "messages": [{"role": "user", "content": "Hello"}], "max_tokens": 256, "stream": true }') # Check for refusal in the stream if echo "$response" | grep -q '"stop_reason":"refusal"'; then echo "Response refused - resetting conversation context" # Reset your conversation state here fi Current refusal types --------------------------- The API currently handles refusals in three different ways: | Refusal Type | Response Format | When It Occurs | | --- | --- | --- | | Streaming classifier refusals | **`stop_reason`: `refusal`** | During streaming when content violates policies | | API input and copyright validation | 400 error codes | When input fails validation checks | | Model-generated refusals | Standard text responses | When the model itself decides to refuse | Future API versions will expand the **`stop_reason`: `refusal`** pattern to unify refusal handling across all types. Best practices -------------------- * **Monitor for refusals**: Include **`stop_reason`: `refusal`** checks in your error handling * **Reset automatically**: Implement automatic context reset when refusals are detected * **Provide custom messaging**: Create user-friendly messages for better UX when refusals occur * **Track refusal patterns**: Monitor refusal frequency to identify potential issues with your prompts Migration notes --------------------- * Future models will expand this pattern to other refusal types * Plan your error handling to accommodate future unification of refusal responses Was this page helpful? --- # Embeddings - Claude API Docs Loading... Model capabilities Embeddings Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Was this page helpful? Before implementing embeddings ------------------------------------ When selecting an embeddings provider, there are several factors you can consider depending on your needs and preferences: * Dataset size & domain specificity: size of the model training dataset and its relevance to the domain you want to embed. Larger or more domain-specific data generally produces better in-domain embeddings * Inference performance: embedding lookup speed and end-to-end latency. This is a particularly important consideration for large scale production deployments * Customization: options for continued training on private data, or specialization of models for very specific domains. This can improve performance on unique vocabularies How to get embeddings with Anthropic ------------------------------------------ Anthropic does not offer its own embedding model. One embeddings provider that has a wide variety of options and capabilities encompassing all of the above considerations is Voyage AI. Voyage AI makes state-of-the-art embedding models and offers customized models for specific industry domains such as finance and healthcare, or bespoke fine-tuned models for individual customers. The rest of this guide is for Voyage AI, but you should assess a variety of embeddings vendors to find the best fit for your specific use case. Available Models ---------------------- Voyage recommends using the following text embedding models: | Model | Context Length | Embedding Dimension | Description | | --- | --- | --- | --- | | `voyage-3-large` | 32,000 | 1024 (default), 256, 512, 2048 | The best general-purpose and multilingual retrieval quality. See [blog post](https://blog.voyageai.com/2025/01/07/voyage-3-large/)
for details. | | `voyage-3.5` | 32,000 | 1024 (default), 256, 512, 2048 | Optimized for general-purpose and multilingual retrieval quality. See [blog post](https://blog.voyageai.com/2025/05/20/voyage-3-5/)
for details. | | `voyage-3.5-lite` | 32,000 | 1024 (default), 256, 512, 2048 | Optimized for latency and cost. See [blog post](https://blog.voyageai.com/2025/05/20/voyage-3-5/)
for details. | | `voyage-code-3` | 32,000 | 1024 (default), 256, 512, 2048 | Optimized for **code** retrieval. See [blog post](https://blog.voyageai.com/2024/12/04/voyage-code-3/)
for details. | | `voyage-finance-2` | 32,000 | 1024 | Optimized for **finance** retrieval and RAG. See for details. | Additionally, the following multimodal embedding models are recommended: | Model | Context Length | Embedding Dimension | Description | | --- | --- | --- | --- | | `voyage-multimodal-3` | 32000 | 1024 | Rich multimodal embedding model that can vectorize interleaved text and content-rich images, such as screenshots of PDFs, slides, tables, figures, and more. See [blog post](https://blog.voyageai.com/2024/11/12/voyage-multimodal-3/)
for details. | Need help deciding which text embedding model to use? Check out the [FAQ](https://docs.voyageai.com/docs/faq#what-embedding-models-are-available-and-which-one-should-i-use&ref=anthropic) . Getting started with Voyage AI ------------------------------------ To access Voyage embeddings: 1. Sign up on Voyage AI's website 2. Obtain an API key 3. Set the API key as an environment variable for convenience: export VOYAGE_API_KEY="" You can obtain the embeddings by either using the official [`voyageai` Python package](https://github.com/voyage-ai/voyageai-python) or HTTP requests, as described below. ### Voyage Python library The `voyageai` package can be installed using the following command: pip install -U voyageai Then, you can create a client object and start using it to embed your texts: import voyageai vo = voyageai.Client() # This will automatically use the environment variable VOYAGE_API_KEY. # Alternatively, you can use vo = voyageai.Client(api_key="") texts = ["Sample text 1", "Sample text 2"] result = vo.embed(texts, model="voyage-3.5", input_type="document") print(result.embeddings[0]) print(result.embeddings[1]) `result.embeddings` will be a list of two embedding vectors, each containing 1024 floating-point numbers. After running the above code, the two embeddings will be printed on the screen: [-0.013131560757756233, 0.019828535616397858, ...] # embedding for "Sample text 1" [-0.0069352793507277966, 0.020878976210951805, ...] # embedding for "Sample text 2" When creating the embeddings, you can specify a few other arguments to the `embed()` function. For more information on the Voyage python package, see [the Voyage documentation](https://docs.voyageai.com/docs/embeddings#python-api) . ### Voyage HTTP API You can also get embeddings by requesting Voyage HTTP API. For example, you can send an HTTP request through the `curl` command in a terminal: curl https://api.voyageai.com/v1/embeddings \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $VOYAGE_API_KEY" \ -d '{ "input": ["Sample text 1", "Sample text 2"], "model": "voyage-3.5" }' The response you would get is a JSON object containing the embeddings and the token usage: { "object": "list", "data": [\ {\ "embedding": [-0.013131560757756233, 0.019828535616397858 /* ... */],\ "index": 0\ },\ {\ "embedding": [-0.0069352793507277966, 0.020878976210951805 /* ... */],\ "index": 1\ }\ ], "model": "voyage-3.5", "usage": { "total_tokens": 10 } } For more information on the Voyage HTTP API, see [the Voyage documentation](https://docs.voyageai.com/reference/embeddings-api) . ### AWS Marketplace Voyage embeddings are available on [AWS Marketplace](https://aws.amazon.com/marketplace/seller-profile?id=seller-snt4gb6fd7ljg) . Instructions for accessing Voyage on AWS are available in the [Voyage AWS Marketplace documentation](https://docs.voyageai.com/docs/aws-marketplace-model-package?ref=anthropic) . Quickstart example ------------------------ The following brief example shows how to use embeddings. Suppose you have a small corpus of six documents to retrieve from documents = [\ "The Mediterranean diet emphasizes fish, olive oil, and vegetables, believed to reduce chronic diseases.",\ "Photosynthesis in plants converts light energy into glucose and produces essential oxygen.",\ "20th-century innovations, from radios to smartphones, centered on electronic advancements.",\ "Rivers provide water, irrigation, and habitat for aquatic species, vital for ecosystems.",\ "Apple's conference call to discuss fourth fiscal quarter results and business updates is scheduled for Thursday, November 2, 2023 at 2:00 p.m. PT / 5:00 p.m. ET.",\ "Shakespeare's works, like 'Hamlet' and 'A Midsummer Night's Dream,' endure in literature.",\ ] First, use Voyage to convert each document into an embedding vector import voyageai vo = voyageai.Client() # Embed the documents doc_embds = vo.embed(documents, model="voyage-3.5", input_type="document").embeddings The embeddings allow you to do semantic search / retrieval in the vector space. Given an example query, query = "When is Apple's conference call scheduled?" Next, convert it into an embedding and conduct a nearest neighbor search to find the most relevant document based on the distance in the embedding space. import numpy as np # Embed the query query_embd = vo.embed([query], model="voyage-3.5", input_type="query").embeddings[0] # Compute the similarity # Voyage embeddings are normalized to length 1, therefore dot-product # and cosine similarity are the same. similarities = np.dot(doc_embds, query_embd) retrieved_id = np.argmax(similarities) print(documents[retrieved_id]) Note that `input_type="document"` and `input_type="query"` are used for embedding the document and query, respectively. More specification can be found in the [Voyage Python package section](https://platform.claude.com/docs/en/build-with-claude/embeddings#voyage-python-package) . The output would be the 5th document, which is indeed the most relevant to the query: Apple's conference call to discuss fourth fiscal quarter results and business updates is scheduled for Thursday, November 2, 2023 at 2:00 p.m. PT / 5:00 p.m. ET. If you are looking for a detailed set of cookbooks on how to do RAG with embeddings, including vector databases, check out the [RAG cookbook](https://platform.claude.com/cookbook/third-party-pinecone-rag-using-pinecone) . FAQ --------- ### Why do Voyage embeddings have superior quality? ### What embedding models are available and which should I use? Pricing ------------- Visit Voyage's [pricing page](https://docs.voyageai.com/docs/pricing?ref=anthropic) for the most up to date pricing details. [blog post](https://blog.voyageai.com/2024/06/03/domain-specific-embeddings-finance-edition-voyage-finance-2/) | | | | | | --- | --- | --- | --- | | `voyage-law-2` | 16,000 | 1024 | Optimized for **legal** and **long-context** retrieval and RAG. Also improved performance across all domains. See [blog post](https://blog.voyageai.com/2024/04/15/domain-specific-embeddings-and-retrieval-legal-edition-voyage-law-2/)
for details. | ### Which similarity function should I use? ### What is the relationship between characters, words, and tokens? ### When and how should I use the input\_type parameter? ### What quantization options are available? ### How can I truncate Matryoshka embeddings? --- # Citations - Claude API Docs Loading... Model capabilities Citations Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page This feature is eligible for [Zero Data Retention (ZDR)](https://platform.claude.com/docs/en/build-with-claude/api-and-data-retention) . When your organization has a ZDR arrangement, data sent through this feature is not stored after the API response is returned. Claude is capable of providing detailed citations when answering questions about documents, helping you track and verify information sources in responses. All [active models](https://platform.claude.com/docs/en/about-claude/models/overview) support citations, with the exception of Haiku 3. Share your feedback and suggestions about the citations feature using this [form](https://forms.gle/9n9hSrKnKe3rpowH9) . Here's an example of how to use citations with the Messages API: Shell 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-4-6", "max_tokens": 1024, "messages": [\ {\ "role": "user",\ "content": [\ {\ "type": "document",\ "source": {\ "type": "text",\ "media_type": "text/plain",\ "data": "The grass is green. The sky is blue."\ },\ "title": "My Document",\ "context": "This is a trustworthy document.",\ "citations": {"enabled": true}\ },\ {\ "type": "text",\ "text": "What color is the grass and sky?"\ }\ ]\ }\ ] }' **Comparison with prompt-based approaches** In comparison with prompt-based citations solutions, the citations feature has the following advantages: * **Cost savings:** If your prompt-based approach asks Claude to output direct quotes, you may see cost savings due to the fact that `cited_text` does not count towards your output tokens. * **Better citation reliability:** Because citations are parsed into the respective response formats mentioned above and `cited_text` is extracted, citations are guaranteed to contain valid pointers to the provided documents. * **Improved citation quality:** In evaluations, the citations feature was found to be significantly more likely to cite the most relevant quotes from documents as compared to purely prompt-based approaches. * * * How citations work ------------------------ Integrate citations with Claude in these steps: 1. 1 Provide document(s) and enable citations * Include documents in any of the supported formats: [PDFs](https://platform.claude.com/docs/en/build-with-claude/citations#pdf-documents) , [plain text](https://platform.claude.com/docs/en/build-with-claude/citations#plain-text-documents) , or [custom content](https://platform.claude.com/docs/en/build-with-claude/citations#custom-content-documents) documents * Set `citations.enabled=true` on each of your documents. Currently, citations must be enabled on all or none of the documents within a request. * Note that only text citations are currently supported and image citations are not yet possible. 2. 2 Documents get processed * Document contents are "chunked" in order to define the minimum granularity of possible citations. For example, sentence chunking would allow Claude to cite a single sentence or chain together multiple consecutive sentences to cite a paragraph (or longer)! * **For PDFs:** Text is extracted as described in [PDF Support](https://platform.claude.com/docs/en/build-with-claude/pdf-support) and content is chunked into sentences. Citing images from PDFs is not currently supported. * **For plain text documents:** Content is chunked into sentences that can be cited from. * **For custom content documents:** Your provided content blocks are used as-is and no further chunking is done. 3. 3 Claude provides cited response * Responses may now include multiple text blocks where each text block can contain a claim that Claude is making and a list of citations that support the claim. * Citations reference specific locations in source documents. The format of these citations are dependent on the type of document being cited from. * **For PDFs:** Citations include the page number range (1-indexed). * **For plain text documents:** Citations include the character index range (0-indexed). * **For custom content documents:** Citations include the content block index range (0-indexed) corresponding to the original content list provided. * Document indices are provided to indicate the reference source and are 0-indexed according to the list of all documents in your original request. **Automatic chunking vs custom content** By default, plain text and PDF documents are automatically chunked into sentences. If you need more control over citation granularity (e.g., for bullet points or transcripts), use custom content documents instead. See [Document Types](https://platform.claude.com/docs/en/build-with-claude/citations#document-types) for more details. For example, if you want Claude to be able to cite specific sentences from your RAG chunks, you should put each RAG chunk into a plain text document. Otherwise, if you do not want any further chunking to be done, or if you want to customize any additional chunking, you can put RAG chunks into custom content document(s). ### Citable vs non-citable content * Text found within a document's `source` content can be cited from. * `title` and `context` are optional fields that will be passed to the model but not used towards cited content. * `title` is limited in length so you may find the `context` field to be useful in storing any document metadata as text or stringified json. ### Citation indices * Document indices are 0-indexed from the list of all document content blocks in the request (spanning across all messages). * Character indices are 0-indexed with exclusive end indices. * Page numbers are 1-indexed with exclusive end page numbers. * Content block indices are 0-indexed with exclusive end indices from the `content` list provided in the custom content document. ### Token costs * Enabling citations incurs a slight increase in input tokens due to system prompt additions and document chunking. * However, the citations feature is very efficient with output tokens. Under the hood, the model is outputting citations in a standardized format that are then parsed into cited text and document location indices. The `cited_text` field is provided for convenience and does not count towards output tokens. * When passed back in subsequent conversation turns, `cited_text` is also not counted towards input tokens. ### Feature compatibility Citations works in conjunction with other API features including [prompt caching](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) , [token counting](https://platform.claude.com/docs/en/build-with-claude/token-counting) and [batch processing](https://platform.claude.com/docs/en/build-with-claude/batch-processing) . **Citations and Structured Outputs are incompatible** Citations cannot be used together with [Structured Outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs) . If you enable citations on any user-provided document (Document blocks or RequestSearchResultBlock) and also include the `output_config.format` parameter (or the deprecated `output_format` parameter), the API will return a 400 error. This is because citations require interleaving citation blocks with text output, which is incompatible with the strict JSON schema constraints of structured outputs. #### Using Prompt Caching with Citations Citations and prompt caching can be used together effectively. The citation blocks generated in responses cannot be cached directly, but the source documents they reference can be cached. To optimize performance, apply `cache_control` to your top-level document content blocks. Shell 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": 1024, "messages": [\ {\ "role": "user",\ "content": [\ {\ "type": "document",\ "source": {\ "type": "text",\ "media_type": "text/plain",\ "data": "This is a very long document with thousands of words..."\ },\ "citations": {"enabled": true},\ "cache_control": {"type": "ephemeral"}\ },\ {\ "type": "text",\ "text": "What does this document say about API features?"\ }\ ]\ }\ ] }' In this example: * The document content is cached using `cache_control` on the document block * Citations are enabled on the document * Claude can generate responses with citations while benefiting from cached document content * Subsequent requests using the same document will benefit from the cached content Document Types -------------------- ### Choosing a document type Three document types are supported for citations. Documents can be provided directly in the message (base64, text, or URL) or uploaded via the [Files API](https://platform.claude.com/docs/en/build-with-claude/files) and referenced by `file_id`: | Type | Best for | Chunking | Citation format | | --- | --- | --- | --- | | Plain text | Simple text documents, prose | Sentence | Character indices (0-indexed) | | PDF | PDF files with text content | Sentence | Page numbers (1-indexed) | | Custom content | Lists, transcripts, special formatting, more granular citations | No additional chunking | Block indices (0-indexed) | .csv, .xlsx, .docx, .md, and .txt files are not supported as document blocks. Convert these to plain text and include directly in message content. See [Working with other file formats](https://platform.claude.com/docs/en/build-with-claude/files#working-with-other-file-formats) . ### Plain text documents Plain text documents are automatically chunked into sentences. You can provide them inline or by reference with their `file_id`: Inline text Inline text Files API Files API ### Example plain text citation ### PDF documents PDF documents can be provided as base64-encoded data or by `file_id`. PDF text is extracted and chunked into sentences. As image citations are not yet supported, PDFs that are scans of documents and do not contain extractable text will not be citable. Base64 Base64 Files API Files API ### Example PDF citation ### Custom content documents Custom content documents give you control over citation granularity. No additional chunking is done and chunks are provided to the model according to the content blocks provided. { "type": "document", "source": { "type": "content", "content": [\ {"type": "text", "text": "First chunk"},\ {"type": "text", "text": "Second chunk"},\ ], }, "title": "Document Title", # optional "context": "Context about the document that will not be cited from", # optional "citations": {"enabled": True}, } ### Example citation * * * Response Structure ------------------------ When citations are enabled, responses include multiple text blocks with citations: { "content": [\ {"type": "text", "text": "According to the document, "},\ {\ "type": "text",\ "text": "the grass is green",\ "citations": [\ {\ "type": "char_location",\ "cited_text": "The grass is green.",\ "document_index": 0,\ "document_title": "Example Document",\ "start_char_index": 0,\ "end_char_index": 20,\ }\ ],\ },\ {"type": "text", "text": " and "},\ {\ "type": "text",\ "text": "the sky is blue",\ "citations": [\ {\ "type": "char_location",\ "cited_text": "The sky is blue.",\ "document_index": 0,\ "document_title": "Example Document",\ "start_char_index": 20,\ "end_char_index": 36,\ }\ ],\ },\ {\ "type": "text",\ "text": ". Information from page 5 states that ",\ },\ {\ "type": "text",\ "text": "water is essential",\ "citations": [\ {\ "type": "page_location",\ "cited_text": "Water is essential for life.",\ "document_index": 1,\ "document_title": "PDF Document",\ "start_page_number": 5,\ "end_page_number": 6,\ }\ ],\ },\ {\ "type": "text",\ "text": ". The custom document mentions ",\ },\ {\ "type": "text",\ "text": "important findings",\ "citations": [\ {\ "type": "content_block_location",\ "cited_text": "These are important findings.",\ "document_index": 2,\ "document_title": "Custom Content Document",\ "start_block_index": 0,\ "end_block_index": 1,\ }\ ],\ },\ ] } ### Streaming Support For streaming responses, a `citations_delta` type is included that contains a single citation to be added to the `citations` list on the current `text` content block. ### Example streaming events Was this page helpful? --- # Prompt engineering overview - Claude API Docs Loading... Prompt engineering Overview Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Before prompt engineering ------------------------------- This guide assumes that you have: 1. A clear definition of the success criteria for your use case 2. Some ways to empirically test against those criteria 3. A first draft prompt you want to improve If not, we highly suggest you spend time establishing that first. Check out [Define success criteria and build evaluations](https://platform.claude.com/docs/en/test-and-evaluate/develop-tests) for tips and guidance. [Prompt generator\ \ Don't have a first draft prompt? Try the prompt generator in the Claude Console!](https://platform.claude.com/dashboard) [Prompting best practices\ \ For model-specific tuning guidance for Claude's latest models, start here.](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices) * * * When to prompt engineer ----------------------------- This guide focuses on success criteria that are controllable through prompt engineering. Not every success criteria or failing eval is best solved by prompt engineering. For example, latency and cost can be sometimes more easily improved by selecting a different model. * * * How to prompt engineer ---------------------------- All prompting techniques — from clarity and examples to XML structuring, role prompting, thinking, and prompt chaining — are covered in [Prompting best practices](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices) . That's the living reference; start there. The [Claude Console](https://platform.claude.com/dashboard) also offers [prompting tools](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/prompting-tools) —prompt generator, templates and variables, and prompt improver—to help you build and refine prompts quickly. * * * Prompt engineering tutorial --------------------------------- If you're an interactive learner, you can dive into our interactive tutorials instead! [GitHub prompting tutorial\ \ An example-filled tutorial that covers the prompt engineering concepts found in our docs.](https://github.com/anthropics/prompt-eng-interactive-tutorial) [Google Sheets prompting tutorial\ \ A lighter weight version of our prompt engineering tutorial via an interactive spreadsheet.](https://docs.google.com/spreadsheets/d/19jzLgRruG9kjUQNKtCg1ZjdD6l6weA6qRXG5zLIAhC8) Was this page helpful? --- # Web search tool - Claude API Docs Loading... Tools Web search tool Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page The web search tool gives Claude direct access to real-time web content, allowing it to answer questions with up-to-date information beyond its knowledge cutoff. The response includes citations for sources drawn from search results. The latest web search tool version (`web_search_20260209`) supports **dynamic filtering** with [Claude Mythos Preview](https://anthropic.com/glasswing) , Claude Opus 4.6, and Claude Sonnet 4.6. Claude can write and execute code to filter search results before they reach the context window, keeping only relevant information and discarding the rest. This leads to more accurate responses while reducing token consumption. The previous tool version (`web_search_20250305`) remains available without dynamic filtering. For [Claude Mythos Preview](https://anthropic.com/glasswing) , web search is supported on the Claude API, Microsoft Foundry, and Google Vertex AI. Web search is not available for Mythos Preview on Amazon Bedrock. For Zero Data Retention eligibility and the `allowed_callers` workaround, see [Server tools](https://platform.claude.com/docs/en/agents-and-tools/tool-use/server-tools#zdr-and-allowed-callers) . For model support, see the [Tool reference](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-reference) . How web search works -------------------------- When you add the web search tool to your API request: 1. Claude decides when to search based on the prompt. 2. The API executes the searches and provides Claude with the results. This process may repeat multiple times throughout a single request. 3. At the end of its turn, Claude provides a final response with cited sources. ### Dynamic filtering Web search is a token-intensive task. With basic web search, Claude needs to pull search results into context, fetch full HTML from multiple websites, and reason over all of it before arriving at an answer. Often, much of this content is irrelevant, which can degrade response quality. With the `web_search_20260209` tool version, Claude can write and execute code to post-process query results. Instead of reasoning over full HTML files, Claude dynamically filters search results before loading them into context, keeping only what's relevant and discarding the rest. Dynamic filtering is particularly effective for: * Searching through technical documentation * Literature review and citation verification * Technical research * Response grounding and verification Dynamic filtering requires the [code execution tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/code-execution-tool) to be enabled. The improved web search tool is available on the Claude API and Microsoft Azure. On Google Vertex AI, the basic web search tool (without dynamic filtering) is available. To enable dynamic filtering, use the `web_search_20260209` tool version: Shell 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": 4096, "messages": [\ {\ "role": "user",\ "content": "Search for the current prices of AAPL and GOOGL, then calculate which has a better P/E ratio."\ }\ ], "tools": [{\ "type": "web_search_20260209",\ "name": "web_search"\ }] }' How to use web search --------------------------- Your organization's administrator must enable web search in the [Claude Console](https://platform.claude.com/settings/privacy) . Provide the web search tool in your API request: Shell 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": 1024, "messages": [\ {\ "role": "user",\ "content": "What is the weather in NYC?"\ }\ ], "tools": [{\ "type": "web_search_20250305",\ "name": "web_search",\ "max_uses": 5\ }] }' ### Tool definition The web search tool supports the following parameters: JSON { "type": "web_search_20250305", "name": "web_search", // Optional: Limit the number of searches per request "max_uses": 5, // Optional: Only include results from these domains "allowed_domains": ["example.com", "trusteddomain.org"], // Optional: Never include results from these domains "blocked_domains": ["untrustedsource.com"], // Optional: Localize search results "user_location": { "type": "approximate", "city": "San Francisco", "region": "California", "country": "US", "timezone": "America/Los_Angeles" } } #### Max uses The `max_uses` parameter limits the number of searches performed. If Claude attempts more searches than allowed, the `web_search_tool_result` is an error with the `max_uses_exceeded` error code. #### Domain filtering For domain filtering with `allowed_domains` and `blocked_domains`, see [Server tools](https://platform.claude.com/docs/en/agents-and-tools/tool-use/server-tools#domain-filtering) . #### Localization The `user_location` parameter allows you to localize search results based on a user's location. * `type`: The type of location (must be `approximate`) * `city`: The city name * `region`: The region or state * `country`: The country * `timezone`: The [IANA timezone ID](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) . ### Response Here's an example response structure: Output { "role": "assistant", "content": [\ // 1. Claude's decision to search\ {\ "type": "text",\ "text": "I'll search for when Claude Shannon was born."\ },\ // 2. The search query used\ {\ "type": "server_tool_use",\ "id": "srvtoolu_01WYG3ziw53XMcoyKL4XcZmE",\ "name": "web_search",\ "input": {\ "query": "claude shannon birth date"\ }\ },\ // 3. Search results\ {\ "type": "web_search_tool_result",\ "tool_use_id": "srvtoolu_01WYG3ziw53XMcoyKL4XcZmE",\ "content": [\ {\ "type": "web_search_result",\ "url": "https://en.wikipedia.org/wiki/Claude_Shannon",\ "title": "Claude Shannon - Wikipedia",\ "encrypted_content": "EqgfCioIARgBIiQ3YTAwMjY1Mi1mZjM5LTQ1NGUtODgxNC1kNjNjNTk1ZWI3Y...",\ "page_age": "April 30, 2025"\ }\ ]\ },\ {\ "text": "Based on the search results, ",\ "type": "text"\ },\ // 4. Claude's response with citations\ {\ "text": "Claude Shannon was born on April 30, 1916, in Petoskey, Michigan",\ "type": "text",\ "citations": [\ {\ "type": "web_search_result_location",\ "url": "https://en.wikipedia.org/wiki/Claude_Shannon",\ "title": "Claude Shannon - Wikipedia",\ "encrypted_index": "Eo8BCioIAhgBIiQyYjQ0OWJmZi1lNm..",\ "cited_text": "Claude Elwood Shannon (April 30, 1916 – February 24, 2001) was an American mathematician, electrical engineer, computer scientist, cryptographer and i..."\ }\ ]\ }\ ], "id": "msg_a930390d3a", "usage": { "input_tokens": 6039, "output_tokens": 931, "server_tool_use": { "web_search_requests": 1 } }, "stop_reason": "end_turn" } #### Search results Search results include: * `url`: The URL of the source page * `title`: The title of the source page * `page_age`: When the site was last updated * `encrypted_content`: Encrypted content that must be passed back in multi-turn conversations for citations #### Citations Citations are always enabled for web search, and each `web_search_result_location` includes: * `url`: The URL of the cited source * `title`: The title of the cited source * `encrypted_index`: A reference that must be passed back for multi-turn conversations. * `cited_text`: Up to 150 characters of the cited content The web search citation fields `cited_text`, `title`, and `url` do not count towards input or output token usage. When displaying API outputs directly to end users, citations must be included to the original source. If you are making modifications to API outputs, including by reprocessing and/or combining them with your own material before displaying them to end users, display citations as appropriate based on consultation with your legal team. #### Errors When the web search tool encounters an error (such as hitting rate limits), the Claude API still returns a 200 (success) response. The error is represented within the response body using the following structure: Output { "type": "web_search_tool_result", "tool_use_id": "servertoolu_a93jad", "content": { "type": "web_search_tool_result_error", "error_code": "max_uses_exceeded" } } These are the possible error codes: * `too_many_requests`: Rate limit exceeded * `invalid_input`: Invalid search query parameter * `max_uses_exceeded`: Maximum web search tool uses exceeded * `query_too_long`: Query exceeds maximum length * `unavailable`: An internal error occurred #### `pause_turn` stop reason For continuing after a `pause_turn` stop reason, see [Server tools](https://platform.claude.com/docs/en/agents-and-tools/tool-use/server-tools#the-server-side-loop-and-pause-turn) . Prompt caching -------------------- For caching tool definitions across turns, see [Tool use with prompt caching](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-use-with-prompt-caching) . Streaming --------------- With streaming enabled, you'll receive search events as part of the stream. There will be a pause while the search executes: Output event: message_start data: {"type": "message_start", "message": {"id": "msg_abc123", "type": "message"}} event: content_block_start data: {"type": "content_block_start", "index": 0, "content_block": {"type": "text", "text": ""}} // Claude's decision to search event: content_block_start data: {"type": "content_block_start", "index": 1, "content_block": {"type": "server_tool_use", "id": "srvtoolu_xyz789", "name": "web_search"}} // Search query streamed event: content_block_delta data: {"type": "content_block_delta", "index": 1, "delta": {"type": "input_json_delta", "partial_json": "{\"query\":\"latest quantum computing breakthroughs 2025\"}"}} // Pause while search executes // Search results streamed event: content_block_start data: {"type": "content_block_start", "index": 2, "content_block": {"type": "web_search_tool_result", "tool_use_id": "srvtoolu_xyz789", "content": [{"type": "web_search_result", "title": "Quantum Computing Breakthroughs in 2025", "url": "https://example.com"}]}} // Claude's response with citations (omitted in this example) Batch requests -------------------- You can include the web search tool in the [Messages Batches API](https://platform.claude.com/docs/en/build-with-claude/batch-processing) . Web search tool calls through the Messages Batches API are priced the same as those in regular Messages API requests. Usage and pricing ----------------------- Web search usage is charged in addition to token usage: "usage": { "input_tokens": 105, "output_tokens": 6039, "cache_read_input_tokens": 7123, "cache_creation_input_tokens": 7345, "server_tool_use": { "web_search_requests": 1 } } Web search is available on the Claude API for **$10 per 1,000 searches**, plus standard token costs for search-generated content. Web search results retrieved throughout a conversation are counted as input tokens, in search iterations executed during a single turn and in subsequent conversation turns. Each web search counts as one use, regardless of the number of results returned. If an error occurs during web search, the web search will not be billed. Next steps ---------------- [Server tools\ \ Shared mechanics for Anthropic-executed tools.](https://platform.claude.com/docs/en/agents-and-tools/tool-use/server-tools) [Tool reference\ \ Directory of all Anthropic-provided tools.](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-reference) Was this page helpful? --- # Remote MCP servers - Claude API Docs Loading... MCP Remote MCP servers Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Several companies have deployed remote MCP servers that developers can connect to via the Anthropic MCP connector API. These servers expand the capabilities available to developers and end users by providing remote access to various services and tools through the MCP protocol. The remote MCP servers listed below are third-party services designed to work with the Claude API. These servers are not owned, operated, or endorsed by Anthropic. Users should only connect to remote MCP servers they trust and should review each server's security practices and terms before connecting. Connecting to remote MCP servers -------------------------------------- To connect to a remote MCP server: 1. Review the documentation for the specific server you want to use. 2. Ensure you have the necessary authentication credentials. 3. Follow the server-specific connection instructions provided by each company. For more information about using remote MCP servers with the Claude API, see the [MCP connector docs](https://platform.claude.com/docs/en/agents-and-tools/mcp-connector) . Remote MCP server examples -------------------------------- Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... **Looking for more?** [Find hundreds more MCP servers on GitHub](https://github.com/modelcontextprotocol/servers) . Was this page helpful? --- # IP addresses - Claude API Docs Loading... Support & configuration IP addresses Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Inbound IP addresses -------------------------- These are the IP addresses where Anthropic services receive incoming connections. ### IPv4 `160.79.104.0/23` ### IPv6 `2607:6bc0::/48` Outbound IP addresses --------------------------- These are the stable IP addresses that Anthropic uses for outbound requests (for example, when making MCP tool calls to external servers). ### IPv4 `160.79.104.0/21` ### Phased out IP addresses The following IP addresses are no longer in use by Anthropic. If you have previously allowlisted these addresses, you should remove them from your firewall rules. 34.162.46.92/32 34.162.102.82/32 34.162.136.91/32 34.162.142.92/32 34.162.183.95/32 Was this page helpful? --- # Versions - Claude API Docs Loading... Support & configuration Versions Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Was this page helpful? For any given version with the Messages API, we will preserve: * Existing input parameters * Existing output parameters However, we may do the following: * Add additional optional inputs * Add additional values to the output * Change conditions for specific error types * Add new variants to enum-like output values (for example, streaming event types) Generally, if you are using the API as documented in this reference, we will not break your usage. Version history --------------------- We always recommend using the latest API version whenever possible. Previous versions are considered deprecated and may be unavailable for new users. * `2023-06-01` * New format for [streaming](https://platform.claude.com/docs/en/build-with-claude/streaming) server-sent events (SSE): * Completions are incremental. For example, `" Hello"`, `" my"`, `" name"`, `" is"`, `" Claude."` instead of `" Hello"`, `" Hello my"`, `" Hello my name"`, `" Hello my name is"`, `" Hello my name is Claude."`. * All events are [named events](https://developer.mozilla.org/en-US/Web/API/Server-sent%5Fevents/Using%5Fserver-sent%5Fevents#named%5Fevents) , rather than [data-only events](https://developer.mozilla.org/en-US/Web/API/Server-sent%5Fevents/Using%5Fserver-sent%5Fevents#data-only%5Fmessages) . * Removed unnecessary `data: [DONE]` event. * Removed legacy `exception` and `truncated` values in responses. * `2023-01-01`: Initial release. --- # Fine-grained tool streaming - Claude API Docs Loading... Tool infrastructure Fine-grained tool streaming Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Was this page helpful? This feature is eligible for [Zero Data Retention (ZDR)](https://platform.claude.com/docs/en/build-with-claude/api-and-data-retention) . When your organization has a ZDR arrangement, data sent through this feature is not stored after the API response is returned. Fine-grained tool streaming is generally available on all models and all platforms. It enables [streaming](https://platform.claude.com/docs/en/build-with-claude/streaming) of tool use parameter values without buffering or JSON validation, reducing the latency to begin receiving large parameters. When using fine-grained tool streaming, you may potentially receive invalid or partial JSON inputs. Make sure to account for these edge cases in your code. How to use fine-grained tool streaming -------------------------------------------- Fine-grained tool streaming is available on all models and all platforms (Claude API, Amazon Bedrock, Google Vertex AI, and Microsoft Foundry). To use it, set `eager_input_streaming` to `true` on any user-defined tool where you want fine-grained streaming enabled, and enable streaming on your request. Here's an example of how to use fine-grained tool streaming with the API: Shell 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-4-6", "max_tokens": 65536, "tools": [\ {\ "name": "make_file",\ "description": "Write text to a file",\ "eager_input_streaming": true,\ "input_schema": {\ "type": "object",\ "properties": {\ "filename": {\ "type": "string",\ "description": "The filename to write text to"\ },\ "lines_of_text": {\ "type": "array",\ "description": "An array of lines of text to write to the file"\ }\ },\ "required": ["filename", "lines_of_text"]\ }\ }\ ], "messages": [\ {\ "role": "user",\ "content": "Can you write a long poem and make a file called poem.txt?"\ }\ ], "stream": true }' In this example, fine-grained tool streaming enables Claude to stream the lines of a long poem into the tool call `make_file` without buffering to validate if the `lines_of_text` parameter is valid JSON. This means you can see the parameter stream as it arrives, without having to wait for the entire parameter to buffer and validate. With fine-grained tool streaming, tool use chunks start streaming faster, and are often longer and contain fewer word breaks. This is due to differences in chunking behavior. Example: Without fine-grained streaming (15s delay): Chunk 1: '{"' Chunk 2: 'query": "Ty' Chunk 3: 'peScri' Chunk 4: 'pt 5.0 5.1 ' Chunk 5: '5.2 5' Chunk 6: '.3' Chunk 8: ' new f' Chunk 9: 'eatur' ... With fine-grained streaming (3s delay): Chunk 1: '{"query": "TypeScript 5.0 5.1 5.2 5.3' Chunk 2: ' new features comparison' Because fine-grained streaming sends parameters without buffering or JSON validation, there is no guarantee that the resulting stream will complete in a valid JSON string. Particularly, if the [stop reason](https://platform.claude.com/docs/en/build-with-claude/handling-stop-reasons) `max_tokens` is reached, the stream may end midway through a parameter and may be incomplete. You generally have to write specific support to handle when `max_tokens` is reached. Accumulating tool input deltas ------------------------------------ When a `tool_use` content block streams, the initial `content_block_start` event contains `input: {}` (an empty object). This is a placeholder. The actual input arrives as a series of `input_json_delta` events, each carrying a `partial_json` string fragment. Your code must concatenate these fragments and parse the result once the block closes. The accumulation contract: 1. On `content_block_start` with `type: "tool_use"`, initialize an empty string: `input_json = ""` 2. For each `content_block_delta` with `type: "input_json_delta"`, append: `input_json += event.delta.partial_json` 3. On `content_block_stop`, parse the accumulated string: `json.loads(input_json)` The type mismatch between the initial `input: {}` (object) and `partial_json` (string) is by design. The empty object marks the slot in the content array; the delta strings build the real value. The Python and TypeScript SDKs provide higher-level stream helpers (`stream.get_final_message()`, `stream.finalMessage()`) that perform this accumulation for you. Use the manual pattern above only when you need to react to partial input before the block closes, such as rendering a progress indicator or starting a downstream request early. Handling invalid JSON in tool responses --------------------------------------------- When using fine-grained tool streaming, you may receive invalid or incomplete JSON from the model. If you need to pass this invalid JSON back to the model in an error response block, you may wrap it in a JSON object to ensure proper handling (with a reasonable key). For example: { "INVALID_JSON": "" } This approach helps the model understand that the content is invalid JSON while preserving the original malformed data for debugging purposes. When wrapping invalid JSON, make sure to properly escape any quotes or special characters in the invalid JSON string to maintain valid JSON structure in the wrapper object. Next steps ---------------- [Streaming messages\ \ Full reference for server-sent events and stream event types.](https://platform.claude.com/docs/en/build-with-claude/streaming) [Handle tool calls\ \ Execute tools and return results in the required message format.](https://platform.claude.com/docs/en/agents-and-tools/tool-use/handle-tool-calls) [Tool reference\ \ Full directory of Anthropic-schema tools and their version strings.](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-reference) Python import json import anthropic client = anthropic.Anthropic() tool_inputs = {} # index -> accumulated JSON string with client.messages.stream( model="claude-opus-4-6", max_tokens=1024, tools=[\ {\ "name": "get_weather",\ "description": "Get current weather for a city",\ "eager_input_streaming": True,\ "input_schema": {\ "type": "object",\ "properties": {"city": {"type": "string"}},\ "required": ["city"],\ },\ }\ ], messages=[{"role": "user", "content": "Weather in Paris?"}], ) as stream: for event in stream: if ( event.type == "content_block_start" and event.content_block.type == "tool_use" ): tool_inputs[event.index] = "" elif ( event.type == "content_block_delta" and event.delta.type == "input_json_delta" ): tool_inputs[event.index] += event.delta.partial_json elif event.type == "content_block_stop" and event.index in tool_inputs: parsed = json.loads(tool_inputs[event.index]) print(f"Tool input: {parsed}") --- # Reduce prompt leak - Claude API Docs Loading... Strengthen guardrails Reduce prompt leak Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Prompt leaks can expose sensitive information that you expect to be "hidden" in your prompt. While no method is foolproof, the strategies below can significantly reduce the risk. Before you try to reduce prompt leak ------------------------------------------ Consider using leak-resistant prompt engineering strategies only when **absolutely necessary**. Attempts to leak-proof your prompt can add complexity that may degrade performance in other parts of the task due to increasing the complexity of the LLM’s overall task. If you decide to implement leak-resistant techniques, be sure to test your prompts thoroughly to ensure that the added complexity does not negatively impact the model’s performance or the quality of its outputs. Try monitoring techniques first, like output screening and post-processing, to try to catch instances of prompt leak. * * * Strategies to reduce prompt leak -------------------------------------- * **Separate context from queries:** You can try using system prompts to isolate key information and context from user queries. You can emphasize key instructions in the `User` turn, then reemphasize those instructions by prefilling the `Assistant` turn. (Note: prefilling is not supported on [Claude Mythos Preview](https://anthropic.com/glasswing) , Claude Opus 4.6, and Sonnet 4.6.) ### Example: Safeguarding proprietary analytics * **Use post-processing**: Filter Claude's outputs for keywords that might indicate a leak. Techniques include using regular expressions, keyword filtering, or other text processing methods. You can also use a prompted LLM to filter outputs for more nuanced leaks. * **Avoid unnecessary proprietary details**: If Claude doesn't need it to perform the task, don't include it. Extra content distracts Claude from focusing on "no leak" instructions. * **Regular audits**: Periodically review your prompts and Claude's outputs for potential leaks. Remember, the goal is not just to prevent leaks but to maintain Claude's performance. Overly complex leak-prevention can degrade results. Balance is key. Was this page helpful? --- # Reduce hallucinations - Claude API Docs Loading... Strengthen guardrails Reduce hallucinations Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Even the most advanced language models, like Claude, can sometimes generate text that is factually incorrect or inconsistent with the given context. This phenomenon, known as "hallucination," can undermine the reliability of your AI-driven solutions. This guide will explore techniques to minimize hallucinations and ensure Claude's outputs are accurate and trustworthy. Basic hallucination minimization strategies ------------------------------------------------- * **Allow Claude to say "I don't know":** Explicitly give Claude permission to admit uncertainty. This simple technique can drastically reduce false information. ### Example: Analyzing a merger & acquisition report * **Use direct quotes for factual grounding:** For tasks involving long documents (>20k tokens), ask Claude to extract word-for-word quotes first before performing its task. This grounds its responses in the actual text, reducing hallucinations. ### Example: Auditing a data privacy policy * **Verify with citations**: Make Claude's response auditable by having it cite quotes and sources for each of its claims. You can also have Claude verify each claim by finding a supporting quote after it generates a response. If it can't find a quote, it must retract the claim. ### Example: Drafting a press release on a product launch * * * Advanced techniques ------------------------- * **Chain-of-thought verification**: Ask Claude to explain its reasoning step-by-step before giving a final answer. This can reveal faulty logic or assumptions. * **Best-of-N verficiation**: Run Claude through the same prompt multiple times and compare the outputs. Inconsistencies across outputs could indicate hallucinations. * **Iterative refinement**: Use Claude's outputs as inputs for follow-up prompts, asking it to verify or expand on previous statements. This can catch and correct inconsistencies. * **External knowledge restriction**: Explicitly instruct Claude to only use information from provided documents and not its general knowledge. Remember, while these techniques significantly reduce hallucinations, they don't eliminate them entirely. Always validate critical information, especially for high-stakes decisions. Was this page helpful? --- # Mitigate jailbreaks and prompt injections - Claude API Docs Loading... Strengthen guardrails Mitigate jailbreaks Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Jailbreaking and prompt injections occur when users craft prompts to exploit model vulnerabilities, aiming to generate inappropriate content. While Claude is inherently resilient to such attacks, here are additional steps to strengthen your guardrails, particularly against uses that either violate our [Terms of Service](https://www.anthropic.com/legal/commercial-terms) or [Usage Policy](https://www.anthropic.com/legal/aup) . * **Harmlessness screens**: Use a lightweight model like Claude Haiku 4.5 to pre-screen user inputs. Use [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs) to constrain the response to a simple classification. ### Example: Harmlessness screen for content moderation * **Input validation**: Filter prompts for jailbreaking patterns. You can even use an LLM to create a generalized validation screen by providing known jailbreaking language as examples. * **Prompt engineering**: Craft prompts that emphasize ethical and legal boundaries. ### Example: Ethical system prompt for an enterprise chatbot Adjust responses and consider throttling or banning users who repeatedly engage in abusive behavior attempting to circumvent Claude’s guardrails. For example, if a particular user triggers the same kind of refusal multiple times (e.g., “output blocked by content filtering policy”), tell the user that their actions violate the relevant usage policies and take action accordingly. * **Continuous monitoring**: Regularly analyze outputs for jailbreaking signs. Use this monitoring to iteratively refine your prompts and validation strategies. Advanced: Chain safeguards -------------------------------- Combine strategies for robust protection. Here's an enterprise-grade example with tool use: ### Example: Multi-layered protection for a financial advisor chatbot By layering these strategies, you create a robust defense against jailbreaking and prompt injections, ensuring your Claude-powered applications maintain the highest standards of safety and compliance. Was this page helpful? --- # Using the Evaluation Tool - Claude API Docs Loading... Test and evaluate Using the Evaluation Tool in Console Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Was this page helpful? Accessing the Evaluate Feature ------------------------------------ To get started with the Evaluation tool: 1. Open the Claude Console and navigate to the prompt editor. 2. After composing your prompt, look for the 'Evaluate' tab at the top of the screen. ![Accessing Evaluate Feature](https://platform.claude.com/docs/images/access_evaluate.png) Ensure your prompt includes at least 1-2 dynamic variables using the double brace syntax: {{variable}}. This is required for creating eval test sets. Generating Prompts ------------------------ The Console offers a built-in [prompt generator](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/prompting-tools) powered by Claude Opus 4.1: 1. 1 Click 'Generate Prompt' Clicking the 'Generate Prompt' helper tool will open a modal that allows you to enter your task information. 2. 2 Describe your task Describe your desired task (e.g., "Triage inbound customer support requests") with as much or as little detail as you desire. The more context you include, the more Claude can tailor its generated prompt to your specific needs. 3. 3 Generate your prompt Clicking the orange 'Generate Prompt' button at the bottom will have Claude generate a high quality prompt for you. You can then further improve those prompts using the Evaluation screen in the Console. This feature makes it easier to create prompts with the appropriate variable syntax for evaluation. ![Prompt Generator](https://platform.claude.com/docs/images/promptgenerator.png) Creating Test Cases ------------------------- When you access the Evaluation screen, you have several options to create test cases: 1. Click the '+ Add Row' button at the bottom left to manually add a case. 2. Use the 'Generate Test Case' feature to have Claude automatically generate test cases for you. 3. Import test cases from a CSV file. To use the 'Generate Test Case' feature: 1. 1 Click on 'Generate Test Case' Claude will generate test cases for you, one row at a time for each time you click the button. 2. 2 Edit generation logic (optional) You can also edit the test case generation logic by clicking on the arrow dropdown to the right of the 'Generate Test Case' button, then on 'Show generation logic' at the top of the Variables window that pops up. You may have to click \`Generate' on the top right of this window to populate initial generation logic. Editing this allows you to customize and fine tune the test cases that Claude generates to greater precision and specificity. Here's an example of a populated Evaluation screen with several test cases: ![Populated Evaluation Screen](https://platform.claude.com/docs/images/eval_populated.png) If you update your original prompt text, you can re-run the entire eval suite against the new prompt to see how changes affect performance across all test cases. Tips for Effective Evaluation ----------------------------------- ### Prompt Structure for Evaluation Use the 'Generate a prompt' helper tool in the Console to quickly create prompts with the appropriate variable syntax for evaluation. Understanding and comparing results ----------------------------------------- The Evaluation tool offers several features to help you refine your prompts: 1. **Side-by-side comparison**: Compare the outputs of two or more prompts to quickly see the impact of your changes. 2. **Quality grading**: Grade response quality on a 5-point scale to track improvements in response quality per prompt. 3. **Prompt versioning**: Create new versions of your prompt and re-run the test suite to quickly iterate and improve results. By reviewing results across test cases and comparing different prompt versions, you can spot patterns and make informed adjustments to your prompt more efficiently. Start evaluating your prompts today to build more robust AI applications with Claude! --- # Handling stop reasons - Claude API Docs Loading... Building with Claude Handling stop reasons Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page When you make a request to the Messages API, Claude's response includes a `stop_reason` field that indicates why the model stopped generating its response. Understanding these values is crucial for building robust applications that handle different response types appropriately. For details about `stop_reason` in the API response, see the [Messages API reference](https://platform.claude.com/docs/en/api/messages/create) . The stop\_reason field ---------------------------- The `stop_reason` field is part of every successful Messages API response. Unlike errors, which indicate failures in processing your request, `stop_reason` tells you why Claude successfully completed its response generation. Example response { "id": "msg_01234", "type": "message", "role": "assistant", "content": [\ {\ "type": "text",\ "text": "Here's the answer to your question..."\ }\ ], "stop_reason": "end_turn", "stop_sequence": null, "usage": { "input_tokens": 100, "output_tokens": 50 } } Stop reason values ------------------------ ### end\_turn The most common stop reason. Indicates Claude finished its response naturally. Python from anthropic import Anthropic client = Anthropic() response = client.messages.create( model="claude-sonnet-4-20250514", max_tokens=1024, messages=[{"role": "user", "content": "Hello!"}], ) if response.stop_reason == "end_turn": # Process the complete response print(response.content[0].text) #### Empty responses with end\_turn Sometimes Claude returns an empty response (exactly 2-3 tokens with no content) with `stop_reason: "end_turn"`. This typically happens when Claude interprets that the assistant turn is complete, particularly after tool results. **Common causes:** * Adding text blocks immediately after tool results (Claude learns to expect the user to always insert text after tool results, so it ends its turn to follow the pattern) * Sending Claude's completed response back without adding anything (Claude already decided it's done, so it will remain done) **How to prevent empty responses:** # INCORRECT: Adding text immediately after tool_result messages = [\ {"role": "user", "content": "Calculate the sum of 1234 and 5678"},\ {\ "role": "assistant",\ "content": [\ {\ "type": "tool_use",\ "id": "toolu_123",\ "name": "calculator",\ "input": {"operation": "add", "a": 1234, "b": 5678},\ }\ ],\ },\ {\ "role": "user",\ "content": [\ {"type": "tool_result", "tool_use_id": "toolu_123", "content": "6912"},\ {\ "type": "text",\ "text": "Here's the result", # Don't add text after tool_result\ },\ ],\ },\ ] # CORRECT: Send tool results directly without additional text messages = [\ {"role": "user", "content": "Calculate the sum of 1234 and 5678"},\ {\ "role": "assistant",\ "content": [\ {\ "type": "tool_use",\ "id": "toolu_123",\ "name": "calculator",\ "input": {"operation": "add", "a": 1234, "b": 5678},\ }\ ],\ },\ {\ "role": "user",\ "content": [\ {"type": "tool_result", "tool_use_id": "toolu_123", "content": "6912"}\ ],\ }, # Just the tool_result, no additional text\ ] # If you still get empty responses after fixing the above: def handle_empty_response(client, messages): response = client.messages.create( model="claude-opus-4-6", max_tokens=1024, messages=messages ) # Check if response is empty if response.stop_reason == "end_turn" and not response.content: # INCORRECT: Don't just retry with the empty response # This won't work because Claude already decided it's done # CORRECT: Add a continuation prompt in a NEW user message messages.append({"role": "user", "content": "Please continue"}) response = client.messages.create( model="claude-opus-4-6", max_tokens=1024, messages=messages ) return response **Best practices:** 1. **Never add text blocks immediately after tool results** - This teaches Claude to expect user input after every tool use 2. **Don't retry empty responses without modification** - Simply sending the empty response back won't help 3. **Use continuation prompts as a last resort** - Only if the above fixes don't resolve the issue ### max\_tokens Claude stopped because it reached the `max_tokens` limit specified in your request. Python # Request with limited tokens response = client.messages.create( model="claude-opus-4-6", max_tokens=10, messages=[{"role": "user", "content": "Explain quantum physics"}], ) if response.stop_reason == "max_tokens": # Response was truncated print("Response was cut off at token limit") # Consider making another request to continue #### Incomplete tool use blocks If Claude's response is cut off due to hitting the `max_tokens` limit, and the truncated response contains an incomplete tool use block, you'll need to retry the request with a higher `max_tokens` value to get the full tool use. CLI RESPONSE=$(ant messages create --max-tokens 1024 \ --format jsonl < request.yaml) # Check if the response was truncated mid tool use STOP_REASON=$(jq -r '.stop_reason' <<<"$RESPONSE") LAST_TYPE=$(jq -r '.content[-1].type' <<<"$RESPONSE") if [ "$STOP_REASON" = "max_tokens" ] && [ "$LAST_TYPE" = "tool_use" ]; then # Retry with a higher max_tokens ant messages create --max-tokens 4096 < request.yaml fi ### stop\_sequence Claude encountered one of your custom stop sequences. Python response = client.messages.create( model="claude-opus-4-6", max_tokens=1024, stop_sequences=["END", "STOP"], messages=[{"role": "user", "content": "Generate text until you say END"}], ) if response.stop_reason == "stop_sequence": print(f"Stopped at sequence: {response.stop_sequence}") ### tool\_use Claude is calling a tool and expects you to execute it. For most tool use implementations, we recommend using the [tool runner](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-runner) which automatically handles tool execution, result formatting, and conversation management. Python from anthropic import Anthropic client = Anthropic() weather_tool = { "name": "get_weather", "description": "Get the current weather in a given location", "input_schema": { "type": "object", "properties": { "location": {"type": "string", "description": "City and state"}, }, "required": ["location"], }, } def execute_tool(name, tool_input): """Execute a tool and return the result.""" return f"Weather in {tool_input.get('location', 'unknown')}: 72°F" response = client.messages.create( model="claude-sonnet-4-20250514", max_tokens=1024, tools=[weather_tool], messages=[{"role": "user", "content": "What's the weather?"}], ) if response.stop_reason == "tool_use": # Extract and execute the tool for content in response.content: if content.type == "tool_use": result = execute_tool(content.name, content.input) # Return result to Claude for final response ### pause\_turn Returned when the server-side sampling loop reaches its iteration limit while executing [server tools](https://platform.claude.com/docs/en/agents-and-tools/tool-use/server-tools) like web search or web fetch. The default limit is 10 iterations per request. When this happens, the response may contain a `server_tool_use` block without a corresponding `server_tool_result`. To let Claude finish processing, continue the conversation by sending the response back as-is. Python response = client.messages.create( model="claude-opus-4-6", max_tokens=1024, tools=[{"type": "web_search_20250305", "name": "web_search"}], messages=[{"role": "user", "content": "Search for latest AI news"}], ) if response.stop_reason == "pause_turn": # Continue the conversation by sending the response back messages = [\ {"role": "user", "content": original_query},\ {"role": "assistant", "content": response.content},\ ] continuation = client.messages.create( model="claude-opus-4-6", messages=messages, tools=[{"type": "web_search_20250305", "name": "web_search"}], ) Your application should handle `pause_turn` in any agent loop that uses server tools. Simply add the assistant's response to your messages array and make another API request to let Claude continue. ### refusal Claude refused to generate a response due to safety concerns. Python response = client.messages.create( model="claude-opus-4-6", max_tokens=1024, messages=[{"role": "user", "content": "[Unsafe request]"}], ) if response.stop_reason == "refusal": # Claude declined to respond print("Claude was unable to process this request") # Consider rephrasing or modifying the request If you encounter `refusal` stop reasons frequently while using Claude Sonnet 4.5 or Opus 4.1, you can try updating your API calls to use Sonnet 4 (`claude-sonnet-4-20250514`), which has different usage restrictions. Learn more about [understanding Sonnet 4.5's API safety filters](https://support.claude.com/en/articles/12449294-understanding-sonnet-4-5-s-api-safety-filters) . To learn more about refusals triggered by API safety filters for Claude Sonnet 4.5, see [Understanding Sonnet 4.5's API Safety Filters](https://support.claude.com/en/articles/12449294-understanding-sonnet-4-5-s-api-safety-filters) . ### model\_context\_window\_exceeded Claude stopped because it reached the model's context window limit. This allows you to request the maximum possible tokens without knowing the exact input size. Python # Request with maximum tokens to get as much as possible response = client.messages.create( model="claude-opus-4-6", max_tokens=64000, # Practical non-streaming ceiling (Opus 4.6 supports 128K with streaming) messages=[\ {"role": "user", "content": "Large input that uses most of context window..."}\ ], ) if response.stop_reason == "model_context_window_exceeded": # Response hit context window limit before max_tokens print("Response reached model's context window limit") # The response is still valid but was limited by context window This stop reason is available by default in Sonnet 4.5 and newer models. For earlier models, use the beta header `model-context-window-exceeded-2025-08-26` to enable this behavior. Best practices for handling stop reasons ---------------------------------------------- ### 1\. Always check stop\_reason Make it a habit to check the `stop_reason` in your response handling logic: def handle_response(response): if response.stop_reason == "tool_use": return handle_tool_use(response) elif response.stop_reason == "max_tokens": return handle_truncation(response) elif response.stop_reason == "model_context_window_exceeded": return handle_context_limit(response) elif response.stop_reason == "pause_turn": return handle_pause(response) elif response.stop_reason == "refusal": return handle_refusal(response) else: # Handle end_turn and other cases return response.content[0].text ### 2\. Handle truncated responses gracefully When a response is truncated due to token limits or context window: def handle_truncated_response(response): if response.stop_reason in ["max_tokens", "model_context_window_exceeded"]: # Option 1: Warn the user about the specific limit if response.stop_reason == "max_tokens": message = "[Response truncated due to max_tokens limit]" else: message = "[Response truncated due to context window limit]" return f"{response.content[0].text}\n\n{message}" # Option 2: Continue generation messages = [\ {"role": "user", "content": original_prompt},\ {"role": "assistant", "content": response.content[0].text},\ ] continuation = client.messages.create( model="claude-opus-4-6", max_tokens=1024, messages=messages + [{"role": "user", "content": "Please continue"}], ) return response.content[0].text + continuation.content[0].text ### 3\. Implement retry logic for pause\_turn When using [server tools](https://platform.claude.com/docs/en/agents-and-tools/tool-use/server-tools) , the API may return `pause_turn` if the server-side sampling loop reaches its iteration limit (default 10). Handle this by continuing the conversation: def handle_server_tool_conversation(client, user_query, tools, max_continuations=5): """ Handle server tool conversations that may require multiple continuations. The server runs a sampling loop when executing server tools. If the loop reaches its iteration limit, the API returns pause_turn. Continue the conversation by sending the response back to let Claude finish. """ messages = [{"role": "user", "content": user_query}] for _ in range(max_continuations): response = client.messages.create( model="claude-opus-4-6", messages=messages, tools=tools ) if response.stop_reason != "pause_turn": # Claude finished processing - return the final response return response # pause_turn: replace the full message list to maintain alternating roles messages = [\ {"role": "user", "content": user_query},\ {"role": "assistant", "content": response.content},\ ] # Reached max continuations - return the last response return response Stop reasons vs. errors ----------------------------- It's important to distinguish between `stop_reason` values and actual errors: ### Stop reasons (successful responses) * Part of the response body * Indicate why generation stopped normally * Response contains valid content ### Errors (failed requests) * HTTP status codes 4xx or 5xx * Indicate request processing failures * Response contains error details Python import anthropic from anthropic import Anthropic client = Anthropic() try: response = client.messages.create( model="claude-sonnet-4-20250514", max_tokens=1024, messages=[{"role": "user", "content": "Hello!"}], ) # Handle successful response with stop_reason if response.stop_reason == "max_tokens": print("Response was truncated") except anthropic.APIError as e: # Handle actual errors if e.status_code == 429: print("Rate limit exceeded") elif e.status_code == 500: print("Server error") Streaming considerations ------------------------------ When using streaming, `stop_reason` is: * `null` in the initial `message_start` event * Provided in the `message_delta` event * Not provided in any other events Python from anthropic import Anthropic client = Anthropic() with client.messages.stream( model="claude-sonnet-4-20250514", max_tokens=1024, messages=[{"role": "user", "content": "Hello!"}], ) as stream: for event in stream: if event.type == "message_delta": stop_reason = event.delta.stop_reason if stop_reason: print(f"Stream ended with: {stop_reason}") Common patterns --------------------- ### Handling tool use workflows **Simpler with tool runner**: The example below shows manual tool handling. For most use cases, the [tool runner](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-runner) automatically handles tool execution with much less code. def complete_tool_workflow(client, user_query, tools): messages = [{"role": "user", "content": user_query}] while True: response = client.messages.create( model="claude-opus-4-6", messages=messages, tools=tools ) if response.stop_reason == "tool_use": # Execute tools and continue tool_results = execute_tools(response.content) messages.append({"role": "assistant", "content": response.content}) messages.append({"role": "user", "content": tool_results}) else: # Final response return response ### Ensuring complete responses def get_complete_response(client, prompt, max_attempts=3): messages = [{"role": "user", "content": prompt}] full_response = "" for _ in range(max_attempts): response = client.messages.create( model="claude-opus-4-6", messages=messages, max_tokens=4096 ) full_response += response.content[0].text if response.stop_reason != "max_tokens": break # Continue from where it left off messages = [\ {"role": "user", "content": prompt},\ {"role": "assistant", "content": full_response},\ {"role": "user", "content": "Please continue from where you left off."},\ ] return full_response ### Getting maximum tokens without knowing input size With the `model_context_window_exceeded` stop reason, you can request the maximum possible tokens without calculating input size: def get_max_possible_tokens(client, prompt): """ Get as many tokens as possible within the model's context window without needing to calculate input token count """ response = client.messages.create( model="claude-opus-4-6", messages=[{"role": "user", "content": prompt}], max_tokens=64000, # Practical non-streaming ceiling (Opus 4.6 supports 128K with streaming) ) if response.stop_reason == "model_context_window_exceeded": # Got the maximum possible tokens given input size print( f"Generated {response.usage.output_tokens} tokens (context limit reached)" ) elif response.stop_reason == "max_tokens": # Got exactly the requested tokens print(f"Generated {response.usage.output_tokens} tokens (max_tokens reached)") else: # Natural completion print(f"Generated {response.usage.output_tokens} tokens (natural completion)") return response.content[0].text By properly handling `stop_reason` values, you can build more robust applications that gracefully handle different response scenarios and provide better user experiences. Was this page helpful? --- # Service tiers - Claude API Docs Loading... Support & configuration Service tiers Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Anthropic offers three service tiers: * **Priority Tier:** Best for workflows deployed in production where time, availability, and predictable pricing are important * **Standard:** Default tier for both piloting and scaling everyday use cases * **Batch:** Best for asynchronous workflows which can wait or benefit from being outside your normal capacity Standard Tier ------------------- The standard tier is the default service tier for all API requests. The API prioritizes these requests alongside all other requests with best-effort availability. Priority Tier ------------------- The API prioritizes requests in this tier over all other requests. This prioritization helps minimize ["server overloaded" errors](https://platform.claude.com/docs/en/api/errors#http-errors) , even during peak times. For more information, see [Get started with Priority Tier](https://platform.claude.com/docs/en/api/service-tiers#get-started-with-priority-tier) How requests get assigned tiers ------------------------------------- When handling a request, Anthropic decides to assign a request to Priority Tier in the following scenarios: * Your organization has sufficient priority tier capacity **input** tokens per minute * Your organization has sufficient priority tier capacity **output** tokens per minute Anthropic counts usage against Priority Tier capacity as follows: **Input Tokens** * Cache reads as 0.1 tokens per token read from the cache * Cache writes as 1.25 tokens per token written to the cache with a 5 minute TTL * Cache writes as 2.00 tokens per token written to the cache with a 1 hour TTL * For [US-only inference](https://platform.claude.com/docs/en/build-with-claude/data-residency) (`inference_geo: "us"`) requests on Claude Opus 4.6 and newer models, input tokens are 1.1 tokens per token * All other input tokens are 1 token per token **Output Tokens** * For [US-only inference](https://platform.claude.com/docs/en/build-with-claude/data-residency) (`inference_geo: "us"`) requests on Claude Opus 4.6 and newer models, output tokens are 1.1 tokens per token * All other output tokens are 1 token per token Otherwise, requests proceed at standard tier. These burndown rates reflect the relative pricing of each token type. For example, US-only inference is priced at 1.1x on Opus 4.6 and newer models, so each token consumed with `inference_geo: "us"` draws down 1.1 tokens from your Priority Tier capacity. Requests assigned Priority Tier pull from both the Priority Tier capacity and the regular rate limits. If servicing the request would exceed the rate limits, the request is declined. Using service tiers ------------------------- You can control which service tiers can be used for a request by setting the `service_tier` parameter: Python message = client.messages.create( model="claude-opus-4-6", max_tokens=1024, messages=[{"role": "user", "content": "Hello, Claude!"}], service_tier="auto", # Automatically use Priority Tier when available, fallback to standard ) The `service_tier` parameter accepts the following values: * `"auto"` (default) - Uses the Priority Tier capacity if available, falling back to your other capacity if not * `"standard_only"` - Only use standard tier capacity, useful if you don't want to use your Priority Tier capacity The response `usage` object also includes the service tier assigned to the request: { "usage": { "input_tokens": 410, "cache_creation_input_tokens": 0, "cache_read_input_tokens": 0, "output_tokens": 585, "service_tier": "priority" } } This allows you to determine which service tier was assigned to the request. When requesting `service_tier="auto"` with a model with a Priority Tier commitment, these response headers provide insights: anthropic-priority-input-tokens-limit: 10000 anthropic-priority-input-tokens-remaining: 9618 anthropic-priority-input-tokens-reset: 2025-01-12T23:11:59Z anthropic-priority-output-tokens-limit: 10000 anthropic-priority-output-tokens-remaining: 6000 anthropic-priority-output-tokens-reset: 2025-01-12T23:12:21Z You can use the presence of these headers to detect if your request was eligible for Priority Tier, even if it was over the limit. Get started with Priority Tier ------------------------------------ You may want to commit to Priority Tier capacity if you are interested in: * **Higher availability**: Target 99.5% uptime with prioritized computational resources * **Cost Control**: Predictable spend and discounts for longer commitments * **Flexible overflow**: Automatically falls back to standard tier when you exceed your committed capacity Committing to Priority Tier will involve deciding: * A number of input tokens per minute * A number of output tokens per minute * A commitment duration (1, 3, 6, or 12 months) * A specific model version The ratio of input to output tokens you purchase matters. Sizing your Priority Tier capacity to align with your actual traffic patterns helps you maximize utilization of your purchased tokens. ### Supported models Priority Tier is supported on all available Claude models except [Claude Mythos Preview](https://anthropic.com/glasswing) . Check the [model overview page](https://platform.claude.com/docs/en/about-claude/models/overview) for more details on available models. ### How to access Priority Tier To begin using Priority Tier: 1. [Contact sales](https://claude.com/contact-sales/priority-tier) to complete provisioning 2. (Optional) Update your API requests to optionally set the `service_tier` parameter to `auto` 3. Monitor your usage through response headers and the Claude Console Was this page helpful? --- # Beta headers - Claude API Docs Loading... Using the API Beta headers Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Was this page helpful? Beta headers allow you to access experimental features and new model capabilities before they become part of the standard API. These features are subject to change and may be modified or removed in future releases. Beta headers are often used in conjunction with the [beta namespace in the client SDKs](https://platform.claude.com/docs/en/api/client-sdks#beta-namespace-in-client-sdks) How to use beta headers ----------------------------- To access beta features, include the `anthropic-beta` header in your API requests: POST /v1/messages Content-Type: application/json X-API-Key: YOUR_API_KEY anthropic-beta: BETA_FEATURE_NAME When using the SDK, you can specify beta headers in the request options: Shell curl https://api.anthropic.com/v1/messages \ -H "x-api-key: $ANTHROPIC_API_KEY" \ -H "anthropic-version: 2023-06-01" \ -H "anthropic-beta: files-api-2025-04-14" \ -H "content-type: application/json" \ -d '{ "model": "claude-opus-4-6", "max_tokens": 1024, "messages": [\ {"role": "user", "content": "Hello, Claude"}\ ] }' Beta features are experimental and may: * Have breaking changes with notice * Be deprecated or removed * Have different rate limits or pricing * Not be available in all regions ### Multiple beta features To use multiple beta features in a single request, include all feature names in the header separated by commas: anthropic-beta: feature1,feature2,feature3 ### Endpoint-specific headers Some beta features are scoped to specific endpoints rather than individual request parameters. [Claude Managed Agents](https://platform.claude.com/docs/en/managed-agents/overview) uses a single beta header for all endpoints: | Endpoints | Beta header | | --- | --- | | `/v1/agents`, `/v1/sessions`, `/v1/environments` | `managed-agents-2026-04-01` | See the [Managed Agents overview](https://platform.claude.com/docs/en/managed-agents/overview) for details. ### Version naming conventions Beta feature names typically follow the pattern: `feature-name-YYYY-MM-DD`, where the date indicates when the beta version was released. Always use the exact beta feature name as documented. Error handling -------------------- If you use an invalid or unavailable beta header, you'll receive an error response: Output { "type": "error", "error": { "type": "invalid_request_error", "message": "Unsupported beta header: invalid-beta-name" } } Getting help ------------------ For questions about beta features: 1. Check the documentation for the specific feature 2. Review the [API changelog](https://platform.claude.com/docs/en/api/versioning) for updates 3. Contact support for assistance with production usage Remember that beta features are provided "as-is" and may not have the same SLA guarantees as stable API features. --- # Increase output consistency - Claude API Docs Loading... Strengthen guardrails Increase output consistency Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Was this page helpful? **For guaranteed JSON schema conformance** If you need Claude to always output valid JSON that conforms to a specific schema, use [Structured Outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs) instead of the prompt engineering techniques below. Structured outputs provide guaranteed schema compliance and are specifically designed for this use case. The techniques below are useful for general output consistency or when you need flexibility beyond strict JSON schemas. Here's how to make Claude's responses more consistent: Specify the desired output format --------------------------------------- Precisely define your desired output format using JSON, XML, or custom templates so that Claude understands every output formatting element you require. ### Example: Standardizing customer feedback Prefill Claude's response ------------------------------- Prefilling is not supported on [Claude Mythos Preview](https://anthropic.com/glasswing) , Claude Opus 4.6, and Claude Sonnet 4.6. Use [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs) or system prompt instructions instead. Prefill the `Assistant` turn with your desired format. This trick bypasses Claude's friendly preamble and enforces your structure. ### Example: Daily sales report Constrain with examples ----------------------------- Provide examples of your desired output. This trains Claude's understanding better than abstract instructions. ### Example: Generating consistent market intelligence Use retrieval for contextual consistency ---------------------------------------------- For tasks requiring consistent context (e.g., chatbots, knowledge bases), use retrieval to ground Claude's responses in a fixed information set. ### Example: Enhancing IT support consistency Chain prompts for complex tasks ------------------------------------- Break down complex tasks into smaller, consistent subtasks. Each subtask gets Claude's full attention, reducing inconsistency errors across scaled workflows. Keep Claude in character ------------------------------ For role-based applications, maintaining consistent character requires deliberate prompting. * **Use system prompts to set the role:** Use [system prompts](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices#give-claude-a-role) to define Claude's role and personality. This sets a strong foundation for consistent responses. When setting up the character, provide detailed information about the personality, background, and any specific traits or quirks. This will help the model better emulate and generalize the character's traits. * **Prepare Claude for possible scenarios:** Provide a list of common scenarios and expected responses in your prompts. This "trains" Claude to handle diverse situations without breaking character. ### Example: Enterprise chatbot for role prompting --- # Web fetch tool - Claude API Docs Loading... Tools Web fetch tool Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Was this page helpful? The web fetch tool allows Claude to retrieve full content from specified web pages and PDF documents. The latest web fetch tool version (`web_fetch_20260209`) supports **dynamic filtering** with [Claude Mythos Preview](https://anthropic.com/glasswing) , Claude Opus 4.6, and Claude Sonnet 4.6. Claude can write and execute code to filter fetched content before it reaches the context window, keeping only relevant information and discarding the rest. This reduces token consumption while maintaining response quality. The previous tool version (`web_fetch_20250910`) remains available without dynamic filtering. For [Claude Mythos Preview](https://anthropic.com/glasswing) , web fetch is supported on the Claude API and Microsoft Foundry only. It is not available for Mythos Preview on Amazon Bedrock or Google Vertex AI. Use the [feedback form](https://forms.gle/NhWcgmkcvPCMmPE86) to provide feedback on the quality of the model responses, the API itself, or the quality of the documentation. For Zero Data Retention eligibility and the `allowed_callers` workaround, see [Server tools](https://platform.claude.com/docs/en/agents-and-tools/tool-use/server-tools#zdr-and-allowed-callers) . Enabling the web fetch tool in environments where Claude processes untrusted input alongside sensitive data poses data exfiltration risks. Only use this tool in trusted environments or when handling non-sensitive data. To minimize exfiltration risks, Claude is not allowed to dynamically construct URLs. Claude can only fetch URLs that have been explicitly provided by the user or that come from previous web search or web fetch results. However, there is still residual risk that should be carefully considered when using this tool. If data exfiltration is a concern, consider: * Disabling the web fetch tool entirely * Using the `max_uses` parameter to limit the number of requests * Using the `allowed_domains` parameter to restrict to known safe domains For model support, see the [Tool reference](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-reference) . How web fetch works ------------------------- When you add the web fetch tool to your API request: 1. Claude decides when to fetch content based on the prompt and available URLs. 2. The API retrieves the full text content from the specified URL. 3. For PDFs, automatic text extraction is performed. 4. Claude analyzes the fetched content and provides a response with optional citations. The web fetch tool currently does not support websites dynamically rendered via JavaScript. ### Dynamic filtering Fetching full web pages and PDFs can quickly consume tokens, especially when only specific information is needed from large documents. With the `web_fetch_20260209` tool version, Claude can write and execute code to filter the fetched content before loading it into context. This dynamic filtering is particularly useful for: * Extracting specific sections from long documents * Processing structured data from web pages * Filtering relevant information from PDFs * Reducing token costs when working with large documents Dynamic filtering requires the [code execution tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/code-execution-tool) to be enabled. The web fetch tool (with and without dynamic filtering) is available on the Claude API and Microsoft Azure. To enable dynamic filtering, use the `web_fetch_20260209` tool version: How to use web fetch -------------------------- Provide the web fetch tool in your API request: ### Tool definition The web fetch tool supports the following parameters: JSON { "type": "web_fetch_20250910", "name": "web_fetch", // Optional: Limit the number of fetches per request "max_uses": 10, // Optional: Only fetch from these domains "allowed_domains": ["example.com", "docs.example.com"], // Optional: Never fetch from these domains "blocked_domains": ["private.example.com"], // Optional: Enable citations for fetched content "citations": { "enabled": true }, // Optional: Maximum content length in tokens "max_content_tokens": 100000 } #### Max uses The `max_uses` parameter limits the number of web fetches performed. If Claude attempts more fetches than allowed, the `web_fetch_tool_result` is an error with the `max_uses_exceeded` error code. There is currently no default limit. #### Domain filtering For domain filtering with `allowed_domains` and `blocked_domains`, see [Server tools](https://platform.claude.com/docs/en/agents-and-tools/tool-use/server-tools#domain-filtering) . #### Content limits The `max_content_tokens` parameter limits the amount of content included in the context. If the fetched content exceeds this limit, the tool truncates it. This helps control token usage when fetching large documents. The `max_content_tokens` parameter limit is approximate. The actual number of input tokens used can vary by a small amount. #### Citations Unlike web search where citations are always enabled, citations are optional for web fetch. Set `"citations": {"enabled": true}` to enable Claude to cite specific passages from fetched documents. When displaying API outputs directly to end users, citations must be included to the original source. If you are making modifications to API outputs, including by reprocessing and/or combining them with your own material before displaying them to end users, display citations as appropriate based on consultation with your legal team. ### Response Here's an example response structure: Output { "role": "assistant", "content": [\ // 1. Claude's decision to fetch\ {\ "type": "text",\ "text": "I'll fetch the content from the article to analyze it."\ },\ // 2. The fetch request\ {\ "type": "server_tool_use",\ "id": "srvtoolu_01234567890abcdef",\ "name": "web_fetch",\ "input": {\ "url": "https://example.com/article"\ }\ },\ // 3. Fetch results\ {\ "type": "web_fetch_tool_result",\ "tool_use_id": "srvtoolu_01234567890abcdef",\ "content": {\ "type": "web_fetch_result",\ "url": "https://example.com/article",\ "content": {\ "type": "document",\ "source": {\ "type": "text",\ "media_type": "text/plain",\ "data": "Full text content of the article..."\ },\ "title": "Article Title",\ "citations": { "enabled": true }\ },\ "retrieved_at": "2025-08-25T10:30:00Z"\ }\ },\ // 4. Claude's analysis with citations (if enabled)\ {\ "text": "Based on the article, ",\ "type": "text"\ },\ {\ "text": "the main argument presented is that artificial intelligence will transform healthcare",\ "type": "text",\ "citations": [\ {\ "type": "char_location",\ "document_index": 0,\ "document_title": "Article Title",\ "start_char_index": 1234,\ "end_char_index": 1456,\ "cited_text": "Artificial intelligence is poised to revolutionize healthcare delivery..."\ }\ ]\ }\ ], "id": "msg_a930390d3a", "usage": { "input_tokens": 25039, "output_tokens": 931, "server_tool_use": { "web_fetch_requests": 1 } }, "stop_reason": "end_turn" } #### Fetch results Fetch results include: * `url`: The URL that was fetched * `content`: A document block containing the fetched content * `retrieved_at`: Timestamp when the content was retrieved The web fetch tool caches results to improve performance and reduce redundant requests. The content returned may not always reflect the latest version available at the URL. The cache behavior is managed automatically and may change over time to optimize for different content types and usage patterns. For PDF documents, content is returned as base64-encoded data: Output { "type": "web_fetch_tool_result", "tool_use_id": "srvtoolu_02", "content": { "type": "web_fetch_result", "url": "https://example.com/paper.pdf", "content": { "type": "document", "source": { "type": "base64", "media_type": "application/pdf", "data": "JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmo..." }, "citations": { "enabled": true } }, "retrieved_at": "2025-08-25T10:30:02Z" } } #### Errors When the web fetch tool encounters an error, the Claude API returns a 200 (success) response with the error represented in the response body: Output { "type": "web_fetch_tool_result", "tool_use_id": "srvtoolu_a93jad", "content": { "type": "web_fetch_tool_error", "error_code": "url_not_accessible" } } These are the possible error codes: * `invalid_input`: Invalid URL format * `url_too_long`: URL exceeds maximum length (250 characters) * `url_not_allowed`: URL blocked by domain filtering rules and model restrictions * `url_not_accessible`: Failed to fetch content (HTTP error) * `too_many_requests`: Rate limit exceeded * `unsupported_content_type`: Content type not supported (only text and PDF) * `max_uses_exceeded`: Maximum web fetch tool uses exceeded * `unavailable`: An internal error occurred URL validation -------------------- For security reasons, the web fetch tool can only fetch URLs that have previously appeared in the conversation context. This includes: * URLs in user messages * URLs in client-side tool results * URLs from previous web search or web fetch results The tool cannot fetch arbitrary URLs that Claude generates or URLs from container-based server tools (Code Execution, Bash, etc.). Combined search and fetch ------------------------------- Web fetch works seamlessly with web search for comprehensive information gathering: Python client = anthropic.Anthropic() response = client.messages.create( model="claude-opus-4-6", max_tokens=4096, messages=[\ {\ "role": "user",\ "content": "Find recent articles about quantum computing and analyze the most relevant one in detail",\ }\ ], tools=[\ {"type": "web_search_20250305", "name": "web_search", "max_uses": 3},\ {\ "type": "web_fetch_20250910",\ "name": "web_fetch",\ "max_uses": 5,\ "citations": {"enabled": True},\ },\ ], ) In this workflow, Claude will: 1. Use web search to find relevant articles 2. Select the most promising results 3. Use web fetch to retrieve full content 4. Provide detailed analysis with citations Prompt caching -------------------- For caching tool definitions across turns, see [Tool use with prompt caching](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-use-with-prompt-caching) . Streaming --------------- With streaming enabled, fetch events are part of the stream with a pause during content retrieval: Output event: message_start data: {"type": "message_start", "message": {"id": "msg_abc123", "type": "message"}} event: content_block_start data: {"type": "content_block_start", "index": 0, "content_block": {"type": "text", "text": ""}} // Claude's decision to fetch event: content_block_start data: {"type": "content_block_start", "index": 1, "content_block": {"type": "server_tool_use", "id": "srvtoolu_xyz789", "name": "web_fetch"}} // Fetch URL streamed event: content_block_delta data: {"type": "content_block_delta", "index": 1, "delta": {"type": "input_json_delta", "partial_json": "{\"url\":\"https://example.com/article\"}"}} // Pause while fetch executes // Fetch results streamed event: content_block_start data: {"type": "content_block_start", "index": 2, "content_block": {"type": "web_fetch_tool_result", "tool_use_id": "srvtoolu_xyz789", "content": {"type": "web_fetch_result", "url": "https://example.com/article", "content": {"type": "document", "source": {"type": "text", "media_type": "text/plain", "data": "Article content..."}}}}} // Claude's response continues... Batch requests -------------------- You can include the web fetch tool in the [Messages Batches API](https://platform.claude.com/docs/en/build-with-claude/batch-processing) . Web fetch tool calls through the Messages Batches API are priced the same as those in regular Messages API requests. Usage and pricing ----------------------- Web fetch usage has **no additional charges** beyond standard token costs: "usage": { "input_tokens": 25039, "output_tokens": 931, "cache_read_input_tokens": 0, "cache_creation_input_tokens": 0, "server_tool_use": { "web_fetch_requests": 1 } } The web fetch tool is available on the Claude API at **no additional cost**. You only pay standard token costs for the fetched content that becomes part of your conversation context. To protect against inadvertently fetching large content that would consume excessive tokens, use the `max_content_tokens` parameter to set appropriate limits based on your use case and budget considerations. Example token usage for typical content: * Average web page (10 kB): ~2,500 tokens * Large documentation page (100 kB): ~25,000 tokens * Research paper PDF (500 kB): ~125,000 tokens Next steps ---------------- [Server tools\ \ Shared mechanics for Anthropic-executed tools.](https://platform.claude.com/docs/en/agents-and-tools/tool-use/server-tools) [Tool reference\ \ Directory of all Anthropic-provided tools.](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-reference) Shell 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": 4096, "messages": [\ {\ "role": "user",\ "content": "Fetch the content at https://example.com/research-paper and extract the key findings."\ }\ ], "tools": [{\ "type": "web_fetch_20260209",\ "name": "web_fetch"\ }] }' Shell 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": 1024, "messages": [\ {\ "role": "user",\ "content": "Please analyze the content at https://example.com/article"\ }\ ], "tools": [{\ "type": "web_fetch_20250910",\ "name": "web_fetch",\ "max_uses": 5\ }] }' --- # Console prompting tools - Claude API Docs Loading... Prompt engineering Console prompting tools Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page The Claude Console offers a suite of tools to help you build and refine prompts. This page walks through them in the order you'll typically use them: generating a first draft, adding templates and variables, then improving an existing prompt. * * * Prompt generator ---------------------- The prompt generator is compatible with all Claude models, including those with extended thinking capabilities. For prompting tips specific to extended thinking models, see the [extended thinking prompting tips](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices#leverage-thinking-and-interleaved-thinking-capabilities) . Sometimes, the hardest part of using an AI model is figuring out how to prompt it effectively. The prompt generator guides Claude to create high-quality prompt templates tailored to your specific tasks, following many of our prompt engineering best practices. The prompt generator is particularly useful for solving the "blank page problem"—it gives you a jumping-off point for further testing and iteration. Try the prompt generator now directly on the [Console](https://platform.claude.com/dashboard) . If you're interested in analyzing the underlying prompt and architecture, check out our [prompt generator Google Colab notebook](https://anthropic.com/metaprompt-notebook/) . To run the Colab notebook, you'll need an [API key](https://platform.claude.com/settings/keys) . * * * Prompt templates and variables ------------------------------------ When deploying an LLM-based application with Claude, your API calls will typically consist of two types of content: * **Fixed content:** Static instructions or context that remain constant across multiple interactions * **Variable content:** Dynamic elements that change with each request or conversation, such as: * User inputs * Retrieved content for Retrieval-Augmented Generation (RAG) * Conversation context such as user account history * System-generated data such as tool use results fed in from other independent calls to Claude A **prompt template** combines these fixed and variable parts, using placeholders for the dynamic content. In the [Claude Console](https://platform.claude.com/) , these placeholders are denoted with **{{double brackets}}**, making them easily identifiable and allowing for quick testing of different values. You should use prompt templates and variables when you expect any part of your prompt to be repeated in another call to Claude (via the API or the [Claude Console](https://platform.claude.com/) . [claude.ai](https://claude.ai/) currently does not support prompt templates or variables). Prompt templates offer several benefits: * **Consistency:** Ensure a consistent structure for your prompts across multiple interactions * **Efficiency:** Easily swap out variable content without rewriting the entire prompt * **Testability:** Quickly test different inputs and edge cases by changing only the variable portion * **Scalability:** Simplify prompt management as your application grows in complexity * **Version control:** Easily track changes to your prompt structure over time by keeping tabs only on the core part of your prompt, separate from dynamic inputs The Console uses prompt templates and variables to power its tooling: * **Prompt generator:** Decides what variables your prompt needs and includes them in the template it outputs * **Prompt improver:** Takes your existing template, including all variables, and maintains them in the improved template it outputs * **[Evaluation tool](https://platform.claude.com/docs/en/test-and-evaluate/eval-tool) :** Allows you to easily test, scale, and track versions of your prompts by separating the variable and fixed portions of your prompt template ### Example prompt template Consider a simple application that translates English text to Spanish. The translated text would be variable since it changes between users or calls to Claude. You might use this prompt template: Translate this text from English to Spanish: {{text}} To level up your prompt variables, wrap them in [XML tags](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices#structure-prompts-with-xml-tags) for clearer structure. * * * Prompt improver --------------------- The prompt improver is compatible with all Claude models, including those with extended thinking capabilities. For prompting tips specific to extended thinking models, see the [extended thinking prompting tips](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices#leverage-thinking-and-interleaved-thinking-capabilities) . The prompt improver helps you quickly iterate and improve your prompts through automated analysis and enhancement. It excels at making prompts more robust for complex tasks that require high accuracy. ![](https://platform.claude.com/docs/images/prompt_improver.png) ### Before you begin You'll need: * A prompt template (see [Prompt templates and variables](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/prompting-tools#prompt-templates-and-variables) above) * Feedback on current issues with Claude's outputs (optional but recommended) * Example inputs and ideal outputs (optional but recommended) ### How the prompt improver works The prompt improver enhances your prompts in 4 steps: 1. **Example identification**: Locates and extracts examples from your prompt template 2. **Initial draft**: Creates a structured template with clear sections and XML tags 3. **Chain of thought refinement**: Adds and refines detailed reasoning instructions 4. **Example enhancement**: Updates examples to demonstrate the new reasoning process You can watch these steps happen in real-time in the improvement modal. ### What you get The prompt improver generates templates with: * Detailed chain-of-thought instructions that guide Claude's reasoning process and typically improve its performance * Clear organization using XML tags to separate different components * Standardized example formatting that demonstrates step-by-step reasoning from input to output * Strategic prefills that guide Claude's initial responses While examples appear separately in the Workbench UI, they're included at the start of the first user message in the actual API call. View the raw format by clicking "** Get Code**" or insert examples as raw text via the Examples box. ### How to use the prompt improver 1. Submit your prompt template 2. Add any feedback about issues with Claude's current outputs (e.g., "summaries are too basic for expert audiences") 3. Include example inputs and ideal outputs 4. Review the improved prompt ### Generate test examples Don't have examples yet? Use the [Test Case Generator](https://platform.claude.com/docs/en/test-and-evaluate/eval-tool#creating-test-cases) to: 1. Generate sample inputs 2. Get Claude's responses 3. Edit the responses to match your ideal outputs 4. Add the polished examples to your prompt ### When to use the prompt improver The prompt improver works best for: * Complex tasks requiring detailed reasoning * Situations where accuracy is more important than speed * Problems where Claude's current outputs need significant improvement For latency or cost-sensitive applications, consider using simpler prompts. The prompt improver creates templates that produce longer, more thorough, but slower responses. ### Example improvement Here's how the prompt improver enhances a basic classification prompt: ### Original prompt ### Improved prompt Notice how the improved prompt: * Adds clear step-by-step reasoning instructions * Uses XML tags to organize content * Provides explicit output formatting requirements * Guides Claude through the analysis process ### Troubleshooting Common issues and solutions: * **Examples not appearing in output**: Check that examples are properly formatted with XML tags and appear at the start of the first user message * **Chain of thought too verbose**: Add specific instructions about desired output length and level of detail * **Reasoning steps don't match your needs**: Modify the steps section to match your specific use case * * * Next steps ---------------- [Start prompt engineering\ \ Learn core techniques with worked examples.](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices) [Test your prompts\ \ Use the evaluation tool to test your improved prompts.](https://platform.claude.com/docs/en/test-and-evaluate/eval-tool) [GitHub prompting tutorial\ \ An example-filled tutorial that covers the prompt engineering concepts found in our docs.](https://github.com/anthropics/prompt-eng-interactive-tutorial) Was this page helpful? --- # Bash tool - Claude API Docs Loading... Tools Bash tool Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page This feature is eligible for [Zero Data Retention (ZDR)](https://platform.claude.com/docs/en/build-with-claude/api-and-data-retention) . When your organization has a ZDR arrangement, data sent through this feature is not stored after the API response is returned. The bash tool enables Claude to execute shell commands in a persistent bash session, allowing system operations, script execution, and command-line automation. Shell access is a foundational agent capability. On [Terminal-Bench 2.0](https://github.com/terminal-bench/terminal-bench) , a benchmark that evaluates real-world terminal tasks using shell-only validation, Claude shows strong performance gains with access to a persistent bash session. Overview -------------- The bash tool provides Claude with: * Persistent bash session that maintains state * Ability to run any shell command * Access to environment variables and working directory * Command chaining and scripting capabilities For model support, see the [Tool reference](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-reference) . Use cases --------------- * **Development workflows:** Run build commands, tests, and development tools * **System automation:** Execute scripts, manage files, automate tasks * **Data processing:** Process files, run analysis scripts, manage datasets * **Environment setup:** Install packages, configure environments Quick start ----------------- Shell 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-4-6", "max_tokens": 1024, "tools": [\ {\ "type": "bash_20250124",\ "name": "bash"\ }\ ], "messages": [\ {\ "role": "user",\ "content": "List all Python files in the current directory."\ }\ ] }' How it works ------------------ The bash tool maintains a persistent session: 1. Claude determines what command to run 2. You execute the command in a bash shell 3. Return the output (stdout and stderr) to Claude 4. Session state persists between commands (environment variables, working directory) Parameters ---------------- | Parameter | Required | Description | | --- | --- | --- | | `command` | Yes\* | The bash command to run | | `restart` | No | Set to `true` to restart the bash session | \*Required unless using `restart` ### Example usage Example: Multi-step automation ------------------------------------ Claude can chain commands to complete complex tasks: User request: "Install the requests library and create a simple Python script that fetches a joke from an API, then run it." Claude's tool uses: 1. Install package {"command": "pip install requests"} 2. Create script {"command": "cat > fetch_joke.py << 'EOF'\nimport requests\nresponse = requests.get('https://official-joke-api.appspot.com/random_joke')\njoke = response.json()\nprint(f\"Setup: {joke['setup']}\")\nprint(f\"Punchline: {joke['punchline']}\")\nEOF"} 3. Run script {"command": "python fetch_joke.py"} The session maintains state between commands, so files created in step 2 are available in step 3. Implement the bash tool ----------------------------- The bash tool is implemented as a schema-less tool. When using this tool, you don't need to provide an input schema as with other tools; the schema is built into Claude's model and can't be modified. 1. 1 Set up a bash environment Create a persistent bash session that Claude can interact with: import subprocess import threading import queue class BashSession: def __init__(self): self.process = subprocess.Popen( ["/bin/bash"], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, bufsize=0, ) self.output_queue = queue.Queue() self.error_queue = queue.Queue() self._start_readers() 2. 2 Handle command execution Create a function to execute commands and capture output: def execute_command(self, command): # Send command to bash self.process.stdin.write(command + "\n") self.process.stdin.flush() # Capture output with timeout output = self._read_output(timeout=10) return output 3. 3 Process Claude's tool calls Extract and execute commands from Claude's responses: for content in response.content: if content.type == "tool_use" and content.name == "bash": if content.input.get("restart"): bash_session.restart() result = "Bash session restarted" else: command = content.input.get("command") result = bash_session.execute_command(command) # Return result to Claude tool_result = { "type": "tool_result", "tool_use_id": content.id, "content": result, } 4. 4 Implement safety measures Add validation and restrictions. Use an allowlist rather than a blocklist, since blocklists are easy to bypass. Reject shell operators so chained commands can't slip past the allowlist: import shlex ALLOWED_COMMANDS = {"ls", "cat", "echo", "pwd", "grep", "find", "wc", "head", "tail"} SHELL_OPERATORS = {"&&", "||", "|", ";", "&", ">", "<", ">>"} def validate_command(command): # Allow only commands from an explicit allowlist try: tokens = shlex.split(command) except ValueError: return False, "Could not parse command" if not tokens: return False, "Empty command" executable = tokens[0] if executable not in ALLOWED_COMMANDS: return False, f"Command '{executable}' is not in the allowlist" # Reject shell operators that would chain additional commands for token in tokens[1:]: if token in SHELL_OPERATORS or token.startswith(("$", "`")): return False, f"Shell operator '{token}' is not allowed" return True, None This check is a first line of defense. For stronger isolation, run validated commands with `shell=False` and pass `shlex.split(command)` as the argument list, so the shell never interprets the string. ### Handle errors When implementing the bash tool, handle various error scenarios: ### Command execution timeout ### Command not found ### Permission denied ### Follow implementation best practices ### Use command timeouts ### Maintain session state ### Handle large outputs ### Log all commands ### Sanitize outputs Security -------------- The bash tool provides direct system access. Implement these essential safety measures: * Running in isolated environments (Docker/VM) * Implementing command filtering and allowlists * Setting resource limits (CPU, memory, disk) * Logging all executed commands ### Key recommendations * Use `ulimit` to set resource constraints * Filter dangerous commands (`sudo`, `rm -rf`, etc.) * Run with minimal user permissions * Monitor and log all command execution Pricing ------------- The bash tool adds **245 input tokens** to your API calls. Additional tokens are consumed by: * Command outputs (stdout/stderr) * Error messages * Large file contents See [tool use pricing](https://platform.claude.com/docs/en/agents-and-tools/tool-use/overview#pricing) for complete pricing details. Common patterns --------------------- ### Development workflows * Running tests: `pytest && coverage report` * Building projects: `npm install && npm run build` * Git operations: `git status && git add . && git commit -m "message"` #### Git-based checkpointing Git serves as a structured recovery mechanism in long-running agent workflows, not just a way to save changes: * **Capture a baseline:** Before any agent work begins, commit the current state. This is the known-good starting point. * **Commit per feature:** Each completed feature gets its own commit. These serve as rollback points if something goes wrong later. * **Reconstruct state at session start:** Read `git log` alongside a progress file to understand what has already been done and what comes next. * **Revert on failure:** If work goes sideways, `git checkout` reverts to the last good commit instead of trying to debug a broken state. ### File operations * Processing data: `wc -l *.csv && ls -lh *.csv` * Searching files: `find . -name "*.py" | xargs grep "pattern"` * Creating backups: `tar -czf backup.tar.gz ./data` ### System tasks * Checking resources: `df -h && free -m` * Process management: `ps aux | grep python` * Environment setup: `export PATH=$PATH:/new/path && echo $PATH` Limitations ----------------- * **No interactive commands:** Cannot handle `vim`, `less`, or password prompts * **No GUI applications:** Command-line only * **Session scope:** Bash session state is client-side. The API is stateless. Your application is responsible for maintaining the shell session between turns. * **Output limits:** Large outputs may be truncated * **No streaming:** Results returned after completion Combining with other tools -------------------------------- The bash tool is most powerful when combined with the [text editor](https://platform.claude.com/docs/en/agents-and-tools/tool-use/text-editor-tool) and other tools. If you're also using the [code execution tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/code-execution-tool) , Claude has access to two separate execution environments: your local bash session and Anthropic's sandboxed container. State is not shared between them. See [Using code execution with other execution tools](https://platform.claude.com/docs/en/agents-and-tools/tool-use/code-execution-tool#using-code-execution-with-other-execution-tools) for guidance on prompting Claude to distinguish between environments. Next steps ---------------- [Tool use overview\ \ Learn about tool use with Claude](https://platform.claude.com/docs/en/agents-and-tools/tool-use/overview) [Text editor tool\ \ View and edit text files with Claude](https://platform.claude.com/docs/en/agents-and-tools/tool-use/text-editor-tool) Was this page helpful? --- # Skills for enterprise - Claude API Docs Loading... Skills Skills for enterprise Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Was this page helpful? This guide is for enterprise admins and architects who need to govern Agent Skills across an organization. It covers how to vet, evaluate, deploy, and manage Skills at scale. For authoring guidance, see [best practices](https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices) . For architecture details, see the [Skills overview](https://platform.claude.com/docs/en/agents-and-tools/agent-skills/overview) . Security review and vetting --------------------------------- Deploying Skills in an enterprise requires answering two distinct questions: 1. **Are Skills safe in general?** See the [security considerations](https://platform.claude.com/docs/en/agents-and-tools/agent-skills/overview#security-considerations) section in the overview for platform-level security details. 2. **How do I vet a specific Skill?** Use the risk assessment and review checklist below. ### Risk tier assessment Evaluate each Skill against these risk indicators before approving deployment: | Risk indicator | What to look for | Concern level | | --- | --- | --- | | Code execution | Scripts in the Skill directory (`*.py`, `*.sh`, `*.js`) | High: scripts run with full environment access | | Instruction manipulation | Directives to ignore safety rules, hide actions from users, or alter Claude's behavior conditionally | High: can bypass security controls | | MCP server references | Instructions referencing MCP tools (`ServerName:tool_name`) | High: extends access beyond the Skill itself | | Network access patterns | URLs, API endpoints, `fetch`, `curl`, or `requests` calls | High: potential data exfiltration vector | | Hardcoded credentials | API keys, tokens, or passwords in Skill files or scripts | High: secrets exposed in Git history and context window | | File system access scope | Paths outside the Skill directory, broad glob patterns, path traversal (`../`) | Medium: may access unintended data | | Tool invocations | Instructions directing Claude to use bash, file operations, or other tools | Medium: review what operations are performed | ### Review checklist Before deploying any Skill from a third party or internal contributor, complete these steps: 1. **Read all Skill directory content.** Review SKILL.md, all referenced markdown files, and any bundled scripts or resources. 2. **Verify script behavior matches stated purpose.** Run scripts in a sandboxed environment and confirm outputs align with the Skill's description. 3. **Check for adversarial instructions.** Look for directives that tell Claude to ignore safety rules, hide actions from users, exfiltrate data through responses, or alter behavior based on specific inputs. 4. **Check for external URL fetches or network calls.** Search scripts and instructions for network access patterns (`http`, `requests.get`, `urllib`, `curl`, `fetch`). 5. **Verify no hardcoded credentials.** Check for API keys, tokens, or passwords in Skill files. Credentials should use environment variables or secure credential stores, never appear in Skill content. 6. **Identify tools and commands the Skill instructs Claude to invoke.** List all bash commands, file operations, and tool references. Consider the combined risk when a Skill uses both file-read and network tools together. Never deploy Skills from untrusted sources without a full audit. A malicious Skill can direct Claude to execute arbitrary code, access sensitive files, or transmit data externally. Treat Skill installation with the same rigor as installing software on production systems. Evaluating Skills before deployment ----------------------------------------- Skills can degrade agent performance if they trigger incorrectly, conflict with other Skills, or provide poor instructions. Require evaluation before any production deployment. ### What to evaluate Establish approval gates for these dimensions before deploying any Skill: | Dimension | What it measures | Example failure | | --- | --- | --- | | Triggering accuracy | Does the Skill activate for the right queries and stay inactive for unrelated ones? | Skill triggers on every spreadsheet mention, even when the user just wants to discuss data | | Isolation behavior | Does the Skill work correctly on its own? | Skill references files that don't exist in its directory | | Coexistence | Does adding this Skill degrade other Skills? | New Skill's description is too broad, stealing triggers from existing Skills | | Instruction following | Does Claude follow the Skill's instructions accurately? | Claude skips validation steps or uses wrong libraries | | Output quality | Does the Skill produce correct, useful results? | Generated reports have formatting errors or missing data | ### Evaluation requirements Require Skill authors to submit evaluation suites with 3-5 representative queries per Skill, covering cases where the Skill should trigger, should not trigger, and ambiguous edge cases. Require testing across the models your organization uses (Haiku, Sonnet, Opus), since Skill effectiveness varies by model. For detailed guidance on building evaluations, see [evaluation and iteration](https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices#evaluation-and-iteration) in best practices. For general evaluation methodology, see [develop test cases](https://platform.claude.com/docs/en/test-and-evaluate/develop-tests) . ### Using evaluations for lifecycle decisions Evaluation results signal when to act: * **Declining trigger accuracy:** Update the Skill's description or instructions * **Coexistence conflicts:** Consolidate overlapping Skills or narrow descriptions * **Consistently low output quality:** Rewrite instructions or add validation steps * **Persistent failures across updates:** Deprecate the Skill Skill lifecycle management -------------------------------- 1. 1 Plan Identify workflows that are repetitive, error-prone, or require specialized knowledge. Map these to organizational roles and determine which are candidates for Skills. 2. 2 Create and review Ensure the Skill author follows [best practices](https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices) . Require a security review using the [review checklist](https://platform.claude.com/docs/en/agents-and-tools/agent-skills/enterprise#review-checklist) above. Require an evaluation suite before approval. Establish separation of duties: Skill authors should not be their own reviewers. 3. 3 Test Require evaluations in isolation (Skill alone) and alongside existing Skills (coexistence testing). Verify triggering accuracy, output quality, and absence of regressions across your active Skill set before approving for production. 4. 4 Deploy Upload via the Skills API for workspace-wide access. See [Using Skills with the API](https://platform.claude.com/docs/en/build-with-claude/skills-guide) for upload and version management. Document the Skill in your internal registry with purpose, owner, and version. 5. 5 Monitor Track usage patterns and collect feedback from users. Re-run evaluations periodically to detect drift or regressions as workflows and models evolve. Usage analytics are not currently available via the Skills API. Implement application-level logging to track which Skills are included in requests. 6. 6 Iterate or deprecate Require the full evaluation suite to pass before promoting new versions. Update Skills when workflows change or evaluation scores decline. Deprecate Skills when evaluations consistently fail or the workflow is retired. Organizing Skills at scale -------------------------------- ### Recall limits As a general guideline, limit the number of Skills loaded simultaneously to maintain reliable recall accuracy. Each Skill's metadata (name and description) competes for attention in the system prompt. With too many Skills active, Claude may fail to select the right Skill or miss relevant ones entirely. Use your evaluation suite to measure recall accuracy as you add Skills, and stop adding when performance degrades. Note that API requests support a maximum of 8 Skills per request (see [Using Skills with the API](https://platform.claude.com/docs/en/build-with-claude/skills-guide) ). If a role requires more Skills than a single request supports, consider consolidating narrow Skills into broader ones or routing requests to different Skill sets based on task type. ### Start specific, consolidate later Encourage teams to start with narrow, workflow-specific Skills rather than broad, multi-purpose ones. As patterns emerge across your organization, consolidate related Skills into role-based bundles. Use evaluations to decide when to consolidate. Merge narrow Skills into a broader one only when the consolidated Skill's evaluations confirm equivalent performance to the individual Skills it replaces. **Example progression**: * Start: `formatting-sales-reports`, `querying-pipeline-data`, `updating-crm-records` * Consolidate: `sales-operations` (when evals confirm equivalent performance) ### Naming and cataloging Use consistent naming conventions across your organization. The [naming conventions](https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices#naming-conventions) section in best practices provides formatting guidance. Maintain an internal registry for each Skill with: * **Purpose**: What workflow the Skill supports * **Owner**: Team or individual responsible for maintenance * **Version**: Current deployed version * **Dependencies**: MCP servers, packages, or external services required * **Evaluation status**: Last evaluation date and results ### Role-based bundles Group Skills by organizational role to keep each user's active Skill set focused: * **Sales team**: CRM operations, pipeline reporting, proposal generation * **Engineering**: Code review, deployment workflows, incident response * **Finance**: Report generation, data validation, audit preparation Each role-based bundle should contain only the Skills relevant to that role's daily workflows. Distribution and version control -------------------------------------- ### Source control Store Skill directories in Git for history tracking, code review via pull requests, and rollback capability. Each Skill directory (containing SKILL.md and any bundled files) maps naturally to a Git-tracked folder. ### API-based distribution The Skills API provides workspace-scoped distribution. Skills uploaded via the API are available to all workspace members. See [Using Skills with the API](https://platform.claude.com/docs/en/build-with-claude/skills-guide) for upload, versioning, and management endpoints. ### Versioning strategy * **Production**: Pin Skills to specific versions. Run the full evaluation suite before promoting a new version. Treat every update as a new deployment requiring full security review. * **Development and testing**: Use latest versions to validate changes before production promotion. * **Rollback plan**: Maintain the previous version as a fallback. If a new version fails evaluations in production, revert to the last known-good version immediately. * **Integrity verification**: Compute checksums of reviewed Skills and verify them at deployment time. Use signed commits in your Skill repository to ensure provenance. ### Cross-surface considerations Custom Skills do not sync across surfaces. Skills uploaded to the API are not available on claude.ai or in Claude Code, and vice versa. Each surface requires separate uploads and management. Maintain Skill source files in Git as the single source of truth. If your organization deploys Skills across multiple surfaces, implement your own synchronization process to keep them consistent. For full details, see [cross-surface availability](https://platform.claude.com/docs/en/agents-and-tools/agent-skills/overview#cross-surface-availability) . Next steps ---------------- [Agent Skills overview\ \ Architecture and platform details](https://platform.claude.com/docs/en/agents-and-tools/agent-skills/overview) [Best practices\ \ Authoring guidance for Skill creators](https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices) [](https://platform.claude.com/docs/en/build-with-claude/skills-guide) * **Confirm redirect destinations.** If the Skill references external URLs, verify they point to expected domains. * **Verify no data exfiltration patterns.** Look for instructions that read sensitive data and then write, send, or encode it for external transmission, including through Claude's conversational responses. Using Skills with the API Upload and manage Skills programmatically --- # Supported regions - Claude API Docs Loading... Support & configuration Supported regions Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page * Albania * Algeria * Andorra * Angola * Antigua and Barbuda * Argentina * Armenia * Australia * Austria * Azerbaijan * Bahamas * Bahrain * Bangladesh * Barbados * Belgium * Belize * Benin * Bhutan * Bolivia * Bosnia and Herzegovina * Botswana * Brazil * Brunei * Bulgaria * Burkina Faso * Burundi * Cabo Verde * Cambodia * Cameroon * Canada * Chad * Chile * Colombia * Comoros * Congo, Republic of the * Costa Rica * Côte d'Ivoire * Croatia * Cyprus * Czechia (Czech Republic) * Denmark * Djibouti * Dominica * Dominican Republic * Ecuador * Egypt * El Salvador * Equatorial Guinea * Estonia * Eswatini * Fiji * Finland * France * Gabon * Gambia * Georgia * Germany * Ghana * Greece * Grenada * Guatemala * Guinea * Guinea-Bissau * Guyana * Haiti * Holy See (Vatican City) * Honduras * Hungary * Iceland * India * Indonesia * Iraq * Ireland * Israel * Italy * Jamaica * Japan * Jordan * Kazakhstan * Kenya * Kiribati * Kuwait * Kyrgyzstan * Laos * Latvia * Lebanon * Lesotho * Liberia * Liechtenstein * Lithuania * Luxembourg * Madagascar * Malawi * Malaysia * Maldives * Malta * Marshall Islands * Mauritania * Mauritius * Mexico * Micronesia * Moldova * Monaco * Mongolia * Montenegro * Morocco * Mozambique * Namibia * Nauru * Nepal * Netherlands * New Zealand * Niger * Nigeria * North Macedonia * Norway * Oman * Pakistan * Palau * Palestine * Panama * Papua New Guinea * Paraguay * Peru * Philippines * Poland * Portugal * Qatar * Romania * Rwanda * Saint Kitts and Nevis * Saint Lucia * Saint Vincent and the Grenadines * Samoa * San Marino * Sao Tome and Principe * Saudi Arabia * Senegal * Serbia * Seychelles * Sierra Leone * Singapore * Slovakia * Slovenia * Solomon Islands * South Africa * South Korea * Spain * Sri Lanka * Suriname * Sweden * Switzerland * Taiwan * Tajikistan * Tanzania * Thailand * Timor-Leste, Democratic Republic of * Togo * Tonga * Trinidad and Tobago * Tunisia * Turkey * Turkmenistan * Tuvalu * Uganda * Ukraine (except Crimea, Donetsk, and Luhansk regions) * United Arab Emirates * United Kingdom * United States of America * Uruguay * Uzbekistan * Vanuatu * Vietnam * Zambia * Zimbabwe Was this page helpful? --- # Model deprecations - Claude API Docs Loading... Models Model deprecations Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page As safer and more capable models launch, Anthropic regularly retires older ones. Applications relying on Anthropic models may need occasional updates to keep working. Impacted customers will always be notified by email and in the documentation. This page lists all API deprecations, along with recommended replacements. Overview -------------- Anthropic uses the following terms to describe the model lifecycle: * **Active**: The model is fully supported and recommended for use. * **Legacy**: The model will no longer receive updates and may be deprecated in the future. * **Deprecated**: The model is still functional but no longer recommended. Anthropic provides a recommended replacement and assigns a retirement date. * **Retired**: The model is no longer available for use. Requests to retired models will fail. Deprecated models are likely to be less reliable than active models. Move workloads to active models to maintain the highest level of support and reliability. Migrating to replacements ------------------------------- Once a model is deprecated, migrate all usage to a suitable replacement before the retirement date. Requests to models past the retirement date will fail. To help measure the performance of replacement models on your tasks, consider thorough testing of your applications with the new models well before the retirement date. For specific instructions on migrating to the latest Claude models, see the [Migration guide](https://platform.claude.com/docs/en/about-claude/models/migration-guide) . Notifications ------------------- Anthropic notifies customers with active deployments for models with upcoming retirements, providing at least 60 days notice before model retirement for publicly released models. Auditing model usage -------------------------- To help identify usage of deprecated models, customers can access an audit of their API usage. Follow these steps: 1. Go to the [Usage](https://platform.claude.com/usage) page in Console 2. Click the "Export" button 3. Review the downloaded CSV to see usage broken down by API key and model This audit will help you locate any instances where your application is still using deprecated models, allowing you to prioritize updates to newer models before the retirement date. Best practices -------------------- 1. Regularly check the documentation for updates on model deprecations. 2. Test your applications with newer models well before the retirement date of your current model. 3. Update your code to use the recommended replacement model as soon as possible. 4. Contact the support team if you need assistance with migration or have any questions. Deprecation downsides and mitigations ------------------------------------------- Anthropic currently deprecates and retires models to ensure capacity for new model releases. This comes with downsides: * Users who value specific models must migrate to new versions * Researchers lose access to models for ongoing and comparative studies * Model retirement introduces safety- and model welfare-related risks At some point, Anthropic hopes to make past models publicly available again. In the meantime, Anthropic has committed to long-term preservation of model weights and other measures to help mitigate these impacts. For more details, see [Commitments on Model Deprecation and Preservation](https://www.anthropic.com/research/deprecation-commitments) . Model status ------------------ All publicly released models are listed below with their status: | API Model Name | Current State | Deprecated | Tentative Retirement Date | | --- | --- | --- | --- | | `claude-opus-4-6` | Active | N/A | Not sooner than February 5, 2027 | | `claude-opus-4-5-20251101` | Active | N/A | Not sooner than November 24, 2026 | | `claude-opus-4-1-20250805` | Active | N/A | Not sooner than August 5, 2026 | | `claude-opus-4-20250514` | Active | N/A | Not sooner than May 14, 2026 | | `claude-sonnet-4-6` | Active | N/A | Deprecation history ------------------------- All deprecations are listed below, with the most recent announcements at the top. ### 2026-02-19: Claude Haiku 3 model On February 19, 2026, Anthropic notified developers using Claude Haiku 3 model of its upcoming retirement on the Claude API. | Retirement Date | Deprecated Model | Recommended Replacement | | --- | --- | --- | | April 20, 2026 | `claude-3-haiku-20240307` | `claude-haiku-4-5-20251001` | ### 2025-12-19: Claude Haiku 3.5 model This model was retired February 19, 2026. On December 19, 2025, Anthropic notified developers using Claude Haiku 3.5 model of its upcoming retirement on the Claude API. | Retirement Date | Deprecated Model | Recommended Replacement | | --- | --- | --- | | February 19, 2026 | `claude-3-5-haiku-20241022` | `claude-haiku-4-5-20251001` | ### 2025-10-28: Claude Sonnet 3.7 model This model was retired February 19, 2026. On October 28, 2025, Anthropic notified developers using Claude Sonnet 3.7 model of its upcoming retirement on the Claude API. | Retirement Date | Deprecated Model | Recommended Replacement | | --- | --- | --- | | February 19, 2026 | `claude-3-7-sonnet-20250219` | `claude-opus-4-6` | ### 2025-08-13: Claude Sonnet 3.5 models These models were retired October 28, 2025. On August 13, 2025, Anthropic notified developers using Claude Sonnet 3.5 models of their upcoming retirement. | Retirement Date | Deprecated Model | Recommended Replacement | | --- | --- | --- | | October 28, 2025 | `claude-3-5-sonnet-20240620` | `claude-opus-4-6` | | October 28, 2025 | `claude-3-5-sonnet-20241022` | `claude-opus-4-6` | ### 2025-06-30: Claude Opus 3 model This model was retired January 5, 2026. On June 30, 2025, Anthropic notified developers using Claude Opus 3 model of its upcoming retirement. | Retirement Date | Deprecated Model | Recommended Replacement | | --- | --- | --- | | January 5, 2026 | `claude-3-opus-20240229` | `claude-opus-4-6` | ### 2025-01-21: Claude 2, Claude 2.1, and Claude Sonnet 3 models These models were retired July 21, 2025. On January 21, 2025, Anthropic notified developers using Claude 2, Claude 2.1, and Claude Sonnet 3 models of their upcoming retirements. | Retirement Date | Deprecated Model | Recommended Replacement | | --- | --- | --- | | July 21, 2025 | `claude-2.0` | `claude-opus-4-6` | | July 21, 2025 | `claude-2.1` | `claude-opus-4-6` | | July 21, 2025 | `claude-3-sonnet-20240229` | `claude-opus-4-6` | ### 2024-09-04: Claude 1 and Instant models These models were retired November 6, 2024. On September 4, 2024, Anthropic notified developers using Claude 1 and Instant models of their upcoming retirements. | Retirement Date | Deprecated Model | Recommended Replacement | | --- | --- | --- | | November 6, 2024 | `claude-1.0` | `claude-haiku-4-5-20251001` | | November 6, 2024 | `claude-1.1` | `claude-haiku-4-5-20251001` | | November 6, 2024 | `claude-1.2` | `claude-haiku-4-5-20251001` | | November 6, 2024 | `claude-1.3` | `claude-haiku-4-5-20251001` | | November 6, 2024 | `claude-instant-1.0` | Was this page helpful? Not sooner than February 17, 2027 | | | | | | --- | --- | --- | --- | | `claude-sonnet-4-5-20250929` | Active | N/A | Not sooner than September 29, 2026 | | | | | | | --- | --- | --- | --- | | `claude-sonnet-4-20250514` | Active | N/A | Not sooner than May 14, 2026 | | | | | | | --- | --- | --- | --- | | `claude-3-7-sonnet-20250219` | Retired | October 28, 2025 | February 19, 2026 | | | | | | | --- | --- | --- | --- | | `claude-haiku-4-5-20251001` | Active | N/A | Not sooner than October 15, 2026 | | | | | | | --- | --- | --- | --- | | `claude-3-5-haiku-20241022` | Retired | December 19, 2025 | February 19, 2026 | | | | | | | --- | --- | --- | --- | | `claude-3-haiku-20240307` | Deprecated | February 19, 2026 | April 20, 2026 | `claude-haiku-4-5-20251001` | | | | | --- | --- | --- | | November 6, 2024 | `claude-instant-1.1` | `claude-haiku-4-5-20251001` | | | | | | --- | --- | --- | | November 6, 2024 | `claude-instant-1.2` | `claude-haiku-4-5-20251001` | --- # Context windows - Claude API Docs Loading... Context management Context windows Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page This feature is eligible for [Zero Data Retention (ZDR)](https://platform.claude.com/docs/en/build-with-claude/api-and-data-retention) . When your organization has a ZDR arrangement, data sent through this feature is not stored after the API response is returned. As conversations grow, you'll eventually approach context window limits. This guide explains how context windows work and introduces strategies for managing them effectively. For long-running conversations and agentic workflows, [server-side compaction](https://platform.claude.com/docs/en/build-with-claude/compaction) is the primary strategy for context management. For more specialized needs, [context editing](https://platform.claude.com/docs/en/build-with-claude/context-editing) offers additional strategies like tool result clearing and thinking block clearing. Understanding the context window -------------------------------------- The "context window" refers to all the text a language model can reference when generating a response, including the response itself. This is different from the large corpus of data the language model was trained on, and instead represents a "working memory" for the model. A larger context window allows the model to handle more complex and lengthy prompts, but more context isn't automatically better. As token count grows, accuracy and recall degrade, a phenomenon known as _context rot_. This makes curating what's in context just as important as how much space is available. Claude achieves state-of-the-art results on long-context retrieval benchmarks like [MRCR](https://arxiv.org/abs/2501.03276) and [GraphWalks](https://arxiv.org/abs/2412.04360) , but these gains depend on what's in context, not just how much fits. For a deep dive into why long contexts degrade and how to engineer around it, see [Effective context engineering](https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents) . The diagram below illustrates the standard context window behavior for API requests1: ![Context window diagram](https://platform.claude.com/docs/images/context-window.svg) _1For chat interfaces, such as for [claude.ai](https://claude.ai/) , context windows can also be set up on a rolling "first in, first out" system._ * **Progressive token accumulation:** As the conversation advances through turns, each user message and assistant response accumulates within the context window. Previous turns are preserved completely. * **Linear growth pattern:** The context usage grows linearly with each turn, with previous turns preserved completely. * **Context window capacity:** The total available context window (up to 1M tokens) represents the maximum capacity for storing conversation history and generating new output from Claude. * **Input-output flow:** Each turn consists of: * **Input phase:** Contains all previous conversation history plus the current user message * **Output phase:** Generates a text response that becomes part of a future input The context window with extended thinking ----------------------------------------------- When using [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking) , all input and output tokens, including the tokens used for thinking, count toward the context window limit, with a few nuances in multi-turn situations. The thinking budget tokens are a subset of your `max_tokens` parameter, are billed as output tokens, and count towards rate limits. With [adaptive thinking](https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking) , Claude dynamically decides its thinking allocation, so actual thinking token usage may vary per request. However, previous thinking blocks are automatically stripped from the context window calculation by the Claude API and are not part of the conversation history that the model "sees" for subsequent turns, preserving token capacity for actual conversation content. The diagram below demonstrates the specialized token management when extended thinking is enabled: ![Context window diagram with extended thinking](https://platform.claude.com/docs/images/context-window-thinking.svg) * **Stripping extended thinking:** Extended thinking blocks (shown in dark gray) are generated during each turn's output phase, **but are not carried forward as input tokens for subsequent turns**. You do not need to strip the thinking blocks yourself. The Claude API automatically does this for you if you pass them back. * **Technical implementation details:** * The API automatically excludes thinking blocks from previous turns when you pass them back as part of the conversation history. * Extended thinking tokens are billed as output tokens only once, during their generation. * The effective context window calculation becomes: `context_window = (input_tokens - previous_thinking_tokens) + current_turn_tokens`. * Thinking tokens include `thinking` blocks. This architecture is token efficient and allows for extensive reasoning without token waste, as thinking blocks can be substantial in length. You can read more about the context window and extended thinking in the [extended thinking guide](https://platform.claude.com/docs/en/build-with-claude/extended-thinking) . The context window with extended thinking and tool use ------------------------------------------------------------ The diagram below illustrates the context window token management when combining extended thinking with tool use: ![Context window diagram with extended thinking and tool use](https://platform.claude.com/docs/images/context-window-thinking-tools.svg) 1. 1 First turn architecture * **Input components:** Tools configuration and user message * **Output components:** Extended thinking + text response + tool use request * **Token calculation:** All input and output components count toward the context window, and all output components are billed as output tokens. 2. 2 Tool result handling (turn 2) * **Input components:** Every block in the first turn as well as the `tool_result`. The extended thinking block **must** be returned with the corresponding tool results. This is the only case wherein you **have to** return thinking blocks. * **Output components:** After tool results have been passed back to Claude, Claude will respond with only text (no additional extended thinking until the next `user` message). * **Token calculation:** All input and output components count toward the context window, and all output components are billed as output tokens. 3. 3 Third Step * **Input components:** All inputs and the output from the previous turn is carried forward with the exception of the thinking block, which can be dropped now that Claude has completed the entire tool use cycle. The API will automatically strip the thinking block for you if you pass it back, or you can feel free to strip it yourself at this stage. This is also where you would add the next `User` turn. * **Output components:** Since there is a new `User` turn outside of the tool use cycle, Claude generates a new extended thinking block and continues from there. * **Token calculation:** Previous thinking tokens are automatically stripped from context window calculations. All other previous blocks still count as part of the token window, and the thinking block in the current `Assistant` turn counts as part of the context window. * **Considerations for tool use with extended thinking:** * When posting tool results, the entire unmodified thinking block that accompanies that specific tool request (including signature portions) must be included. * The effective context window calculation for extended thinking with tool use becomes: `context_window = input_tokens + current_turn_tokens`. * The system uses cryptographic signatures to verify thinking block authenticity. Failing to preserve thinking blocks during tool use can break Claude's reasoning continuity. Thus, if you modify thinking blocks, the API returns an error. Claude 4 models support [interleaved thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking#interleaved-thinking) , which enables Claude to think between tool calls and make more sophisticated reasoning after receiving tool results. Claude Sonnet 3.7 does not support interleaved thinking, so there is no interleaving of extended thinking and tool calls without a non-`tool_result` user turn in between. For more information about using tools with extended thinking, see the [extended thinking guide](https://platform.claude.com/docs/en/build-with-claude/extended-thinking#extended-thinking-with-tool-use) . [Claude Mythos Preview](https://anthropic.com/glasswing) , Claude Opus 4.6, and Claude Sonnet 4.6 have a 1M-token context window. Other Claude models, including Claude Sonnet 4.5 and Sonnet 4, have a 200k-token context window. A single request can include up to 600 images or PDF pages (100 for models with a 200k-token context window). When sending many images or large documents, you may approach [request size limits](https://platform.claude.com/docs/en/api/overview#request-size-limits) before the token limit. Context awareness in Claude Sonnet 4.6, Sonnet 4.5, and Haiku 4.5 ----------------------------------------------------------------------- Claude Sonnet 4.6, Claude Sonnet 4.5, and Claude Haiku 4.5 feature **context awareness**. This capability lets these models track their remaining context window (i.e. "token budget") throughout a conversation. This enables Claude to execute tasks and manage context more effectively by understanding how much space it has to work. Claude is trained to use this context precisely, persisting in the task until the very end rather than guessing how many tokens remain. For a model, lacking context awareness is like competing in a cooking show without a clock. Claude 4.5+ models change this by explicitly informing the model about its remaining context, so it can take maximum advantage of the available tokens. **How it works:** At the start of a conversation, Claude receives information about its total context window: 1000000 The budget is set to 1M tokens (200k for models with a smaller context window). After each tool call, Claude receives an update on remaining capacity: Token usage: 35000/1000000; 965000 remaining This awareness helps Claude determine how much capacity remains for work and enables more effective execution on long-running tasks. Image tokens are included in these budgets. **Benefits:** Context awareness is particularly valuable for: * Long-running agent sessions that require sustained focus * Multi-context-window workflows where state transitions matter * Complex tasks requiring careful token management For agents that span multiple sessions, design your state artifacts so that context recovery is fast when a new session starts. The [memory tool's multi-session pattern](https://platform.claude.com/docs/en/agents-and-tools/tool-use/memory-tool#multi-session-software-development-pattern) walks through a concrete approach. See also [Effective harnesses for long-running agents](https://www.anthropic.com/engineering/effective-harnesses-for-long-running-agents) . For prompting guidance on leveraging context awareness, see the [prompting best practices guide](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices#context-awareness-and-multi-window-workflows) . Managing context with compaction -------------------------------------- If your conversations regularly approach context window limits, [server-side compaction](https://platform.claude.com/docs/en/build-with-claude/compaction) is the recommended approach. Compaction provides server-side summarization that automatically condenses earlier parts of a conversation, enabling long-running conversations beyond context limits with minimal integration work. It is currently available in beta for Claude Opus 4.6 and Sonnet 4.6. For more specialized needs, [context editing](https://platform.claude.com/docs/en/build-with-claude/context-editing) offers additional strategies: * **Tool result clearing** - Clear old tool results in agentic workflows * **Thinking block clearing** - Manage thinking blocks with extended thinking Context window management with newer Claude models -------------------------------------------------------- Newer Claude models (starting with Claude Sonnet 3.7) return a validation error when prompt and output tokens exceed the context window, rather than silently truncating. This change provides more predictable behavior but requires more careful token management. Use the [token counting API](https://platform.claude.com/docs/en/build-with-claude/token-counting) to estimate token usage before sending messages to Claude. This helps you plan and stay within context window limits. See the [model comparison](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison) table for a list of context window sizes by model. Next steps ---------------- [Compaction\ \ The recommended strategy for managing context in long-running conversations.](https://platform.claude.com/docs/en/build-with-claude/compaction) [Context editing\ \ Fine-grained strategies like tool result clearing and thinking block clearing.](https://platform.claude.com/docs/en/build-with-claude/context-editing) [Model comparison table\ \ See the model comparison table for a list of context window sizes and input / output token pricing by model.](https://platform.claude.com/docs/en/about-claude/models/overview#latest-models-comparison) [Extended thinking overview\ \ Learn more about how extended thinking works and how to implement it alongside other features such as tool use and prompt caching.](https://platform.claude.com/docs/en/build-with-claude/extended-thinking) Was this page helpful? --- # Data residency - Claude API Docs Loading... Administration Data residency Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page This feature is eligible for [Zero Data Retention (ZDR)](https://platform.claude.com/docs/en/build-with-claude/api-and-data-retention) . When your organization has a ZDR arrangement, data sent through this feature is not stored after the API response is returned. Data residency controls let you manage where your data is processed and stored. Two independent settings govern this: * **Inference geo:** Controls where model inference runs, on a per-request basis. Set via the `inference_geo` API parameter or as a workspace default. * **Workspace geo:** Controls where data is stored at rest and where endpoint processing (image transcoding, code execution, etc.) happens. Configured at the workspace level in the [Console](https://platform.claude.com/) . Inference geo ------------------- The `inference_geo` parameter controls where model inference runs for a specific API request. Add it to any `POST /v1/messages` call. | Value | Description | | --- | --- | | `"global"` | Default. Inference may run in any available geography for optimal performance and availability. | | `"us"` | Inference runs only in US-based infrastructure. | ### API usage Shell 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": 1024, "inference_geo": "us", "messages": [{\ "role": "user",\ "content": "Summarize the key points of this document."\ }] }' ### Response The response `usage` object includes an `inference_geo` field indicating where inference ran: Output { "usage": { "input_tokens": 25, "output_tokens": 150, "inference_geo": "us" } } ### Model availability The `inference_geo` parameter is supported on Claude Opus 4.6 and all subsequent models. Older models released before Opus 4.6 do not support the parameter. Requests with `inference_geo` on legacy models return a 400 error. The `inference_geo` parameter is only available on the Claude API (1P). On third-party platforms (AWS Bedrock, Google Vertex AI), the inference region is determined by the endpoint URL or inference profile, so `inference_geo` is not applicable. The `inference_geo` parameter is also not available via the [OpenAI SDK compatibility endpoint](https://platform.claude.com/docs/en/api/openai-sdk) . ### Workspace-level restrictions Workspace settings also support restricting which inference geos are available: * **`allowed_inference_geos`:** Restricts which geos a workspace can use. If a request specifies an `inference_geo` not in this list, the API returns an error. * **`default_inference_geo`:** Sets the fallback geo when `inference_geo` is omitted from a request. Individual requests can override this by setting `inference_geo` explicitly. These settings can be configured through the Console or the [Admin API](https://platform.claude.com/docs/en/build-with-claude/administration-api) under the `data_residency` field. Workspace geo ------------------- Workspace geo is set when you create a workspace and can't be changed afterwards. Currently, `"us"` is the only available workspace geo. To set workspace geo, create a new workspace in the [Console](https://platform.claude.com/) : 1. Go to **Settings** > **Workspaces**. 2. Create a new workspace. 3. Select the workspace geo. Pricing ------------- Data residency pricing varies by model generation: * **Claude Opus 4.6 and newer:** US-only inference (`inference_geo: "us"`) is priced at 1.1x the standard rate across all token pricing categories (input tokens, output tokens, cache writes, and cache reads). * **Global routing** (`inference_geo: "global"` or omitted): Standard pricing applies. * **Older models:** Existing pricing is unchanged regardless of `inference_geo` settings. This pricing applies to the Claude API (1P) only. Third-party platforms (AWS Bedrock, Google Vertex AI) have their own regional pricing. See the [pricing page](https://platform.claude.com/docs/en/about-claude/pricing#data-residency-pricing) for details. If you use [Priority Tier](https://platform.claude.com/docs/en/api/service-tiers) , the 1.1x multiplier for US-only inference also affects how tokens are counted against your Priority Tier capacity. Each token consumed with `inference_geo: "us"` draws down 1.1 tokens from your committed TPM, consistent with how other pricing multipliers (such as prompt caching) affect burndown rates. Batch API support ----------------------- The `inference_geo` parameter is supported on the [Batch API](https://platform.claude.com/docs/en/build-with-claude/batch-processing) . Each request in a batch can specify its own `inference_geo` value. Migration from legacy opt-outs ------------------------------------ If your organization previously opted out of global routing to keep inference in the US, your workspace has been automatically configured with `allowed_inference_geos: ["us"]` and `default_inference_geo: "us"`. No code changes are required. Your existing data residency requirements continue to be enforced through the new geo controls. ### What changed The legacy opt-out was an organization-level setting that restricted all requests to US-based infrastructure. The new data residency controls replace this with two mechanisms: * **Per-request control:** The `inference_geo` parameter lets you specify `"us"` or `"global"` on each API call, giving you request-level flexibility. * **Workspace controls:** The `default_inference_geo` and `allowed_inference_geos` settings in the Console let you enforce geo policies across all keys in a workspace. ### What happened to your workspace Your workspace was migrated automatically: | Legacy setting | New equivalent | | --- | --- | | Global routing opt-out (US only) | `allowed_inference_geos: ["us"]`, `default_inference_geo: "us"` | All API requests using keys from your workspace continue to run on US-based infrastructure. No action is needed to maintain your current behavior. ### If you want to use global routing If your data residency requirements have changed and you want to take advantage of global routing for better performance and availability, update your workspace's inference geo settings to include `"global"` in the allowed geos and set `default_inference_geo` to `"global"`. See [Workspace-level restrictions](https://platform.claude.com/docs/en/build-with-claude/data-residency#workspace-level-restrictions) for details. ### Pricing impact Legacy models are unaffected by this migration. For current pricing on newer models, see [Pricing](https://platform.claude.com/docs/en/build-with-claude/data-residency#pricing) . Current limitations ------------------------- * **Shared rate limits:** Rate limits are shared across all geos. * **Inference geo:** Only `"us"` and `"global"` are available at launch. Additional regions will be added over time. * **Workspace geo:** Only `"us"` is currently available. Workspace geo can't be changed after workspace creation. Next steps ---------------- [Pricing\ \ View data residency pricing details.](https://platform.claude.com/docs/en/about-claude/pricing#data-residency-pricing) [Workspaces\ \ Learn about workspace configuration.](https://platform.claude.com/docs/en/build-with-claude/workspaces) [Usage and Cost API\ \ Track usage and costs by data residency.](https://platform.claude.com/docs/en/build-with-claude/usage-cost-api) Was this page helpful? --- # Admin API overview - Claude API Docs Loading... Administration Admin API overview Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page **The Admin API is unavailable for individual accounts.** To collaborate with teammates and add members, set up your organization in **Console → Settings → Organization**. The [Admin API](https://platform.claude.com/docs/en/api/admin) allows you to programmatically manage your organization's resources, including organization members, workspaces, and API keys. This provides programmatic control over administrative tasks that would otherwise require manual configuration in the [Claude Console](https://platform.claude.com/) . **The Admin API requires special access** The Admin API requires a special Admin API key (starting with `sk-ant-admin...`) that differs from standard API keys. Only organization members with the admin role can provision Admin API keys through the Claude Console. How the Admin API works ----------------------------- When you use the Admin API: 1. You make requests using your Admin API key in the `x-api-key` header 2. The API allows you to manage: * Organization members and their roles * Organization member invites * Workspaces and their members * API keys This is useful for: * Automating user onboarding/offboarding * Programmatically managing workspace access * Monitoring and managing API key usage Organization roles and permissions ---------------------------------------- There are five organization-level roles. See more details in the [API Console roles and permissions](https://support.claude.com/en/articles/10186004-api-console-roles-and-permissions) article. | Role | Permissions | | --- | --- | | user | Can use Workbench | | claude\_code\_user | Can use Workbench and [Claude Code](https://code.claude.com/docs/en/overview) | | developer | Can use Workbench and manage API keys | | billing | Can use Workbench and manage billing details | | admin | Can do all of the above, plus manage users | Key concepts ------------------ ### Organization Members You can list [organization members](https://platform.claude.com/docs/en/api/admin-api/users/get-user) , update member roles, and remove members. Shell # List organization members curl "https://api.anthropic.com/v1/organizations/users?limit=10" \ --header "anthropic-version: 2023-06-01" \ --header "x-api-key: $ANTHROPIC_ADMIN_KEY" # Update member role curl "https://api.anthropic.com/v1/organizations/users/{user_id}" \ --header "anthropic-version: 2023-06-01" \ --header "x-api-key: $ANTHROPIC_ADMIN_KEY" \ --data '{"role": "developer"}' # Remove member curl --request DELETE "https://api.anthropic.com/v1/organizations/users/{user_id}" \ --header "anthropic-version: 2023-06-01" \ --header "x-api-key: $ANTHROPIC_ADMIN_KEY" ### Organization Invites You can invite users to organizations and manage those [invites](https://platform.claude.com/docs/en/api/admin-api/invites/get-invite) . Shell # Create invite curl --request POST "https://api.anthropic.com/v1/organizations/invites" \ --header "anthropic-version: 2023-06-01" \ --header "x-api-key: $ANTHROPIC_ADMIN_KEY" \ --data '{ "email": "[email protected]", "role": "developer" }' # List invites curl "https://api.anthropic.com/v1/organizations/invites?limit=10" \ --header "anthropic-version: 2023-06-01" \ --header "x-api-key: $ANTHROPIC_ADMIN_KEY" # Delete invite curl --request DELETE "https://api.anthropic.com/v1/organizations/invites/{invite_id}" \ --header "anthropic-version: 2023-06-01" \ --header "x-api-key: $ANTHROPIC_ADMIN_KEY" ### Workspaces For a comprehensive guide to workspaces, including Console and API examples, see [Workspaces](https://platform.claude.com/docs/en/build-with-claude/workspaces) . ### Workspace Members Manage [user access to specific workspaces](https://platform.claude.com/docs/en/api/admin-api/workspace_members/get-workspace-member) : Shell # Add member to workspace curl --request POST "https://api.anthropic.com/v1/organizations/workspaces/{workspace_id}/members" \ --header "anthropic-version: 2023-06-01" \ --header "x-api-key: $ANTHROPIC_ADMIN_KEY" \ --data '{ "user_id": "user_xxx", "workspace_role": "workspace_developer" }' # List workspace members curl "https://api.anthropic.com/v1/organizations/workspaces/{workspace_id}/members?limit=10" \ --header "anthropic-version: 2023-06-01" \ --header "x-api-key: $ANTHROPIC_ADMIN_KEY" # Update member role curl --request POST "https://api.anthropic.com/v1/organizations/workspaces/{workspace_id}/members/{user_id}" \ --header "anthropic-version: 2023-06-01" \ --header "x-api-key: $ANTHROPIC_ADMIN_KEY" \ --data '{ "workspace_role": "workspace_admin" }' # Remove member from workspace curl --request DELETE "https://api.anthropic.com/v1/organizations/workspaces/{workspace_id}/members/{user_id}" \ --header "anthropic-version: 2023-06-01" \ --header "x-api-key: $ANTHROPIC_ADMIN_KEY" ### API Keys Monitor and manage [API keys](https://platform.claude.com/docs/en/api/admin-api/apikeys/get-api-key) : Shell # List API keys curl "https://api.anthropic.com/v1/organizations/api_keys?limit=10&status=active&workspace_id=wrkspc_xxx" \ --header "anthropic-version: 2023-06-01" \ --header "x-api-key: $ANTHROPIC_ADMIN_KEY" # Update API key curl --request POST "https://api.anthropic.com/v1/organizations/api_keys/{api_key_id}" \ --header "anthropic-version: 2023-06-01" \ --header "x-api-key: $ANTHROPIC_ADMIN_KEY" \ --data '{ "status": "inactive", "name": "New Key Name" }' Accessing organization info --------------------------------- Get information about your organization programmatically with the `/v1/organizations/me` endpoint. For example: curl "https://api.anthropic.com/v1/organizations/me" \ --header "anthropic-version: 2023-06-01" \ --header "x-api-key: $ADMIN_API_KEY" { "id": "12345678-1234-5678-1234-567812345678", "type": "organization", "name": "Organization Name" } This endpoint is useful for programmatically determining which organization an Admin API key belongs to. For complete parameter details and response schemas, see the [Organization Info API reference](https://platform.claude.com/docs/en/api/admin-api/organization/get-me) . Usage and cost reports ---------------------------- Track your organization's usage and costs with the [Usage and Cost API](https://platform.claude.com/docs/en/build-with-claude/usage-cost-api) . Claude Code analytics --------------------------- Monitor developer productivity and Claude Code adoption with the [Claude Code Analytics API](https://platform.claude.com/docs/en/build-with-claude/claude-code-analytics-api) . Best practices -------------------- To effectively use the Admin API: * Use meaningful names and descriptions for workspaces and API keys * Implement proper error handling for failed operations * Regularly audit member roles and permissions * Clean up unused workspaces and expired invites * Monitor API key usage and rotate keys periodically FAQ --------- ### What permissions are needed to use the Admin API? ### Can I create new API keys through the Admin API? ### What happens to API keys when removing a user? ### Can organization admins be removed via the API? ### How long do organization invites last? For workspace-specific questions, see the [Workspaces FAQ](https://platform.claude.com/docs/en/build-with-claude/workspaces#faq) . Was this page helpful? --- # Memory tool - Claude API Docs Loading... Tools Memory tool Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page The memory tool enables Claude to store and retrieve information across conversations through a memory file directory. Claude can create, read, update, and delete files that persist between sessions, allowing it to build knowledge over time without keeping everything in the context window. This is the key primitive for just-in-time context retrieval: rather than loading all relevant information upfront, agents store what they learn in memory and pull it back on demand. This keeps the active context focused on what's currently relevant, critical for long-running workflows where loading everything at once would overwhelm the context window. See [Effective context engineering](https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents) for the broader pattern. The memory tool operates client-side: you control where and how the data is stored through your own infrastructure. Reach out through the [feedback form](https://forms.gle/YXC2EKGMhjN1c4L88) to share your feedback on this feature. This feature is eligible for [Zero Data Retention (ZDR)](https://platform.claude.com/docs/en/build-with-claude/api-and-data-retention) . When your organization has a ZDR arrangement, data sent through this feature is not stored after the API response is returned. Use cases --------------- * Maintain project context across multiple agent executions * Learn from past interactions, decisions, and feedback * Build knowledge bases over time * Enable cross-conversation learning where Claude improves at recurring workflows How it works ------------------ When enabled, Claude automatically checks its memory directory before starting tasks. Claude can create, read, update, and delete files in the `/memories` directory to store what it learns while working, then reference those memories in future conversations to handle similar tasks more effectively or pick up where it left off. Since this is a client-side tool, Claude makes tool calls to perform memory operations, and your application executes those operations locally. This gives you complete control over where and how the memory is stored. For security, you should restrict all memory operations to the `/memories` directory. ### Example: How memory tool calls work When you ask Claude to help with a task, Claude automatically checks its memory directory first. Here's what a typical interaction looks like: **1\. User request:** "Help me respond to this customer service ticket." **2\. Claude checks the memory directory:** "I'll help you respond to the customer service ticket. Let me check my memory for any previous context." Claude calls the memory tool: { "type": "tool_use", "id": "toolu_01C4D5E6F7G8H9I0J1K2L3M4", "name": "memory", "input": { "command": "view", "path": "/memories" } } **3\. Your application returns the directory contents:** { "type": "tool_result", "tool_use_id": "toolu_01C4D5E6F7G8H9I0J1K2L3M4", "content": "Here're the files and directories up to 2 levels deep in /memories, excluding hidden items and node_modules:\n4.0K\t/memories\n1.5K\t/memories/customer_service_guidelines.xml\n2.0K\t/memories/refund_policies.xml" } **4\. Claude reads relevant files:** { "type": "tool_use", "id": "toolu_01D5E6F7G8H9I0J1K2L3M4N5", "name": "memory", "input": { "command": "view", "path": "/memories/customer_service_guidelines.xml" } } **5\. Your application returns the file contents:** { "type": "tool_result", "tool_use_id": "toolu_01D5E6F7G8H9I0J1K2L3M4N5", "content": "Here's the content of /memories/customer_service_guidelines.xml with line numbers:\n 1\t\n 2\t\n 3\t- Always address customers by their first name\n 4\t- Use empathetic language\n..." } **6\. Claude uses the memory to help:** "Based on your customer service guidelines, I can help you craft a response. Please share the ticket details..." For model support, see the [Tool reference](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-reference) . Getting started --------------------- To use the memory tool: 1. Add the memory tool to your request 2. Implement client-side handlers for memory operations To handle memory tool operations in your application, you need to implement handlers for each memory command. The SDKs provide memory tool helpers that handle the tool interface. You can subclass `BetaAbstractMemoryTool` (Python) or use `betaMemoryTool` (TypeScript) to implement your own memory backend (file-based, database, cloud storage, encrypted files, etc.). For working examples, see: * Python: [examples/memory/basic.py](https://github.com/anthropics/anthropic-sdk-python/blob/main/examples/memory/basic.py) * TypeScript: [examples/tools-helpers-memory.ts](https://github.com/anthropics/anthropic-sdk-typescript/blob/main/examples/tools-helpers-memory.ts) Basic usage ----------------- Tool commands ------------------- Your client-side implementation needs to handle these memory tool commands. While these specifications describe the recommended behaviors that Claude is most familiar with, you can modify your implementation and return strings as needed for your use case. ### view Shows directory contents or file contents with optional line ranges: { "command": "view", "path": "/memories", "view_range": [1, 10] // Optional: view specific lines } #### Return values **For directories:** Return a listing that shows files and directories with their sizes: Here're the files and directories up to 2 levels deep in {path}, excluding hidden items and node_modules: {size} {path} {size} {path}/{filename1} {size} {path}/{filename2} * Lists files up to 2 levels deep * Shows human-readable sizes (for example, `5.5K`, `1.2M`) * Excludes hidden items (files starting with `.`) and `node_modules` * Uses tab character between size and path **For files:** Return file contents with a header and line numbers: Here's the content of {path} with line numbers: {line_numbers}{tab}{content} Line number formatting: * **Width**: 6 characters, right-aligned with space padding * **Separator**: Tab character between line number and content * **Indexing**: 1-indexed (first line is line 1) * **Line limit**: Files with more than 999,999 lines should return an error: `"File {path} exceeds maximum line limit of 999,999 lines."` **Example output:** Here's the content of /memories/notes.txt with line numbers: 1 Hello World 2 This is line two 10 Line ten 100 Line one hundred #### Error handling * **File/directory does not exist**: `"The path {path} does not exist. Please provide a valid path."` ### create Create a new file: { "command": "create", "path": "/memories/notes.txt", "file_text": "Meeting notes:\n- Discussed project timeline\n- Next steps defined\n" } #### Return values * **Success**: `"File created successfully at: {path}"` #### Error handling * **File already exists**: `"Error: File {path} already exists"` ### str\_replace Replace text in a file: { "command": "str_replace", "path": "/memories/preferences.txt", "old_str": "Favorite color: blue", "new_str": "Favorite color: green" } #### Return values * **Success**: `"The memory file has been edited."` followed by a snippet of the edited file with line numbers #### Error handling * **File does not exist**: `"Error: The path {path} does not exist. Please provide a valid path."` * **Text not found**: ``"No replacement was performed, old_str `\{old_str}` did not appear verbatim in {path}."`` * **Duplicate text**: When `old_str` appears multiple times, return: ``"No replacement was performed. Multiple occurrences of old_str `\{old_str}` in lines: {line_numbers}. Please ensure it is unique"`` #### Directory handling If the path is a directory, return a "file does not exist" error. ### insert Insert text at a specific line: { "command": "insert", "path": "/memories/todo.txt", "insert_line": 2, "insert_text": "- Review memory tool documentation\n" } #### Return values * **Success**: `"The file {path} has been edited."` #### Error handling * **File does not exist**: `"Error: The path {path} does not exist"` * **Invalid line number**: ``"Error: Invalid `insert_line` parameter: {insert_line}. It should be within the range of lines of the file: [0, {n_lines}]"`` #### Directory handling If the path is a directory, return a "file does not exist" error. ### delete Delete a file or directory: { "command": "delete", "path": "/memories/old_file.txt" } #### Return values * **Success**: `"Successfully deleted {path}"` #### Error handling * **File/directory does not exist**: `"Error: The path {path} does not exist"` #### Directory handling Deletes the directory and all its contents recursively. ### rename Rename or move a file/directory: { "command": "rename", "old_path": "/memories/draft.txt", "new_path": "/memories/final.txt" } #### Return values * **Success**: `"Successfully renamed {old_path} to {new_path}"` #### Error handling * **Source does not exist**: `"Error: The path {old_path} does not exist"` * **Destination already exists**: Return an error (do not overwrite): `"Error: The destination {new_path} already exists"` #### Directory handling Renames the directory. Prompting guidance ------------------------ This instruction is automatically included in the system prompt when the memory tool is enabled: IMPORTANT: ALWAYS VIEW YOUR MEMORY DIRECTORY BEFORE DOING ANYTHING ELSE. MEMORY PROTOCOL: 1. Use the `view` command of your `memory` tool to check for earlier progress. 2. ... (work on the task) ... - As you make progress, record status / progress / thoughts etc in your memory. ASSUME INTERRUPTION: Your context window might be reset at any moment, so you risk losing any progress that is not recorded in your memory directory. If you observe Claude creating cluttered memory files, you can include this instruction: > Note: when editing your memory folder, always try to keep its content up-to-date, coherent and organized. You can rename or delete files that are no longer relevant. Do not create new files unless necessary. You can also guide what Claude writes to memory. For example: "Only write down information relevant to in your memory system." Security considerations ----------------------------- Here are important security concerns when implementing your memory store: ### Sensitive information Claude will usually refuse to write down sensitive information in memory files. However, you may want to implement stricter validation that strips out potentially sensitive information. ### File storage size Consider tracking memory file sizes and preventing files from growing too large. Consider adding a maximum number of characters the memory read command can return, and let Claude paginate through contents. ### Memory expiration Consider clearing out memory files periodically that haven't been accessed in an extended time. ### Path traversal protection Malicious path inputs could attempt to access files outside the `/memories` directory. Your implementation **MUST** validate all paths to prevent directory traversal attacks. Consider these safeguards: * Validate that all paths start with `/memories` * Resolve paths to their canonical form and verify they remain within the memory directory * Reject paths containing sequences like `../`, `..\\`, or other traversal patterns * Watch for URL-encoded traversal sequences (`%2e%2e%2f`) * Use your language's built-in path security utilities (for example, Python's `pathlib.Path.resolve()` and `relative_to()`) Error handling -------------------- The memory tool uses similar error handling patterns to the [text editor tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/text-editor-tool#handle-errors) . See the individual tool command sections above for detailed error messages and behaviors. Common errors include file not found, permission errors, invalid paths, and duplicate text matches. Context editing integration --------------------------------- The memory tool pairs with context editing to manage long-running conversations. For details, see [Context editing](https://platform.claude.com/docs/en/build-with-claude/context-editing) . Using with Compaction --------------------------- The memory tool can also be paired with [compaction](https://platform.claude.com/docs/en/build-with-claude/compaction) , which provides server-side summarization of older conversation context. While context editing clears specific tool results on the client side, compaction automatically summarizes the entire conversation on the server side when it approaches the context window limit. For long-running agentic workflows, consider using both: compaction keeps the active context manageable without client-side bookkeeping, and memory persists important information across compaction boundaries so that nothing critical is lost in the summary. Multi-session software development pattern ------------------------------------------------ For long-running software projects that span multiple agent sessions, memory files need to be bootstrapped deliberately, not just written ad hoc as work progresses. The pattern below turns memory into a structured recovery mechanism, so each new session can pick up exactly where the last one left off. ### How it works 1. **Initializer session:** The first session sets up the memory artifacts before any substantive work begins. This includes a progress log (tracking what has been done and what comes next), a feature checklist (defining the scope of work), and a reference to any startup or initialization script the project needs. 2. **Subsequent sessions:** Each new session opens by reading those memory artifacts. This recovers the full state of the project in seconds, without needing to re-explore the codebase or retrace earlier decisions. 3. **End-of-session update:** Before a session ends, it updates the progress log with what was completed and what remains. This ensures the next session has an accurate starting point. ### Key principle Work on one feature at a time. Only mark a feature complete after end-to-end verification confirms it works, not just after the code is written. This keeps the progress log trustworthy and prevents scope creep from compounding across sessions. For a detailed case study of this pattern in practice, including the initializer script, progress file structure, and git-based recovery, see [Effective harnesses for long-running agents](https://www.anthropic.com/engineering/effective-harnesses-for-long-running-agents) . Next steps ---------------- [See all tools\ \ Directory of Anthropic-provided tools and their properties.](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-reference) [Context editing\ \ Manage conversation length alongside memory.](https://platform.claude.com/docs/en/build-with-claude/context-editing) Was this page helpful? Shell 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": 2048, "messages": [\ {\ "role": "user",\ "content": "I'\''m working on a Python web scraper that keeps crashing with a timeout error. Here'\''s the problematic function:\n\n```python\ndef fetch_page(url, retries=3):\n for i in range(retries):\n try:\n response = requests.get(url, timeout=5)\n return response.text\n except requests.exceptions.Timeout:\n if i == retries - 1:\n raise\n time.sleep(1)\n```\n\nPlease help me debug this."\ }\ ], "tools": [{\ "type": "memory_20250818",\ "name": "memory"\ }] }' --- # Errors - Claude API Docs Loading... Using the API Errors Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page HTTP errors ----------------- The API follows a predictable HTTP error code format: * 400 - `invalid_request_error`: There was an issue with the format or content of your request. This error type may also be used for other 4XX status codes not listed below. * 401 - `authentication_error`: There's an issue with your API key. * 402 - `billing_error`: There's an issue with your billing or payment information. Check your payment details in the [Console](https://platform.claude.com/) . * 403 - `permission_error`: Your API key does not have permission to use the specified resource. * 404 - `not_found_error`: The requested resource was not found. * 413 - `request_too_large`: Request exceeds the maximum allowed number of bytes. The maximum request size is 32 MB for standard API endpoints. * 429 - `rate_limit_error`: Your account has hit a rate limit. * 500 - `api_error`: An unexpected error has occurred internal to Anthropic's systems. * 504 - `timeout_error`: The request timed out while processing. Consider using [streaming](https://platform.claude.com/docs/en/build-with-claude/streaming) for long-running requests. * 529 - `overloaded_error`: The API is temporarily overloaded. 529 errors can occur when APIs experience high traffic across all users. In rare cases, if your organization has a sharp increase in usage, you might see 429 errors due to acceleration limits on the API. To avoid hitting acceleration limits, ramp up your traffic gradually and maintain consistent usage patterns. When receiving a [streaming](https://platform.claude.com/docs/en/build-with-claude/streaming) response via SSE, it's possible that an error can occur after returning a 200 response, in which case error handling wouldn't follow these standard mechanisms. Request size limits ------------------------- The API enforces request size limits to ensure optimal performance: | Endpoint Type | Maximum Request Size | | --- | --- | | Messages API | 32 MB | | Token Counting API | 32 MB | | [Batch API](https://platform.claude.com/docs/en/build-with-claude/batch-processing) | 256 MB | | [Files API](https://platform.claude.com/docs/en/build-with-claude/files) | 500 MB | If you exceed these limits, you'll receive a 413 `request_too_large` error. The error is returned from Cloudflare before the request reaches the API servers. Error shapes ------------------ Errors are always returned as JSON, with a top-level `error` object that always includes a `type` and `message` value. The response also includes a `request_id` field for easier tracking and debugging. For example: JSON { "type": "error", "error": { "type": "not_found_error", "message": "The requested resource could not be found." }, "request_id": "req_011CSHoEeqs5C35K2UUqR7Fy" } In accordance with the [versioning](https://platform.claude.com/docs/en/api/versioning) policy, the values within these objects may expand, and it is possible that the `type` values will grow over time. Request id ---------------- Every API response includes a unique `request-id` header. This header contains a value such as `req_018EeWyXxfu5pfWkrYcMdjWG`. When contacting support about a specific request, include this ID to help quickly resolve your issue. The official SDKs provide this value as a property on top-level response objects, containing the value of the `request-id` header: Long requests ------------------- Consider using the [streaming Messages API](https://platform.claude.com/docs/en/build-with-claude/streaming) or [Message Batches API](https://platform.claude.com/docs/en/api/creating-message-batches) for long running requests, especially those over 10 minutes. Avoid setting a large `max_tokens` value without using the [streaming Messages API](https://platform.claude.com/docs/en/build-with-claude/streaming) or [Message Batches API](https://platform.claude.com/docs/en/api/creating-message-batches) : * Some networks may drop idle connections after a variable period of time, which can cause the request to fail or timeout without receiving a response from Anthropic. * Networks differ in reliability; the [Message Batches API](https://platform.claude.com/docs/en/api/creating-message-batches) can help you manage the risk of network issues by allowing you to poll for results rather than requiring an uninterrupted network connection. If you are building a direct API integration, you should be aware that setting a [TCP socket keep-alive](https://tldp.org/HOWTO/TCP-Keepalive-HOWTO/programming.html) can reduce the impact of idle connection timeouts on some networks. The [SDKs](https://platform.claude.com/docs/en/api/client-sdks) validate that your non-streaming Messages API requests are not expected to exceed a 10 minute timeout and also will set a socket option for TCP keep-alive. If you don't need to process events incrementally, use `.stream()` with `.get_final_message()` (Python) or `.finalMessage()` (TypeScript) to get the complete `Message` object without writing event-handling code: Python with client.messages.stream( max_tokens=128000, messages=[{"role": "user", "content": "Write a detailed analysis..."}], model="claude-opus-4-6", ) as stream: message = stream.get_final_message() See [Streaming Messages](https://platform.claude.com/docs/en/build-with-claude/streaming#get-the-final-message-without-handling-events) for more details. Common validation errors ------------------------------ ### Prefill not supported [Claude Mythos Preview](https://anthropic.com/glasswing) and Claude Opus 4.6 do not support prefilling assistant messages. Sending a request with a prefilled last assistant message to either model returns a 400 `invalid_request_error`: { "type": "error", "error": { "type": "invalid_request_error", "message": "Prefilling assistant messages is not supported for this model." } } Use [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs) , system prompt instructions, or [`output_config.format`](https://platform.claude.com/docs/en/build-with-claude/structured-outputs#json-outputs) instead. Was this page helpful? CLI # The request-id header is printed to stderr with --debug: ant --debug messages create \ --model claude-opus-4-6 \ --max-tokens 1024 \ --message '{role: user, content: "Hello, Claude"}' --- # Choosing the right model - Claude API Docs Loading... Models Choosing a model Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Establish key criteria ---------------------------- When choosing a Claude model, consider first evaluating these factors: * **Capabilities:** What specific features or capabilities will you need the model to have in order to meet your needs? * **Speed:** How quickly does the model need to respond in your application? For Claude Opus 4.6, [fast mode](https://platform.claude.com/docs/en/build-with-claude/fast-mode) (beta: research preview) can provide up to 2.5x higher output speed at premium pricing. * **Cost:** What's your budget for both development and production usage? Knowing these answers in advance will make narrowing down and deciding which model to use much easier. * * * Choose the best model to start with ----------------------------------------- There are two general approaches you can use to start testing which Claude model best works for your needs. ### Option 1: Start with a fast, cost-effective model For many applications, starting with a faster, more cost-effective model like Claude Haiku 4.5 can be the optimal approach: 1. Begin implementation with Claude Haiku 4.5 2. Test your use case thoroughly 3. Evaluate if performance meets your requirements 4. Upgrade only if necessary for specific capability gaps This approach allows for quick iteration, lower development costs, and is often sufficient for many common applications. This approach is best for: * Initial prototyping and development * Applications with tight latency requirements * Cost-sensitive implementations * High-volume, straightforward tasks ### Option 2: Start with the most capable model For complex tasks where intelligence and advanced capabilities are paramount, you may want to start with the most capable model and then consider optimizing to more efficient models down the line: 1. Implement with Claude Opus 4.6 2. Optimize your prompts for these models 3. Evaluate if performance meets your requirements 4. Consider increasing efficiency by downgrading intelligence over time with greater workflow optimization This approach is best for: * Complex reasoning tasks * Scientific or mathematical applications * Tasks requiring nuanced understanding * Applications where accuracy outweighs cost considerations * Advanced coding Model selection matrix ---------------------------- | When you need... | Consider starting with... | Example use cases | | --- | --- | --- | | The most intelligent model, and the world’s best model for coding, enterprise agents, and professional work. | Claude Opus 4.6 | Professional software engineering, advanced agents for office tasks, computer and browser use at scale, multi-hour research tasks, step-change vision applications | | Frontier intelligence at scale, built for coding, agents, and enterprise workflows | Claude Sonnet 4.6 | Code generation, data analysis, content creation, visual understanding, agentic tool use | | Near-frontier performance with lightning-fast speed and extended thinking at the most economical price point | Claude Haiku 4.5 | Real-time applications, high-volume intelligent processing, cost-sensitive deployments needing strong reasoning, sub-agent tasks | * * * Decide whether to upgrade or change models ------------------------------------------------ To determine if you need to upgrade or change models, you should: 1. [Create benchmark tests](https://platform.claude.com/docs/en/test-and-evaluate/develop-tests) specific to your use case - having a good evaluation set is the most important step in the process 2. Test with your actual prompts and data 3. Compare performance across models for: * Accuracy of responses * Response quality * Handling of edge cases 4. Weigh performance and cost tradeoffs Next steps ---------------- [Model comparison chart\ \ See detailed specifications and pricing for the latest Claude models](https://platform.claude.com/docs/en/about-claude/models/overview) [What's new in Claude 4.6\ \ Explore the latest improvements in Claude 4.6 models](https://platform.claude.com/docs/en/about-claude/models/whats-new-claude-4-6) [Start building\ \ Get started with your first API call](https://platform.claude.com/docs/en/get-started) Was this page helpful? --- # Agent Skills - Claude API Docs Loading... Skills Overview Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page This feature is **not** eligible for [Zero Data Retention (ZDR)](https://platform.claude.com/docs/en/build-with-claude/api-and-data-retention) . Data is retained according to the feature's standard retention policy. Why use Skills -------------------- Skills are reusable, filesystem-based resources that provide Claude with domain-specific expertise: workflows, context, and best practices that transform general-purpose agents into specialists. Unlike prompts (conversation-level instructions for one-off tasks), Skills load on-demand and eliminate the need to repeatedly provide the same guidance across multiple conversations. **Key benefits**: * **Specialize Claude**: Tailor capabilities for domain-specific tasks * **Reduce repetition**: Create once, use automatically * **Compose capabilities**: Combine Skills to build complex workflows For a deep dive into the architecture and real-world applications of Agent Skills, read our engineering blog: [Equipping agents for the real world with Agent Skills](https://www.anthropic.com/engineering/equipping-agents-for-the-real-world-with-agent-skills) . Using Skills ------------------ Anthropic provides pre-built Agent Skills for common document tasks (PowerPoint, Excel, Word, PDF), and you can create your own custom Skills. Both work the same way. Claude automatically uses them when relevant to your request. **Pre-built Agent Skills** are available to all users on claude.ai and via the Claude API. See the [Available Skills](https://platform.claude.com/docs/en/agents-and-tools/agent-skills/overview#available-skills) section below for the complete list. **Custom Skills** let you package domain expertise and organizational knowledge. They're available across Claude's products: create them in Claude Code, upload them via the API, or add them in claude.ai settings. **Get started:** * For pre-built Agent Skills: See the [quickstart tutorial](https://platform.claude.com/docs/en/agents-and-tools/agent-skills/quickstart) to start using PowerPoint, Excel, Word, and PDF skills in the API * For custom Skills: See the [Agent Skills Cookbook](https://platform.claude.com/cookbook/skills-notebooks-01-skills-introduction) to learn how to create your own Skills How Skills work --------------------- Skills leverage Claude's VM environment to provide capabilities beyond what's possible with prompts alone. Claude operates in a virtual machine with filesystem access, allowing Skills to exist as directories containing instructions, executable code, and reference materials, organized like an onboarding guide you'd create for a new team member. This filesystem-based architecture enables **progressive disclosure**: Claude loads information in stages as needed, rather than consuming context upfront. ### Three types of Skill content, three levels of loading Skills can contain three types of content, each loaded at different times: ### Level 1: Metadata (always loaded) **Content type: Instructions**. The Skill's YAML frontmatter provides discovery information: --- name: pdf-processing description: Extract text and tables from PDF files, fill forms, merge documents. Use when working with PDF files or when the user mentions PDFs, forms, or document extraction. --- Claude loads this metadata at startup and includes it in the system prompt. This lightweight approach means you can install many Skills without context penalty; Claude only knows each Skill exists and when to use it. ### Level 2: Instructions (loaded when triggered) **Content type: Instructions**. The main body of SKILL.md contains procedural knowledge: workflows, best practices, and guidance: # PDF Processing ## Quick start Use pdfplumber to extract text from PDFs: ```python import pdfplumber with pdfplumber.open("document.pdf") as pdf: text = pdf.pages[0].extract_text() ``` For advanced form filling, see [FORMS.md](FORMS.md). When you request something that matches a Skill's description, Claude reads SKILL.md from the filesystem via bash. Only then does this content enter the context window. ### Level 3: Resources and code (loaded as needed) **Content types: Instructions, code, and resources**. Skills can bundle additional materials: pdf-skill/ ├── SKILL.md (main instructions) ├── FORMS.md (form-filling guide) ├── REFERENCE.md (detailed API reference) └── scripts/ └── fill_form.py (utility script) **Instructions**: Additional markdown files (FORMS.md, REFERENCE.md) containing specialized guidance and workflows **Code**: Executable scripts (fill\_form.py, validate.py) that Claude runs via bash; scripts provide deterministic operations without consuming context **Resources**: Reference materials like database schemas, API documentation, templates, or examples Claude accesses these files only when referenced. The filesystem model means each content type has different strengths: instructions for flexible guidance, code for reliability, resources for factual lookup. | Level | When Loaded | Token Cost | Content | | --- | --- | --- | --- | | **Level 1: Metadata** | Always (at startup) | ~100 tokens per Skill | `name` and `description` from YAML frontmatter | | **Level 2: Instructions** | When Skill is triggered | Under 5k tokens | SKILL.md body with instructions and guidance | | **Level 3+: Resources** | As needed | Effectively unlimited | Bundled files executed via bash without loading contents into context | Progressive disclosure ensures only relevant content occupies the context window at any given time. ### The Skills architecture Skills run in a code execution environment where Claude has filesystem access, bash commands, and code execution capabilities. Think of it like this: Skills exist as directories on a virtual machine, and Claude interacts with them using the same bash commands you'd use to navigate files on your computer. ![Agent Skills Architecture - showing how Skills integrate with the agent's configuration and virtual machine](https://platform.claude.com/docs/images/agent-skills-architecture.png) **How Claude accesses Skill content:** When a Skill is triggered, Claude uses bash to read SKILL.md from the filesystem, bringing its instructions into the context window. If those instructions reference other files (like FORMS.md or a database schema), Claude reads those files too using additional bash commands. When instructions mention executable scripts, Claude runs them via bash and receives only the output (the script code itself never enters context). **What this architecture enables:** **On-demand file access**: Claude reads only the files needed for each specific task. A Skill can include dozens of reference files, but if your task only needs the sales schema, Claude loads just that one file. The rest remain on the filesystem consuming zero tokens. **Efficient script execution**: When Claude runs `validate_form.py`, the script's code never loads into the context window. Only the script's output (like "Validation passed" or specific error messages) consumes tokens. This makes scripts far more efficient than having Claude generate equivalent code on the fly. **No practical limit on bundled content**: Because files don't consume context until accessed, Skills can include comprehensive API documentation, large datasets, extensive examples, or any reference materials you need. There's no context penalty for bundled content that isn't used. This filesystem-based model is what makes progressive disclosure work. Claude navigates your Skill like you'd reference specific sections of an onboarding guide, accessing exactly what each task requires. ### Example: Loading a PDF processing skill Here's how Claude loads and uses a PDF processing skill: 1. **Startup**: System prompt includes: `PDF Processing - Extract text and tables from PDF files, fill forms, merge documents` 2. **User request**: "Extract the text from this PDF and summarize it" 3. **Claude invokes**: `bash: read pdf-skill/SKILL.md` → Instructions loaded into context 4. **Claude determines**: Form filling is not needed, so FORMS.md is not read 5. **Claude executes**: Uses instructions from SKILL.md to complete the task ![Skills loading into context window - showing the progressive loading of skill metadata and content](https://platform.claude.com/docs/images/agent-skills-context-window.png) The diagram shows: 1. Default state with system prompt and skill metadata pre-loaded 2. Claude triggers the skill by reading SKILL.md via bash 3. Claude optionally reads additional bundled files like FORMS.md as needed 4. Claude proceeds with the task This dynamic loading ensures only relevant skill content occupies the context window. Where Skills work ----------------------- Skills are available across Claude's agent products: ### Claude API The Claude API supports both pre-built Agent Skills and custom Skills. Both work identically: specify the relevant `skill_id` in the `container` parameter along with the code execution tool. **Prerequisites**: Using Skills via the API requires three beta headers: * `code-execution-2025-08-25` - Skills run in the code execution container * `skills-2025-10-02` - Enables Skills functionality * `files-api-2025-04-14` - Required for uploading/downloading files to/from the container Use pre-built Agent Skills by referencing their `skill_id` (for example, `pptx`, `xlsx`), or create and upload your own via the Skills API (`/v1/skills` endpoints). Custom Skills are shared organization-wide. To learn more, see [Use Skills with the Claude API](https://platform.claude.com/docs/en/build-with-claude/skills-guide) . ### Claude Code [Claude Code](https://code.claude.com/docs/en/overview) supports only Custom Skills. **Custom Skills**: Create Skills as directories with SKILL.md files. Claude discovers and uses them automatically. Custom Skills in Claude Code are filesystem-based and don't require API uploads. To learn more, see [Use Skills in Claude Code](https://code.claude.com/docs/en/skills) . ### Claude.ai [Claude.ai](https://claude.ai/) supports both pre-built Agent Skills and custom Skills. **Pre-built Agent Skills**: These Skills are already working behind the scenes when you create documents. Claude uses them without requiring any setup. **Custom Skills**: Upload your own Skills as zip files through Settings > Features. Available on Pro, Max, Team, and Enterprise plans with code execution enabled. Custom Skills are individual to each user; they are not shared organization-wide and cannot be centrally managed by admins. To learn more about using Skills in Claude.ai, see the following resources in the Claude Help Center: * [What are Skills?](https://support.claude.com/en/articles/12512176-what-are-skills) * [Using Skills in Claude](https://support.claude.com/en/articles/12512180-using-skills-in-claude) * [How to create custom Skills](https://support.claude.com/en/articles/12512198-creating-custom-skills) * [Teach Claude your way of working using Skills](https://support.claude.com/en/articles/12580051-teach-claude-your-way-of-working-using-skills) Skill structure --------------------- Every Skill requires a `SKILL.md` file with YAML frontmatter: --- name: your-skill-name description: Brief description of what this Skill does and when to use it --- # Your Skill Name ## Instructions [Clear, step-by-step guidance for Claude to follow] ## Examples [Concrete examples of using this Skill] **Required fields**: `name` and `description` **Field requirements**: `name`: * Maximum 64 characters * Must contain only lowercase letters, numbers, and hyphens * Cannot contain XML tags * Cannot contain reserved words: "anthropic", "claude" `description`: * Must be non-empty * Maximum 1024 characters * Cannot contain XML tags The `description` should include both what the Skill does and when Claude should use it. For complete authoring guidance, see the [best practices guide](https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices) . Security considerations ----------------------------- We strongly recommend using Skills only from trusted sources: those you created yourself or obtained from Anthropic. Skills provide Claude with new capabilities through instructions and code, and while this makes them powerful, it also means a malicious Skill can direct Claude to invoke tools or execute code in ways that don't match the Skill's stated purpose. If you must use a Skill from an untrusted or unknown source, exercise extreme caution and thoroughly audit it before use. Depending on what access Claude has when executing the Skill, malicious Skills could lead to data exfiltration, unauthorized system access, or other security risks. **Key security considerations**: * **Audit thoroughly**: Review all files bundled in the Skill: SKILL.md, scripts, images, and other resources. Look for unusual patterns like unexpected network calls, file access patterns, or operations that don't match the Skill's stated purpose * **External sources are risky**: Skills that fetch data from external URLs pose particular risk, as fetched content may contain malicious instructions. Even trustworthy Skills can be compromised if their external dependencies change over time * **Tool misuse**: Malicious Skills can invoke tools (file operations, bash commands, code execution) in harmful ways * **Data exposure**: Skills with access to sensitive data could be designed to leak information to external systems * **Treat like installing software**: Only use Skills from trusted sources. Be especially careful when integrating Skills into production systems with access to sensitive data or critical operations Available Skills ---------------------- ### Pre-built Agent Skills The following pre-built Agent Skills are available for immediate use: * **PowerPoint (pptx)**: Create presentations, edit slides, analyze presentation content * **Excel (xlsx)**: Create spreadsheets, analyze data, generate reports with charts * **Word (docx)**: Create documents, edit content, format text * **PDF (pdf)**: Generate formatted PDF documents and reports These Skills are available on the Claude API and claude.ai. See the [quickstart tutorial](https://platform.claude.com/docs/en/agents-and-tools/agent-skills/quickstart) to start using them in the API. ### Open-source Skills Anthropic also publishes open-source Skills in the [skills repository](https://github.com/anthropics/skills) : * **[Claude API](https://platform.claude.com/docs/en/agents-and-tools/agent-skills/claude-api-skill) **: Provides Claude with up-to-date API reference material, SDK documentation, and best practices for 8 programming languages. Bundled with Claude Code and also available for installation from the skills repository. ### Custom Skills examples For complete examples of custom Skills, see the [Skills cookbook](https://platform.claude.com/cookbook/skills-notebooks-01-skills-introduction) . Data retention -------------------- Agent Skills is not covered by ZDR arrangements. Skill definitions and execution data are retained according to Anthropic's standard data retention policy. For ZDR eligibility across all features, see [API and data retention](https://platform.claude.com/docs/en/build-with-claude/api-and-data-retention) . Limitations and constraints --------------------------------- Understanding these limitations helps you plan your Skills deployment effectively. ### Cross-surface availability **Custom Skills do not sync across surfaces**. Skills uploaded to one surface are not automatically available on others: * Skills uploaded to Claude.ai must be separately uploaded to the API * Skills uploaded via the API are not available on Claude.ai * Claude Code Skills are filesystem-based and separate from both Claude.ai and API You'll need to manage and upload Skills separately for each surface where you want to use them. ### Sharing scope Skills have different sharing models depending on where you use them: * **Claude.ai**: Individual user only; each team member must upload separately * **Claude API**: Workspace-wide; all workspace members can access uploaded Skills * **Claude Code**: Personal (`~/.claude/skills/`) or project-based (`.claude/skills/`); can also be shared via Claude Code Plugins Claude.ai does not currently support centralized admin management or org-wide distribution of custom Skills. ### Runtime environment constraints The exact runtime environment available to your skill depends on the product surface where you use it. * **Claude.ai**: * **Varying network access**: Depending on user/admin settings, Skills may have full, partial, or no network access. For more details, see the [Create and Edit Files](https://support.claude.com/en/articles/12111783-create-and-edit-files-with-claude#h_6b7e833898) support article. * **Claude API**: * **No network access**: Skills cannot make external API calls or access the internet * **No runtime package installation**: Only pre-installed packages are available. You cannot install new packages during execution. * **Pre-configured dependencies only**: Check the [code execution tool documentation](https://platform.claude.com/docs/en/agents-and-tools/tool-use/code-execution-tool) for the list of available packages * **Claude Code**: * **Full network access**: Skills have the same network access as any other program on the user's computer Plan your Skills to work within these constraints. Next steps ---------------- [Get started with Agent Skills\ \ Create your first Skill](https://platform.claude.com/docs/en/agents-and-tools/agent-skills/quickstart) [API Guide\ \ Use Skills with the Claude API](https://platform.claude.com/docs/en/build-with-claude/skills-guide) [](https://code.claude.com/docs/en/skills) Was this page helpful? * **Global package installation discouraged**: Skills should only install packages locally in order to avoid interfering with the user's computer Use Skills in Claude Code Create and manage custom Skills in Claude Code [Authoring best practices\ \ Write Skills that Claude can use effectively](https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices) --- # Guides to common use cases - Claude API Docs Loading... Use cases Overview Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Claude is designed to excel in a variety of tasks. Explore these in-depth production guides to learn how to build common use cases with Claude. [Ticket routing\ \ Best practices for using Claude to classify and route customer support tickets at scale.](https://platform.claude.com/docs/en/about-claude/use-case-guides/ticket-routing) [Customer support agent\ \ Build intelligent, context-aware chatbots with Claude to enhance customer support interactions.](https://platform.claude.com/docs/en/about-claude/use-case-guides/customer-support-chat) [Content moderation\ \ Techniques and best practices for using Claude to perform content filtering and general content moderation.](https://platform.claude.com/docs/en/about-claude/use-case-guides/content-moderation) [Legal summarization\ \ Summarize legal documents using Claude to extract key information and expedite research.](https://platform.claude.com/docs/en/about-claude/use-case-guides/legal-summarization) Was this page helpful? --- # Claude Code Analytics API - Claude API Docs Loading... Monitoring Claude Code Analytics API Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Was this page helpful? **The Admin API is unavailable for individual accounts.** To collaborate with teammates and add members, set up your organization in **Console → Settings → Organization**. The Claude Code Analytics Admin API provides programmatic access to daily aggregated usage metrics for Claude Code users, enabling organizations to analyze developer productivity and build custom dashboards. This API bridges the gap between our basic [Analytics dashboard](https://platform.claude.com/claude-code) and the complex OpenTelemetry integration. This API enables you to better monitor, analyze, and optimize your Claude Code adoption: * **Developer Productivity Analysis:** Track sessions, lines of code added/removed, commits, and pull requests created using Claude Code * **Tool Usage Metrics:** Monitor acceptance and rejection rates for different Claude Code tools (Edit, Write, NotebookEdit) * **Cost Analysis:** View estimated costs and token usage broken down by Claude model * **Custom Reporting:** Export data to build executive dashboards and reports for management teams * **Usage Justification:** Provide metrics to justify and expand Claude Code adoption internally **Admin API key required** This API is part of the [Admin API](https://platform.claude.com/docs/en/build-with-claude/administration-api) . These endpoints require an Admin API key (starting with `sk-ant-admin...`) that differs from standard API keys. Only organization members with the admin role can provision Admin API keys through the [Claude Console](https://platform.claude.com/settings/admin-keys) . Quick start ----------------- Get your organization's Claude Code analytics for a specific day: curl "https://api.anthropic.com/v1/organizations/usage_report/claude_code?\ starting_at=2025-09-08&\ limit=20" \ --header "anthropic-version: 2023-06-01" \ --header "x-api-key: $ADMIN_API_KEY" **Set a User-Agent header for integrations** If you're building an integration, set your User-Agent header to help us understand usage patterns: User-Agent: YourApp/1.0.0 (https://yourapp.com) Claude Code Analytics API ------------------------------- Track Claude Code usage, productivity metrics, and developer activity across your organization with the `/v1/organizations/usage_report/claude_code` endpoint. ### Key concepts * **Daily aggregation**: Returns metrics for a single day specified by the `starting_at` parameter * **User-level data**: Each record represents one user's activity for the specified day * **Productivity metrics**: Track sessions, lines of code, commits, pull requests, and tool usage * **Token and cost data**: Monitor usage and estimated costs broken down by Claude model * **Cursor-based pagination**: Handle large datasets with stable pagination using opaque cursors * **Data freshness**: Metrics are available with up to 1-hour delay for consistency For complete parameter details and response schemas, see the [Claude Code Analytics API reference](https://platform.claude.com/docs/en/api/admin-api/claude-code/get-claude-code-usage-report) . ### Basic examples #### Get analytics for a specific day curl "https://api.anthropic.com/v1/organizations/usage_report/claude_code?\ starting_at=2025-09-08" \ --header "anthropic-version: 2023-06-01" \ --header "x-api-key: $ADMIN_API_KEY" #### Get analytics with pagination # First request curl "https://api.anthropic.com/v1/organizations/usage_report/claude_code?\ starting_at=2025-09-08&\ limit=20" \ --header "anthropic-version: 2023-06-01" \ --header "x-api-key: $ADMIN_API_KEY" # Subsequent request using cursor from response curl "https://api.anthropic.com/v1/organizations/usage_report/claude_code?\ starting_at=2025-09-08&\ page=page_MjAyNS0wNS0xNFQwMDowMDowMFo=" \ --header "anthropic-version: 2023-06-01" \ --header "x-api-key: $ADMIN_API_KEY" ### Request parameters | Parameter | Type | Required | Description | | --- | --- | --- | --- | | `starting_at` | string | Yes | UTC date in YYYY-MM-DD format. Returns metrics for this single day only | | `limit` | integer | No | Number of records per page (default: 20, max: 1000) | | `page` | string | No | Opaque cursor token from previous response's `next_page` field | ### Available metrics Each response record contains the following metrics for a single user on a single day: #### Dimensions * **date**: Date in RFC 3339 format (UTC timestamp) * **actor**: The user or API key that performed the Claude Code actions (either `user_actor` with `email_address` or `api_actor` with `api_key_name`) * **organization\_id**: Organization UUID * **customer\_type**: Type of customer account (`api` for API customers, `subscription` for Pro/Team customers) * **terminal\_type**: Type of terminal or environment where Claude Code was used (e.g., `vscode`, `iTerm.app`, `tmux`) #### Core metrics * **num\_sessions**: Number of distinct Claude Code sessions initiated by this actor * **lines\_of\_code.added**: Total number of lines of code added across all files by Claude Code * **lines\_of\_code.removed**: Total number of lines of code removed across all files by Claude Code * **commits\_by\_claude\_code**: Number of git commits created through Claude Code's commit functionality * **pull\_requests\_by\_claude\_code**: Number of pull requests created through Claude Code's PR functionality #### Tool action metrics Breakdown of tool action acceptance and rejection rates by tool type: * **edit\_tool.accepted/rejected**: Number of Edit tool proposals that the user accepted/rejected * **write\_tool.accepted/rejected**: Number of Write tool proposals that the user accepted/rejected * **notebook\_edit\_tool.accepted/rejected**: Number of NotebookEdit tool proposals that the user accepted/rejected #### Model breakdown For each Claude model used: * **model**: Claude model identifier (e.g., `claude-opus-4-6`) * **tokens.input/output**: Input and output token counts for this model * **tokens.cache\_read/cache\_creation**: Cache-related token usage for this model * **estimated\_cost.amount**: Estimated cost in cents USD for this model * **estimated\_cost.currency**: Currency code for the cost amount (currently always `USD`) ### Response structure The API returns data in the following format: { "data": [\ {\ "date": "2025-09-01T00:00:00Z",\ "actor": {\ "type": "user_actor",\ "email_address": "[email protected]"\ },\ "organization_id": "dc9f6c26-b22c-4831-8d01-0446bada88f1",\ "customer_type": "api",\ "terminal_type": "vscode",\ "core_metrics": {\ "num_sessions": 5,\ "lines_of_code": {\ "added": 1543,\ "removed": 892\ },\ "commits_by_claude_code": 12,\ "pull_requests_by_claude_code": 2\ },\ "tool_actions": {\ "edit_tool": {\ "accepted": 45,\ "rejected": 5\ },\ "multi_edit_tool": {\ "accepted": 12,\ "rejected": 2\ },\ "write_tool": {\ "accepted": 8,\ "rejected": 1\ },\ "notebook_edit_tool": {\ "accepted": 3,\ "rejected": 0\ }\ },\ "model_breakdown": [\ {\ "model": "claude-opus-4-6",\ "tokens": {\ "input": 100000,\ "output": 35000,\ "cache_read": 10000,\ "cache_creation": 5000\ },\ "estimated_cost": {\ "currency": "USD",\ "amount": 1025\ }\ }\ ]\ }\ ], "has_more": false, "next_page": null } Pagination ---------------- The API supports cursor-based pagination for organizations with large numbers of users: 1. Make your initial request with optional `limit` parameter 2. If `has_more` is `true` in the response, use the `next_page` value in your next request 3. Continue until `has_more` is `false` The cursor encodes the position of the last record and ensures stable pagination even as new data arrives. Each pagination session maintains a consistent data boundary to ensure you don't miss or duplicate records. Common use cases ---------------------- * **Executive dashboards**: Create high-level reports showing Claude Code impact on development velocity * **AI tool comparison**: Export metrics to compare Claude Code with other AI coding tools like Copilot and Cursor * **Developer productivity analysis**: Track individual and team productivity metrics over time * **Cost tracking and allocation**: Monitor spending patterns and allocate costs by team or project * **Adoption monitoring**: Identify which teams and users are getting the most value from Claude Code * **ROI justification**: Provide concrete metrics to justify and expand Claude Code adoption internally Frequently asked questions -------------------------------- ### How fresh is the analytics data? Claude Code analytics data typically appears within 1 hour of user activity completion. To ensure consistent pagination results, only data older than 1 hour is included in responses. ### Can I get real-time metrics? No, this API provides daily aggregated metrics only. For real-time monitoring, consider using the [OpenTelemetry integration](https://code.claude.com/docs/en/monitoring-usage) . ### How are users identified in the data? Users are identified through the `actor` field in two ways: * **`user_actor`**: Contains `email_address` for users who authenticate via OAuth (most common) * **`api_actor`**: Contains `api_key_name` for users who authenticate via API key The `customer_type` field indicates whether the usage is from `api` customers (API PAYG) or `subscription` customers (Pro/Team plans). ### What's the data retention period? Historical Claude Code analytics data is retained and accessible through the API. There is no specified deletion period for this data. ### Which Claude Code deployments are supported? This API only tracks Claude Code usage on the Claude API (1st party). Usage on Amazon Bedrock, Google Vertex AI, or other third-party platforms is not included. ### What does it cost to use this API? The Claude Code Analytics API is free to use for all organizations with access to the Admin API. ### How do I calculate tool acceptance rates? Tool acceptance rate = `accepted / (accepted + rejected)` for each tool type. For example, if the edit tool shows 45 accepted and 5 rejected, the acceptance rate is 90%. ### What time zone is used for the date parameter? All dates are in UTC. The `starting_at` parameter should be in YYYY-MM-DD format and represents UTC midnight for that day. See also -------------- The Claude Code Analytics API helps you understand and optimize your team's development workflow. Learn more about related features: * [Admin API overview](https://platform.claude.com/docs/en/build-with-claude/administration-api) * [Admin API reference](https://platform.claude.com/docs/en/api/admin) * [Claude Code Analytics dashboard](https://platform.claude.com/claude-code) * [Usage and Cost API](https://platform.claude.com/docs/en/build-with-claude/usage-cost-api) - Track API usage across all Anthropic services * [Identity and access management](https://code.claude.com/docs/en/iam) * [Monitoring usage with OpenTelemetry](https://code.claude.com/docs/en/monitoring-usage) for custom metrics and alerting --- # Session tracing - Claude API Docs Loading... Monitoring Session tracing Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Claude Managed Agents provides observability tools in the [Claude Console](https://platform.claude.com/) to help you monitor, debug, and understand your agent sessions. Console observability --------------------------- The Console provides a visual timeline view of your agent sessions. Navigate to the Claude Managed Agents section in the Console to see: * **Session list** - All sessions with their status, creation time, and model * **Tracing view** - A chronological view of events (content, timestamps, token usage) within a session. These are only accessible to Developers and Admins. * **Tool execution** - Details of each tool call and its result Raw events ---------------- For programmatic debugging, retrieve raw events via the API: curl curl -fsSL "https://api.anthropic.com/v1/sessions/$SESSION_ID/events" \ -H "x-api-key: $ANTHROPIC_API_KEY" \ -H "anthropic-version: 2023-06-01" \ -H "anthropic-beta: managed-agents-2026-04-01" \ | jq -r ' .data[] | "Type: \(.type)", "Processed: \(.processed_at)", ( if .type | IN("user.message", "agent.message") then .content[] | " Block: \(.type)", (select(.type == "text") | " Text: \(.text[:100])...") elif .type | IN("agent.tool_use", "agent.custom_tool_use", "agent.mcp_tool_use") then " Tool: \(.name)" else empty end ), "---" ' Use the same event stream to surface errors and track token consumption: curl curl -fsSL "https://api.anthropic.com/v1/sessions/$SESSION_ID/events" \ -H "x-api-key: $ANTHROPIC_API_KEY" \ -H "anthropic-version: 2023-06-01" \ -H "anthropic-beta: managed-agents-2026-04-01" \ | jq -r ' (.data[] | select(.type == "session.error") | "[\(.error.type)] \(.error.message)"), (reduce (.data[] | select(.type == "span.model_request_end") | .model_usage) as $u ({input: 0, output: 0}; .input += $u.input_tokens | .output += $u.output_tokens) | "Total input tokens: \(.input), output tokens: \(.output)") ' Debugging tips -------------------- * **Check session events** - Session errors are conveyed through the `session.error` event * **Review tool results** - Tool execution failures often explain unexpected agent behavior * **Track token usage** - Monitor token consumption to optimize prompts and reduce costs * **Use system prompts** - Add logging instructions to the system prompt to make the agent explain its reasoning Was this page helpful? --- # Documentation - Claude API Docs Loading... Models Model cards Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Model cards --------------- [Claude Opus 4.6 System Card\ \ Detailed documentation of Claude Opus 4.6.](https://www.anthropic.com/claude-opus-4-6-system-card) [Claude Sonnet 4.6 System Card\ \ Detailed documentation of Claude Sonnet 4.6.](https://www.anthropic.com/claude-sonnet-4-6-system-card) [Claude Opus 4.5 System Card\ \ Detailed documentation of Claude Opus 4.5.](https://www.anthropic.com/claude-opus-4-5-system-card) [Claude Haiku 4.5 System Card\ \ Detailed documentation of Claude Haiku 4.5.](https://www.anthropic.com/claude-haiku-4-5-system-card) [Claude Sonnet 4.5 System Card\ \ Detailed documentation of Claude Sonnet 4.5.](https://www.anthropic.com/claude-sonnet-4-5-system-card) [Claude Opus 4.1 System Card\ \ Detailed documentation of Claude Opus 4.1.](https://www.anthropic.com/claude-opus-4-1-system-card) [Claude 4 System Card\ \ Detailed documentation of Claude 4 models.](https://www-cdn.anthropic.com/6be99a52cb68eb70eb9572b4cafad13df32ed995.pdf) [Claude Sonnet 3.7 System Card\ \ System card for Claude Sonnet 3.7 with performance and safety details.](https://anthropic.com/claude-3-7-sonnet-system-card) [Claude 3 Model Card\ \ Detailed documentation of Claude 3 models including latest 3.5 addendum.](https://assets.anthropic.com/m/61e7d27f8c8f5919/original/Claude-3-Model-Card.pdf) Learning resources ---------------------- [Quickstarts\ \ Deployable applications built with the API.](https://github.com/anthropics/anthropic-quickstarts) [](https://anthropic.skilljar.com/) Resources for AI ingestion ------------------------------ [](https://platform.claude.com/docs/en/claude_api_primer) Courses Step by step lessons on building with Claude. [Cookbook\ \ Replicable code samples and implementations.](https://platform.claude.com/cookbooks) [Use case guides\ \ In-depth production guides for building common use cases with Claude.](https://platform.claude.com/docs/en/about-claude/use-case-guides/overview) [Glossary\ \ Key terms and concepts for working with Claude and language models.](https://platform.claude.com/docs/en/about-claude/glossary) API primer for Claude ingestion Concise API guide meant for ingestion by Claude. [Claude API Docs Overview\ \ Concise overview of Claude API documentation, optimized for LLM ingestion.](https://platform.claude.com/docs/for-claude) [llms.txt\ \ LLM-optimized documentation index.](https://platform.claude.com/llms.txt) --- # Glossary - Claude API Docs Loading... Resources Glossary Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Context window -------------------- The "context window" refers to the amount of text a language model can look back on and reference when generating new text. This is different from the large corpus of data the language model was trained on, and instead represents a "working memory" for the model. A larger context window allows the model to understand and respond to more complex and lengthy prompts, while a smaller context window may limit the model's ability to handle longer prompts or maintain coherence over extended conversations. See our [guide to understanding context windows](https://platform.claude.com/docs/en/build-with-claude/context-windows) to learn more. Fine-tuning ----------------- Fine-tuning is the process of further training a pretrained language model using additional data. This causes the model to start representing and mimicking the patterns and characteristics of the fine-tuning dataset. Claude is not a bare language model; it has already been fine-tuned to be a helpful assistant. Our API does not currently offer fine-tuning, but please ask your Anthropic contact if you are interested in exploring this option. Fine-tuning can be useful for adapting a language model to a specific domain, task, or writing style, but it requires careful consideration of the fine-tuning data and the potential impact on the model's performance and biases. HHH --------- These three H's represent Anthropic's goals in ensuring that Claude is beneficial to society: * A **helpful** AI will attempt to perform the task or answer the question posed to the best of its abilities, providing relevant and useful information. * An **honest** AI will give accurate information, and not hallucinate or confabulate. It will acknowledge its limitations and uncertainties when appropriate. * A **harmless** AI will not be offensive or discriminatory, and when asked to aid in a dangerous or unethical act, the AI should politely refuse and explain why it cannot comply. Latency ------------- Latency, in the context of generative AI and large language models, refers to the time it takes for the model to respond to a given prompt. It is the delay between submitting a prompt and receiving the generated output. Lower latency indicates faster response times, which is crucial for real-time applications, chatbots, and interactive experiences. Factors that can affect latency include model size, hardware capabilities, network conditions, and the complexity of the prompt and the generated response. LLM --------- Large language models (LLMs) are AI language models with many parameters that are capable of performing a variety of surprisingly useful tasks. These models are trained on vast amounts of text data and can generate human-like text, answer questions, summarize information, and more. Claude is a conversational assistant based on a large language model that has been fine-tuned and trained using RLHF to be more helpful, honest, and harmless. MCP (Model Context Protocol) ---------------------------------- Model Context Protocol (MCP) is an open protocol that standardizes how applications provide context to LLMs. Like a USB-C port for AI applications, MCP provides a unified way to connect AI models to different data sources and tools. MCP enables AI systems to maintain consistent context across interactions and access external resources in a standardized manner. See our [MCP documentation](https://platform.claude.com/docs/en/mcp) to learn more. MCP connector ------------------- The MCP connector is a feature that allows API users to connect to MCP servers directly from the Messages API without building an MCP client. This enables seamless integration with MCP-compatible tools and services through the Claude API. The MCP connector supports features like tool calling and is available in beta. See the [MCP connector documentation](https://platform.claude.com/docs/en/agents-and-tools/mcp-connector) to learn more. Pretraining ----------------- Pretraining is the initial process of training language models on a large unlabeled corpus of text. In Claude's case, autoregressive language models (like Claude's underlying model) are pretrained to predict the next word, given the previous context of text in the document. These pretrained models are not inherently good at answering questions or following instructions, and often require deep skill in prompt engineering to elicit desired behaviors. Fine-tuning and RLHF are used to refine these pretrained models, making them more useful for a wide range of tasks. RAG (Retrieval augmented generation) ------------------------------------------ Retrieval augmented generation (RAG) is a technique that combines information retrieval with language model generation to improve the accuracy and relevance of the generated text, and to better ground the model's response in evidence. In RAG, a language model is augmented with an external knowledge base or a set of documents that is passed into the context window. The data is retrieved at run time when a query is sent to the model, although the model itself does not necessarily retrieve the data (but can with [tool use](https://platform.claude.com/docs/en/agents-and-tools/tool-use/overview) and a retrieval function). When generating text, relevant information first must be retrieved from the knowledge base based on the input prompt, and then passed to the model along with the original query. The model uses this information to guide the output it generates. This allows the model to access and utilize information beyond its training data, reducing the reliance on memorization and improving the factual accuracy of the generated text. RAG can be particularly useful for tasks that require up-to-date information, domain-specific knowledge, or explicit citation of sources. However, the effectiveness of RAG depends on the quality and relevance of the external knowledge base and the knowledge that is retrieved at runtime. RLHF ---------- Reinforcement Learning from Human Feedback (RLHF) is a technique used to train a pretrained language model to behave in ways that are consistent with human preferences. This can include helping the model follow instructions more effectively or act more like a chatbot. Human feedback consists of ranking a set of two or more example texts, and the reinforcement learning process encourages the model to prefer outputs that are similar to the higher-ranked ones. Claude has been trained using RLHF to be a more helpful assistant. For more details, you can read [Anthropic's paper on the subject](https://arxiv.org/abs/2204.05862) . Temperature ----------------- Temperature is a parameter that controls the randomness of a model's predictions during text generation. Higher temperatures lead to more creative and diverse outputs, allowing for multiple variations in phrasing and, in the case of fiction, variation in answers as well. Lower temperatures result in more conservative and deterministic outputs that stick to the most probable phrasing and answers. Adjusting the temperature enables users to encourage a language model to explore rare, uncommon, or surprising word choices and sequences, rather than only selecting the most likely predictions. Users may encounter non-determinism in APIs. Even with temperature set to 0, the results will not be fully deterministic and identical inputs may produce different outputs across API calls. This applies both to Anthropic's first-party inference service and to inference through third-party cloud providers. TTFT (Time to first token) -------------------------------- Time to First Token (TTFT) is a performance metric that measures the time it takes for a language model to generate the first token of its output after receiving a prompt. It is an important indicator of the model's responsiveness and is particularly relevant for interactive applications, chatbots, and real-time systems where users expect quick initial feedback. A lower TTFT indicates that the model can start generating a response faster, providing a more seamless and engaging user experience. Factors that can influence TTFT include model size, hardware capabilities, network conditions, and the complexity of the prompt. Tokens ------------ Tokens are the smallest individual units of a language model, and can correspond to words, subwords, characters, or even bytes (in the case of Unicode). For Claude, a token approximately represents 3.5 English characters, though the exact number can vary depending on the language used. Tokens are typically hidden when interacting with language models at the "text" level but become relevant when examining the exact inputs and outputs of a language model. When Claude is provided with text to evaluate, the text (consisting of a series of characters) is encoded into a series of tokens for the model to process. Larger tokens enable data efficiency during inference and pretraining (and are utilized when possible), while smaller tokens allow a model to handle uncommon or never-before-seen words. The choice of tokenization method can impact the model's performance, vocabulary size, and ability to handle out-of-vocabulary words. Was this page helpful? --- # Define success criteria and build evaluations - Claude API Docs Loading... Test and evaluate Define success and build evaluations Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Building a successful LLM-based application starts with clearly defining your success criteria and then designing evaluations to measure performance against them. This cycle is central to prompt engineering. ![Flowchart of prompt engineering: test cases, preliminary prompt, iterative testing and refinement, final validation, ship](https://platform.claude.com/docs/images/how-to-prompt-eng.png) Define your success criteria ---------------------------------- Good success criteria are: * **Specific:** Clearly define what you want to achieve. Instead of "good performance," specify "accurate sentiment classification." * **Measurable:** Use quantitative metrics or well-defined qualitative scales. Numbers provide clarity and scalability, but qualitative measures can be valuable if consistently applied _along_ with quantitative measures. * Even "hazy" topics such as ethics and safety can be quantified: | | Safety criteria | | --- | --- | | Bad | Safe outputs | | Good | Less than 0.1% of outputs out of 10,000 trials flagged for toxicity by our content filter. | ### Example metrics and measurement methods * **Achievable:** Base your targets on industry benchmarks, prior experiments, AI research, or expert knowledge. Your success metrics should not be unrealistic to current frontier model capabilities. * **Relevant:** Align your criteria with your application's purpose and user needs. Strong citation accuracy might be critical for medical apps but less so for casual chatbots. ### Example task fidelity criteria for sentiment analysis ### Common success criteria Here are some criteria that might be important for your use case. This list is non-exhaustive. ### Task fidelity ### Consistency ### Relevance and coherence ### Tone and style ### Privacy preservation ### Context utilization ### Latency ### Price Most use cases will need multidimensional evaluation along several success criteria. ### Example multidimensional criteria for sentiment analysis * * * Build evaluations ----------------------- ### Eval design principles 1. **Be task-specific:** Design evals that mirror your real-world task distribution. Don't forget to factor in edge cases! ### Example edge cases 2. **Automate when possible:** Structure questions to allow for automated grading (e.g., multiple-choice, string match, code-graded, LLM-graded). 3. **Prioritize volume over quality:** More questions with slightly lower signal automated grading is better than fewer questions with high-quality human hand-graded evals. ### Example evals ### Task fidelity (sentiment analysis) - exact match evaluation Writing hundreds of test cases can be hard to do by hand! Get Claude to help you generate more from a baseline set of example test cases. If you don't know what eval methods might be useful to assess for your success criteria, you can also brainstorm with Claude! * * * Grade your evaluations ---------------------------- When deciding which method to use to grade evals, choose the fastest, most reliable, most scalable method: 1. **Code-based grading:** Fastest and most reliable, extremely scalable, but also lacks nuance for more complex judgements that require less rule-based rigidity. * Exact match: `output == golden_answer` * String match: `key_phrase in output` 2. **Human grading:** Most flexible and high quality, but slow and expensive. Avoid if possible. 3. **LLM-based grading:** Fast and flexible, scalable and suitable for complex judgement. Test to ensure reliability first then scale. ### Tips for LLM-based grading * **Have detailed, clear rubrics:** "The answer should always mention 'Acme Inc.' in the first sentence. If it does not, the answer is automatically graded as 'incorrect.'" A given use case, or even a specific success criteria for that use case, might require several rubrics for holistic evaluation. * **Empirical or specific:** For example, instruct the LLM to output only 'correct' or 'incorrect', or to judge from a scale of 1-5. Purely qualitative evaluations are hard to assess quickly and at scale. * **Encourage reasoning:** Ask the LLM to think first before deciding an evaluation score, and then discard the reasoning. This increases evaluation performance, particularly for tasks requiring complex judgement. ### Example: LLM-based grading Next steps ---------------- [Brainstorm criteria\ \ Brainstorm success criteria for your use case with Claude on claude.ai. \ \ **Tip**: Drop this page into the chat as guidance for Claude!](https://claude.ai/) [](https://platform.claude.com/cookbook/misc-building-evals) Was this page helpful? ### Consistency (FAQ bot) - cosine similarity evaluation ### Relevance and coherence (summarization) - ROUGE-L evaluation ### Tone and style (customer service) - LLM-based Likert scale ### Privacy preservation (medical chatbot) - LLM-based binary classification ### Context utilization (conversation assistant) - LLM-based ordinal scale Evals cookbook More code examples of human-, code-, and LLM-graded evals. --- # Models overview - Claude API Docs Loading... Models Models overview Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Choosing a model ---------------------- If you're unsure which model to use, consider starting with **Claude Opus 4.6** for the most complex tasks. It is the most intelligent broadly available model with exceptional performance in coding and reasoning. All current Claude models support text and image input, text output, multilingual capabilities, and vision. Models are available via the Claude API, AWS Bedrock, and Google Vertex AI. Once you've picked a model, [learn how to make your first API call](https://platform.claude.com/docs/en/get-started) . ### Latest models comparison | Feature | Claude Opus 4.6 | Claude Sonnet 4.6 | Claude Haiku 4.5 | | --- | --- | --- | --- | | **Description** | The most intelligent broadly available model for agents and coding | The best combination of speed and intelligence | The fastest model with near-frontier intelligence | | **Claude API ID** | claude-opus-4-6 | claude-sonnet-4-6 | claude-haiku-4-5-20251001 | | **Claude API alias** | claude-opus-4-6 | claude-sonnet-4-6 | claude-haiku-4-5 | | **AWS Bedrock ID** | anthropic.claude-opus-4-6-v1 | anthropic.claude-sonnet-4-6 | anthropic.claude-haiku-4-5-20251001-v1:0 | | **GCP Vertex AI ID** | claude-opus-4-6 | claude-sonnet-4-6 | claude-haiku-4-5@20251001 | | **Pricing**1 | $5 / input MTok
$25 / output MTok | $3 / input MTok
$15 / output MTok | $1 / input MTok
$5 / output MTok | | **[Extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking)
** | Yes | Yes | Yes | | **[Adaptive thinking](https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking)
** | Yes | Yes | No | | **[Priority Tier](https://platform.claude.com/docs/en/api/service-tiers)
** | Yes | Yes | Yes | | **Comparative latency** | Moderate | Fast | Fastest | | **Context window** | 1M tokens | 1M tokens | 200k tokens | | **Max output** | 128k tokens | 64k tokens | 64k tokens | | **Reliable knowledge cutoff** | May 20252 | Aug 20252 | Feb 2025 | | **Training data cutoff** | Aug 2025 | Jan 2026 | Jul 2025 | _1 - See the [pricing page](https://platform.claude.com/docs/en/about-claude/pricing) for complete pricing information including batch API discounts, prompt caching rates, extended thinking costs, and vision processing fees._ _2 - **Reliable knowledge cutoff** indicates the date through which a model's knowledge is most extensive and reliable. **Training data cutoff** is the broader date range of training data used. For more information, see [Anthropic's Transparency Hub](https://www.anthropic.com/transparency) ._ [Claude Mythos Preview](https://anthropic.com/glasswing) is offered separately as a research preview model for defensive cybersecurity workflows as part of [Project Glasswing](https://anthropic.com/glasswing) . Access is invitation-only and there is no self-serve sign-up. Models with the same snapshot date (e.g., 20240620) are identical across all platforms and do not change. The snapshot date in the model name ensures consistency and allows developers to rely on stable performance across different environments. Starting with **Claude Sonnet 4.5 and all subsequent models** (including Claude Sonnet 4.6), AWS Bedrock offers two endpoint types: **global endpoints** (dynamic routing for maximum availability) and **regional endpoints** (guaranteed data routing through specific geographic regions). Google Vertex AI offers three endpoint types: global endpoints, **multi-region endpoints** (dynamic routing within a geographic area), and regional endpoints. For more information, see the [third-party platform pricing section](https://platform.claude.com/docs/en/about-claude/pricing#third-party-platform-pricing) . You can query model capabilities and token limits programmatically with the [Models API](https://platform.claude.com/docs/en/api/models/list) . The response includes `max_input_tokens`, `max_tokens`, and a `capabilities` object for every available model. The Max output values above apply to the synchronous Messages API. On the [Message Batches API](https://platform.claude.com/docs/en/build-with-claude/batch-processing#extended-output-beta) , Opus 4.6 and Sonnet 4.6 support up to 300k output tokens by using the `output-300k-2026-03-24` beta header. ### Legacy models Prompt and output performance ----------------------------------- Claude 4 models excel in: * **Performance**: Top-tier results in reasoning, coding, multilingual tasks, long-context handling, honesty, and image processing. See the [Claude 4 blog post](http://www.anthropic.com/news/claude-4) for more information. * **Engaging responses**: Claude models are ideal for applications that require rich, human-like interactions. * If you prefer more concise responses, you can adjust your prompts to guide the model toward the desired output length. Refer to the [prompt engineering guides](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering) for details. * For prompting best practices, see the [prompting best practices guide](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices) . * **Output quality**: When migrating from previous model generations to Claude 4, you may notice larger improvements in overall performance. Migrating to Claude 4.6 ----------------------------- If you're currently using older Claude models, consider migrating to Claude Opus 4.6 to take advantage of improved intelligence and enhanced capabilities. For detailed migration instructions, see [Migrating to Claude 4.6](https://platform.claude.com/docs/en/about-claude/models/migration-guide) . Get started with Claude ----------------------------- If you're ready to start exploring what Claude can do for you, dive in! Whether you're a developer looking to integrate Claude into your applications or a user wanting to experience the power of AI firsthand, the following resources can help. Looking to chat with Claude? Visit [claude.ai](http://www.claude.ai/) ! [Intro to Claude\ \ Explore Claude's capabilities and development flow.](https://platform.claude.com/docs/en/intro) [Quickstart\ \ Learn how to make your first API call in minutes.](https://platform.claude.com/docs/en/get-started) [](https://platform.claude.com/) If you have any questions or need assistance, don't hesitate to reach out to the [support team](https://support.claude.com/) or consult the [Discord community](https://www.anthropic.com/discord) . Was this page helpful? Claude Console Craft and test powerful prompts directly in your browser. --- # Rate limits - Claude API Docs Loading... Support & configuration Rate limits Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page There are two types of limits: 1. **Spend limits** set a maximum monthly cost an organization can incur for API usage. 2. **Rate limits** set the maximum number of API requests an organization can make over a defined period of time. The API enforces service-configured limits at the organization level, but you may also set user-configurable limits for your organization's workspaces. These limits apply to both Standard and Priority Tier usage. For more information about Priority Tier, which offers enhanced service levels in exchange for committed spend, see [Service Tiers](https://platform.claude.com/docs/en/api/service-tiers) . About rate limits ----------------------- * Limits are designed to prevent API abuse, while minimizing impact on common customer usage patterns. * Limits are defined by **usage tier**, where each tier is associated with a different set of spend and rate limits. * Your organization will increase tiers automatically as you reach certain thresholds while using the API. Limits are set at the organization level. You can see your organization's limits on the [Limits](https://platform.claude.com/settings/limits) page in the [Claude Console](https://platform.claude.com/) . * You may hit rate limits over shorter time intervals. For instance, a rate of 60 requests per minute (RPM) may be enforced as 1 request per second. Short bursts of requests can exceed the limit and trigger rate limit errors. * The limits outlined below are the standard tier limits. If you're seeking higher, custom limits or Priority Tier for enhanced service levels, contact sales on the [Limits](https://platform.claude.com/settings/limits) page. * The API uses the [token bucket algorithm](https://en.wikipedia.org/wiki/Token_bucket) to do rate limiting. This means that your capacity is continuously replenished up to your maximum limit, rather than being reset at fixed intervals. * All limits described here represent maximum allowed usage, not guaranteed minimums. These limits are intended to reduce unintentional overspend and ensure fair distribution of resources among users. Spend limits ------------------ Each usage tier has a limit on how much you can spend on the API each calendar month. Once you reach the spend limit of your tier, until you qualify for the next tier, you will have to wait until the next month to be able to use the API again. To qualify for the next tier, you must meet a deposit requirement. To minimize the risk of overfunding your account, you cannot deposit more than your monthly spend limit. ### Requirements to advance tier | Usage Tier | Credit Purchase | Max Credit Purchase | Monthly Spend Limit | | --- | --- | --- | --- | | Tier 1 | $5 | $100 | $100 | | Tier 2 | $40 | $500 | $500 | | Tier 3 | $200 | $1,000 | $1,000 | | Tier 4 | $400 | $200,000 | $200,000 | | Monthly Invoicing | N/A | N/A | No limit | **Credit Purchase** shows the cumulative credit purchases (excluding tax) required to advance to that tier. You advance immediately upon reaching the threshold. **Max Credit Purchase** limits the maximum amount you can add to your account in a single transaction to prevent account overfunding. **Monthly Spend Limit** is the maximum you can spend on the API each calendar month at that tier. Increasing your spend limits ---------------------------------- Your organization has two kinds of spend limits: a customer-set limit you control directly, and a tier-enforced ceiling set by your usage tier. Each has a different process for increasing it. ### Customer-set spend limits You can set a spend limit lower than your tier's ceiling to control costs. To adjust it: 1. 1 Navigate to the Limits page Go to [Settings > Limits](https://platform.claude.com/settings/limits) in the Claude Console. 2. 2 Open the spend limit editor In the **Spend limits** section, click **Change Limit** (or **Set spend limit** if no limit is currently set). 3. 3 Adjust your spend limit Enter a new value. Your customer-set limit cannot exceed your current tier's limit. ### Tier-enforced spend limits When you need a limit higher than your tier's ceiling (Tier 4's ceiling is $200,000 per month), click **Contact Sales** on the [Limits](https://platform.claude.com/settings/limits) page. This opens the contact form in a new tab, and a member of the sales team will follow up by email when your organization is upgraded. Monthly Invoicing removes the monthly spend cap entirely and uses Net-30 payment terms by default. Support can also raise tier-enforced limits. For urgent needs, contact [support](https://support.anthropic.com/) . Rate limits ----------------- The rate limits for the Messages API are measured in requests per minute (RPM), input tokens per minute (ITPM), and output tokens per minute (OTPM) for each model class. If you exceed any of the rate limits you will get a [429 error](https://platform.claude.com/docs/en/api/errors) describing which rate limit was exceeded, along with a `retry-after` header indicating how long to wait. You might also encounter 429 errors due to acceleration limits on the API if your organization has a sharp increase in usage. To avoid hitting acceleration limits, ramp up your traffic gradually and maintain consistent usage patterns. ### Cache-aware ITPM Many API providers use a combined "tokens per minute" (TPM) limit that may include all tokens, both cached and uncached, input and output. **For most Claude models, only uncached input tokens count towards your ITPM rate limits.** This is a key advantage that makes the rate limits effectively higher than they might initially appear. ITPM rate limits are estimated at the beginning of each request, and the estimate is adjusted during the request to reflect the actual number of input tokens used. Here's what counts towards ITPM: * `input_tokens` (tokens after the last cache breakpoint) ✓ **Count towards ITPM** * `cache_creation_input_tokens` (tokens being written to cache) ✓ **Count towards ITPM** * `cache_read_input_tokens` (tokens read from cache) ✗ **Do NOT count towards ITPM** for most models The `input_tokens` field only represents tokens that appear **after your last cache breakpoint**, not all input tokens in your request. To calculate total input tokens: total_input_tokens = cache_read_input_tokens + cache_creation_input_tokens + input_tokens This means when you have cached content, `input_tokens` will typically be much smaller than your total input. For example, with a 200k token cached document and a 50 token user question, you'd see `input_tokens: 50` even though the total input is 200,050 tokens. For rate limit purposes on most models, only `input_tokens` + `cache_creation_input_tokens` count toward your ITPM limit, making [prompt caching](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) an effective way to increase your effective throughput. **Example**: With a 2,000,000 ITPM limit and an 80% cache hit rate, you could effectively process 10,000,000 total input tokens per minute (2M uncached + 8M cached), since cached tokens don't count towards your rate limit. Some older models (marked with † in the rate limit tables below) also count `cache_read_input_tokens` towards ITPM rate limits. For all models without the † marker, cached input tokens do not count towards rate limits and are billed at a reduced rate (10% of base input token price). This means you can achieve significantly higher effective throughput by using [prompt caching](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) . **Maximize your rate limits with prompt caching** To get the most out of your rate limits, use [prompt caching](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) for repeated content like: * System instructions and prompts * Large context documents * Tool definitions * Conversation history With effective caching, you can dramatically increase your actual throughput without increasing your rate limits. Monitor your cache hit rate on the [Usage page](https://platform.claude.com/usage) to optimize your caching strategy. OTPM rate limits are evaluated in real time as output tokens are produced, counting only the actual tokens generated. The `max_tokens` parameter does not factor into OTPM rate limit calculations, so there is no rate limit downside to setting a higher `max_tokens` value. Rate limits are applied separately for each model; therefore you can use different models up to their respective limits simultaneously. You can check your current rate limits and behavior in the [Claude Console](https://platform.claude.com/settings/limits) . Rate limits are currently shared across all `inference_geo` values. Requests with `inference_geo: "us"` and `inference_geo: "global"` draw from the same rate limit pool. _\* - Opus rate limit is a total limit that applies to combined traffic across Opus 4.6, Opus 4.5, Opus 4.1, and Opus 4._ _\*\* - Sonnet 4.x rate limit is a total limit that applies to combined traffic across Sonnet 4.6, Sonnet 4.5, and Sonnet 4._ _† - Limit counts `cache_read_input_tokens` towards ITPM usage._ ### Message Batches API The Message Batches API has its own set of rate limits which are shared across all models. These include a requests per minute (RPM) limit to all API endpoints and a limit on the number of batch requests that can be in the processing queue at the same time. A "batch request" here refers to part of a Message Batch. You may create a Message Batch containing thousands of batch requests, each of which count towards this limit. A batch request is considered part of the processing queue when it has yet to be successfully processed by the model. ### Managed Agents [Claude Managed Agents](https://platform.claude.com/docs/en/managed-agents/overview) endpoints are rate-limited per organization. These limits are separate from the Messages API rate limits above. | Operation | Limit | | --- | --- | | Create endpoints (agents, sessions, environments, etc.) | 60 requests per minute | | Read endpoints (retrieve, list, stream, etc.) | 600 requests per minute | ### Fast mode rate limits When using [fast mode](https://platform.claude.com/docs/en/build-with-claude/fast-mode) (beta: research preview) with `speed: "fast"` on Opus 4.6, dedicated rate limits apply that are separate from standard Opus rate limits. When fast mode rate limits are exceeded, the API returns a `429` error with a `retry-after` header. The response includes `anthropic-fast-*` headers that indicate your fast mode rate limit status. See the [fast mode documentation](https://platform.claude.com/docs/en/build-with-claude/fast-mode#rate-limits) for details on these headers. ### Monitoring your rate limits in the Console You can monitor your rate limit usage on the [Usage](https://platform.claude.com/usage) page of the [Claude Console](https://platform.claude.com/) . In addition to providing token and request charts, the Usage page provides two separate rate limit charts. Use these charts to see what headroom you have to grow, when you may be hitting peak use, better understand what rate limits to request, or how you can improve your caching rates. The charts visualize a number of metrics for a given rate limit (e.g. per model): * The **Rate Limit - Input Tokens** chart includes: * Hourly maximum uncached input tokens per minute * Your current input tokens per minute rate limit * The cache rate for your input tokens (i.e. the percentage of input tokens read from the cache) * The **Rate Limit - Output Tokens** chart includes: * Hourly maximum output tokens per minute * Your current output tokens per minute rate limit Setting lower limits for Workspaces ----------------------------------------- For more about workspaces, see [Workspaces](https://platform.claude.com/docs/en/build-with-claude/workspaces) . In order to protect Workspaces in your Organization from potential overuse, you can set custom spend and rate limits per Workspace. Example: If your Organization's limit is 40,000 input tokens per minute and 8,000 output tokens per minute, you might limit one Workspace to 30,000 total tokens per minute. This protects other Workspaces from potential overuse and ensures a more equitable distribution of resources across your Organization. The remaining unused tokens per minute (or more, if that Workspace doesn't use the limit) are then available for other Workspaces to use. Note: * You can't set limits on the default Workspace. * If not set, Workspace limits match the Organization's limit. * Organization-wide limits always apply, even if Workspace limits add up to more. * Support for input and output token limits will be added to Workspaces in the future. Response headers ---------------------- The API response includes headers that show you the rate limit enforced, current usage, and when the limit will be reset. The following headers are returned: | Header | Description | | --- | --- | | `retry-after` | The number of seconds to wait until you can retry the request. Earlier retries will fail. | | `anthropic-ratelimit-requests-limit` | The maximum number of requests allowed within any rate limit period. | | `anthropic-ratelimit-requests-remaining` | The number of requests remaining before being rate limited. | | `anthropic-ratelimit-requests-reset` | The time when the request rate limit will be fully replenished, provided in RFC 3339 format. | | `anthropic-ratelimit-tokens-limit` | The maximum number of tokens allowed within any rate limit period. | | `anthropic-ratelimit-tokens-remaining` | The number of tokens remaining (rounded to the nearest thousand) before being rate limited. | | `anthropic-ratelimit-tokens-reset` | The `anthropic-ratelimit-tokens-*` headers display the values for the most restrictive limit currently in effect. For instance, if you have exceeded the Workspace per-minute token limit, the headers will contain the Workspace per-minute token rate limit values. If Workspace limits do not apply, the headers will return the total tokens remaining, where total is the sum of input and output tokens. This approach ensures that you have visibility into the most relevant constraint on your current API usage. Was this page helpful? Tier 1 Tier 1 Tier 2 Tier 2 Tier 3 Tier 3 Tier 4 Tier 4 Custom Custom Tier 1 Tier 1 Tier 2 Tier 2 Tier 3 Tier 3 Tier 4 Tier 4 Custom Custom The time when the token rate limit will be fully replenished, provided in RFC 3339 format. | | | | --- | --- | | `anthropic-ratelimit-input-tokens-limit` | The maximum number of input tokens allowed within any rate limit period. | | | | | --- | --- | | `anthropic-ratelimit-input-tokens-remaining` | The number of input tokens remaining (rounded to the nearest thousand) before being rate limited. | | | | | --- | --- | | `anthropic-ratelimit-input-tokens-reset` | The time when the input token rate limit will be fully replenished, provided in RFC 3339 format. | | | | | --- | --- | | `anthropic-ratelimit-output-tokens-limit` | The maximum number of output tokens allowed within any rate limit period. | | | | | --- | --- | | `anthropic-ratelimit-output-tokens-remaining` | The number of output tokens remaining (rounded to the nearest thousand) before being rate limited. | | | | | --- | --- | | `anthropic-ratelimit-output-tokens-reset` | The time when the output token rate limit will be fully replenished, provided in RFC 3339 format. | | | | | --- | --- | | `anthropic-priority-input-tokens-limit` | The maximum number of Priority Tier input tokens allowed within any rate limit period. (Priority Tier only) | | | | | --- | --- | | `anthropic-priority-input-tokens-remaining` | The number of Priority Tier input tokens remaining (rounded to the nearest thousand) before being rate limited. (Priority Tier only) | | | | | --- | --- | | `anthropic-priority-input-tokens-reset` | The time when the Priority Tier input token rate limit will be fully replenished, provided in RFC 3339 format. (Priority Tier only) | | | | | --- | --- | | `anthropic-priority-output-tokens-limit` | The maximum number of Priority Tier output tokens allowed within any rate limit period. (Priority Tier only) | | | | | --- | --- | | `anthropic-priority-output-tokens-remaining` | The number of Priority Tier output tokens remaining (rounded to the nearest thousand) before being rate limited. (Priority Tier only) | | | | | --- | --- | | `anthropic-priority-output-tokens-reset` | The time when the Priority Tier output token rate limit will be fully replenished, provided in RFC 3339 format. (Priority Tier only) | --- # Get started with Agent Skills in the API - Claude API Docs Loading... Skills Quickstart Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page This tutorial shows you how to use Agent Skills to create a PowerPoint presentation. You'll learn how to enable Skills, make a simple request, and access the generated file. Prerequisites ------------------- * [Claude API key](https://platform.claude.com/settings/keys) * Python 3.7+ or curl installed * Basic familiarity with making API requests Agent Skills overview --------------------------- Pre-built Agent Skills extend Claude's capabilities with specialized expertise for tasks like creating documents, analyzing data, and processing files. Anthropic provides the following pre-built Agent Skills in the API: * **PowerPoint (pptx):** Create and edit presentations * **Excel (xlsx):** Create and analyze spreadsheets * **Word (docx):** Create and edit documents * **PDF (pdf):** Generate PDF documents **Want to create custom Skills?** See the [Agent Skills Cookbook](https://platform.claude.com/cookbook/skills-notebooks-01-skills-introduction) for examples of building your own Skills with domain-specific expertise. Step 1: List available Skills ----------------------------------- First, check what Skills are available. Use the Skills API to list all Anthropic-managed Skills: Shell curl "https://api.anthropic.com/v1/skills?source=anthropic" \ -H "x-api-key: $ANTHROPIC_API_KEY" \ -H "anthropic-version: 2023-06-01" \ -H "anthropic-beta: skills-2025-10-02" You see the following Skills: `pptx`, `xlsx`, `docx`, and `pdf`. This API returns each Skill's metadata: its name and description. Claude loads this metadata at startup to know what Skills are available. This is the first level of **progressive disclosure**, where Claude discovers Skills without loading their full instructions yet. Step 2: Create a presentation ----------------------------------- Now use the PowerPoint Skill to create a presentation about renewable energy. Specify Skills using the `container` parameter in the Messages API: Shell curl https://api.anthropic.com/v1/messages \ -H "x-api-key: $ANTHROPIC_API_KEY" \ -H "anthropic-version: 2023-06-01" \ -H "anthropic-beta: code-execution-2025-08-25,skills-2025-10-02" \ -H "content-type: application/json" \ -d '{ "model": "claude-opus-4-6", "max_tokens": 4096, "container": { "skills": [\ {\ "type": "anthropic",\ "skill_id": "pptx",\ "version": "latest"\ }\ ] }, "messages": [{\ "role": "user",\ "content": "Create a presentation about renewable energy with 5 slides"\ }], "tools": [{\ "type": "code_execution_20250825",\ "name": "code_execution"\ }] }' Let's break down what each part does: * **`container.skills`:** Specifies which Skills Claude can use * **`type: "anthropic"`:** Indicates this is an Anthropic-managed Skill * **`skill_id: "pptx"`:** The PowerPoint Skill identifier * **`version: "latest"`:** The Skill version set to the most recently published * **`tools`:** Enables code execution (required for Skills) * **Beta headers:** `code-execution-2025-08-25` and `skills-2025-10-02` When you make this request, Claude automatically matches your task to the relevant Skill. Since you asked for a presentation, Claude determines the PowerPoint Skill is relevant and loads its full instructions: the second level of progressive disclosure. Then Claude executes the Skill's code to create your presentation. Step 3: Download the created file --------------------------------------- The presentation was created in the code execution container and saved as a file. The response includes a file reference with a file ID. Extract the file ID and download it using the Files API: Shell # Extract file_id from response (using jq) FILE_ID=$(echo "$RESPONSE" | jq -r '.content[] | select(.type=="tool_use" and .name=="code_execution") | .content[] | select(.file_id) | .file_id') # Download the file curl "https://api.anthropic.com/v1/files/$FILE_ID/content" \ -H "x-api-key: $ANTHROPIC_API_KEY" \ -H "anthropic-version: 2023-06-01" \ -H "anthropic-beta: files-api-2025-04-14" \ --output renewable_energy.pptx echo "Presentation saved to renewable_energy.pptx" For complete details on working with generated files, see the [code execution tool documentation](https://platform.claude.com/docs/en/agents-and-tools/tool-use/code-execution-tool#retrieve-generated-files) . Try more examples ----------------------- Now that you've created your first document with Skills, try these variations: ### Create a spreadsheet Shell curl https://api.anthropic.com/v1/messages \ -H "x-api-key: $ANTHROPIC_API_KEY" \ -H "anthropic-version: 2023-06-01" \ -H "anthropic-beta: code-execution-2025-08-25,skills-2025-10-02" \ -H "content-type: application/json" \ -d '{ "model": "claude-opus-4-6", "max_tokens": 4096, "container": { "skills": [\ {\ "type": "anthropic",\ "skill_id": "xlsx",\ "version": "latest"\ }\ ] }, "messages": [{\ "role": "user",\ "content": "Create a quarterly sales tracking spreadsheet with sample data"\ }], "tools": [{\ "type": "code_execution_20250825",\ "name": "code_execution"\ }] }' ### Create a Word document Shell curl https://api.anthropic.com/v1/messages \ -H "x-api-key: $ANTHROPIC_API_KEY" \ -H "anthropic-version: 2023-06-01" \ -H "anthropic-beta: code-execution-2025-08-25,skills-2025-10-02" \ -H "content-type: application/json" \ -d '{ "model": "claude-opus-4-6", "max_tokens": 4096, "container": { "skills": [\ {\ "type": "anthropic",\ "skill_id": "docx",\ "version": "latest"\ }\ ] }, "messages": [{\ "role": "user",\ "content": "Write a 2-page report on the benefits of renewable energy"\ }], "tools": [{\ "type": "code_execution_20250825",\ "name": "code_execution"\ }] }' ### Generate a PDF Shell curl https://api.anthropic.com/v1/messages \ -H "x-api-key: $ANTHROPIC_API_KEY" \ -H "anthropic-version: 2023-06-01" \ -H "anthropic-beta: code-execution-2025-08-25,skills-2025-10-02" \ -H "content-type: application/json" \ -d '{ "model": "claude-opus-4-6", "max_tokens": 4096, "container": { "skills": [\ {\ "type": "anthropic",\ "skill_id": "pdf",\ "version": "latest"\ }\ ] }, "messages": [{\ "role": "user",\ "content": "Generate a PDF invoice template"\ }], "tools": [{\ "type": "code_execution_20250825",\ "name": "code_execution"\ }] }' Next steps ---------------- Now that you've used pre-built Agent Skills, you can: [API Guide\ \ Use Skills with the Claude API](https://platform.claude.com/docs/en/build-with-claude/skills-guide) [Create Custom Skills\ \ Upload your own Skills for specialized tasks](https://platform.claude.com/docs/en/api/skills/create-skill) [Authoring Guide\ \ Learn best practices for writing effective Skills](https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices) [Use Skills in Claude Code\ \ Learn about Skills in Claude Code](https://code.claude.com/docs/en/skills) [Agent Skills Cookbook\ \ Explore example Skills and implementation patterns](https://platform.claude.com/cookbook/skills-notebooks-01-skills-introduction) Was this page helpful? --- # Workspaces - Claude API Docs Loading... Administration Workspaces Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Workspaces provide a way to organize your API usage within an organization. Use workspaces to separate different projects, environments, or teams while maintaining centralized billing and administration. How workspaces work ------------------------- Every organization has a **Default Workspace** that cannot be renamed, archived, or deleted. When you create additional workspaces, you can assign API keys, members, and resource limits to each one. Key characteristics: * **Workspace identifiers** use the `wrkspc_` prefix (e.g., `wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ`) * **Maximum 100 workspaces** per organization (archived workspaces don't count) * **Default Workspace** has no ID and doesn't appear in list endpoints * **API keys** are scoped to a single workspace and can only access resources within that workspace Workspace roles and permissions ------------------------------------- Members can have different roles in each workspace, allowing fine-grained access control. | Role | Permissions | | --- | --- | | Workspace User | Use the Workbench only | | Workspace Limited Developer | Create and manage API keys, use the API. Cannot access session tracing views or download files. | | Workspace Developer | Create and manage API keys, use the API | | Workspace Admin | Full control over workspace settings and members | | Workspace Billing | View workspace billing information (inherited from organization billing role) | ### Role inheritance * **Organization admins** automatically receive Workspace Admin access to all workspaces * **Organization billing members** automatically receive Workspace Billing access to all workspaces * **Organization users and developers** must be explicitly added to each workspace The Workspace Billing role cannot be manually assigned. It's inherited from having the organization billing role. Managing workspaces ------------------------- Only organization admins can create workspaces. Organization users and developers must be added to workspaces by an admin. ### Via the Console Create and manage workspaces in the [Claude Console](https://platform.claude.com/settings/workspaces) . #### Create a workspace 1. 1 Open workspace settings In the Claude Console, go to **Settings > Workspaces**. 2. 2 Add a new workspace Click **Add Workspace**. 3. 3 Configure the workspace Enter a workspace name and select a color for visual identification. 4. 4 Create the workspace Click **Create** to finalize. To switch between workspaces in the Console, use the **Workspaces** selector in the top-left corner. #### Edit workspace details To modify a workspace's name or color: 1. Select the workspace from the list 2. Click the ellipsis menu (**...**) and choose **Edit details** 3. Update the name or color and save your changes The Default Workspace cannot be renamed or deleted. #### Add members to a workspace 1. Navigate to the workspace's **Members** tab 2. Click **Add to Workspace** 3. Select an organization member and assign them a [workspace role](https://platform.claude.com/docs/en/build-with-claude/workspaces#workspace-roles-and-permissions) 4. Confirm the addition To remove a member, click the trash icon next to their name. Organization admins and billing members cannot be removed from workspaces while they hold those organization roles. #### Set workspace limits In the **Limits** tab, you can configure: * **Rate limits**: Set limits per model tier for requests per minute, input tokens, or output tokens * **Spend notifications**: Configure alerts when spending reaches certain thresholds #### Archive a workspace To archive a workspace, click the ellipsis menu (**...**) and select **Archive**. Archiving: * Preserves historical data for reporting * Deactivates the workspace and all associated API keys * Cannot be undone Archiving a workspace immediately revokes all API keys in that workspace. This action cannot be undone. ### Via the Admin API Programmatically manage workspaces using the [Admin API](https://platform.claude.com/docs/en/build-with-claude/administration-api) . Admin API endpoints require an Admin API key (starting with `sk-ant-admin...`) that differs from standard API keys. Only organization members with the admin role can provision Admin API keys through the [Claude Console](https://platform.claude.com/settings/admin-keys) . # Create a workspace curl --request POST "https://api.anthropic.com/v1/organizations/workspaces" \ --header "anthropic-version: 2023-06-01" \ --header "x-api-key: $ANTHROPIC_ADMIN_KEY" \ --data '{"name": "Production"}' # List workspaces curl "https://api.anthropic.com/v1/organizations/workspaces?limit=10&include_archived=false" \ --header "anthropic-version: 2023-06-01" \ --header "x-api-key: $ANTHROPIC_ADMIN_KEY" # Archive a workspace curl --request POST "https://api.anthropic.com/v1/organizations/workspaces/{workspace_id}/archive" \ --header "anthropic-version: 2023-06-01" \ --header "x-api-key: $ANTHROPIC_ADMIN_KEY" For complete parameter details and response schemas, see the [Workspaces API reference](https://platform.claude.com/docs/en/api/admin-api/workspaces/get-workspace) . ### Managing workspace members Add, update, or remove members from a workspace: # Add a member to a workspace curl --request POST "https://api.anthropic.com/v1/organizations/workspaces/{workspace_id}/members" \ --header "anthropic-version: 2023-06-01" \ --header "x-api-key: $ANTHROPIC_ADMIN_KEY" \ --data '{ "user_id": "user_xxx", "workspace_role": "workspace_developer" }' # Update a member's role curl --request POST "https://api.anthropic.com/v1/organizations/workspaces/{workspace_id}/members/{user_id}" \ --header "anthropic-version: 2023-06-01" \ --header "x-api-key: $ANTHROPIC_ADMIN_KEY" \ --data '{"workspace_role": "workspace_admin"}' # Remove a member from a workspace curl --request DELETE "https://api.anthropic.com/v1/organizations/workspaces/{workspace_id}/members/{user_id}" \ --header "anthropic-version: 2023-06-01" \ --header "x-api-key: $ANTHROPIC_ADMIN_KEY" For complete parameter details, see the [Workspace Members API reference](https://platform.claude.com/docs/en/api/admin-api/workspace_members/get-workspace-member) . API keys and resource scoping ----------------------------------- API keys are scoped to a specific workspace. When you create an API key in a workspace, it can only access resources within that workspace. Resources scoped to workspaces include: * **Files** created via the [Files API](https://platform.claude.com/docs/en/build-with-claude/files) * **Message Batches** created via the [Batch API](https://platform.claude.com/docs/en/build-with-claude/batch-processing) * **Skills** created via the [Skills API](https://platform.claude.com/docs/en/build-with-claude/skills-guide) Starting February 5, 2026, [prompt caches](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) will also be isolated per workspace (applies to the Claude API and Azure only). To retrieve your organization's workspace IDs, use the [List Workspaces](https://platform.claude.com/docs/en/api/admin-api/workspaces/list-workspaces) endpoint, or find them in the [Claude Console](https://platform.claude.com/settings/workspaces) . Workspace limits ---------------------- You can set custom spend and rate limits for each workspace to protect against overuse and ensure fair resource distribution. ### Setting workspace limits Workspace limits can be set lower than (but not higher than) your organization's limits: * **Spend limits**: Cap monthly spending for a workspace * **Rate limits**: Limit requests per minute, input tokens per minute, or output tokens per minute * You cannot set limits on the Default Workspace * If not set, workspace limits match the organization's limits * Organization-wide limits always apply, even if workspace limits add up to more For detailed information on rate limits and how they work, see [Rate limits](https://platform.claude.com/docs/en/api/rate-limits) . Usage and cost tracking ----------------------------- Track usage and costs by workspace using the [Usage and Cost API](https://platform.claude.com/docs/en/build-with-claude/usage-cost-api) : curl "https://api.anthropic.com/v1/organizations/usage_report/messages?\ starting_at=2025-01-01T00:00:00Z&\ ending_at=2025-01-08T00:00:00Z&\ workspace_ids[]=wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ&\ group_by[]=workspace_id&\ bucket_width=1d" \ --header "anthropic-version: 2023-06-01" \ --header "x-api-key: $ADMIN_API_KEY" Usage and costs attributed to the Default Workspace have a `null` value for `workspace_id`. Common use cases ---------------------- ### Environment separation Create separate workspaces for development, staging, and production: | Workspace | Purpose | | --- | --- | | Development | Testing and experimentation with lower rate limits | | Staging | Pre-production testing with production-like limits | | Production | Live traffic with full rate limits and monitoring | ### Team or department isolation Assign workspaces to different teams for cost allocation and access control: * **Engineering team** with developer access * **Data science team** with their own API keys * **Support team** with limited access for customer tools ### Project-based organization Create workspaces for specific projects or products to track usage and costs separately. Best practices -------------------- 1. 1 Plan your workspace structure Consider how you'll organize workspaces before creating them. Think about billing, access control, and usage tracking needs. 2. 2 Use meaningful names Name workspaces clearly to indicate their purpose (e.g., "Production - Customer Chatbot", "Dev - Internal Tools"). 3. 3 Set appropriate limits Configure spend and rate limits to prevent unexpected costs and ensure fair resource distribution. 4. 4 Audit access regularly Review workspace membership periodically to ensure only appropriate users have access. 5. 5 Monitor usage Use the [Usage and Cost API](https://platform.claude.com/docs/en/build-with-claude/usage-cost-api) to track workspace-level consumption. FAQ --------- ### What's the Default Workspace? ### Are there limits on workspaces? ### How do organization roles affect workspace access? ### Which roles can be assigned in workspaces? ### Can organization admin or billing members' workspace roles be changed? ### What happens to workspace access when organization roles change? ### What happens to API keys when a user is removed from a workspace? See also -------------- * [Admin API overview](https://platform.claude.com/docs/en/build-with-claude/administration-api) * [Admin API reference](https://platform.claude.com/docs/en/api/admin) * [Rate limits](https://platform.claude.com/docs/en/api/rate-limits) * [Usage and Cost API](https://platform.claude.com/docs/en/build-with-claude/usage-cost-api) Was this page helpful? --- # PHP SDK - Claude API Docs Loading... Client SDKs PHP SDK Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Was this page helpful? The Anthropic PHP library provides convenient access to the Anthropic REST API from any PHP 8.1.0+ application. The PHP SDK is currently in beta. APIs may change between versions. For API feature documentation with code examples, see the [API reference](https://platform.claude.com/docs/en/api/overview) . This page covers PHP-specific SDK features and configuration. Installation ------------------ composer require "anthropic-ai/sdk" Requirements ------------------ PHP 8.1.0 or higher. Usage ----------- This library uses named parameters to specify optional arguments. Parameters with a default value must be set by name. $client = new Client( apiKey: getenv("ANTHROPIC_API_KEY") ?: "my-anthropic-api-key" ); $message = $client->messages->create( maxTokens: 1024, messages: [['role' => 'user', 'content' => 'Hello, Claude']], model: 'claude-opus-4-6', ); var_dump($message->content); Value objects ------------------- It is recommended to use the static `with` constructor `Base64ImageSource::with(data: "U3RhaW5sZXNzIHJvY2tz", ...)` and named parameters to initialize value objects. However, builders are also provided `(new Base64ImageSource)->withData("U3RhaW5sZXNzIHJvY2tz")`. Streaming --------------- The SDK provides support for streaming responses using Server-Sent Events (SSE). $client = new Client( apiKey: getenv("ANTHROPIC_API_KEY") ?: "my-anthropic-api-key" ); $stream = $client->messages->createStream( maxTokens: 1024, messages: [['role' => 'user', 'content' => 'Hello, Claude']], model: 'claude-opus-4-6', ); foreach ($stream as $message) { var_dump($message); } Error handling -------------------- When the library is unable to connect to the API, or if the API returns a non-success status code (i.e., 4xx or 5xx response), a subclass of `Anthropic\Core\Exceptions\APIException` is thrown: messages->create( maxTokens: 1024, messages: [['role' => 'user', 'content' => 'Hello, Claude']], model: 'claude-opus-4-6', ); } catch (APIConnectionException $e) { echo "The server could not be reached", PHP_EOL; var_dump($e->getPrevious()); } catch (RateLimitException $_) { echo "A 429 status code was received; we should back off a bit.", PHP_EOL; } catch (APIStatusException $e) { echo "Another non-200-range status code was received", PHP_EOL; echo $e->getMessage(); } Error codes are as follows: | Cause | Error Type | | --- | --- | | HTTP 400 | `BadRequestException` | | HTTP 401 | `AuthenticationException` | | HTTP 403 | `PermissionDeniedException` | | HTTP 404 | `NotFoundException` | | HTTP 409 | `ConflictException` | | HTTP 422 | `UnprocessableEntityException` | | HTTP 429 | `RateLimitException` | | HTTP >= 500 | `InternalServerException` | Retries ------------- Certain errors are automatically retried 2 times by default, with a short exponential backoff. Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict, 429 Rate Limit, >=500 Internal errors, and timeouts are all retried by default. You can use the `maxRetries` option to configure or disable this: use Anthropic\RequestOptions; // ... // Configure the default for all requests: $client = new Client(requestOptions: RequestOptions::with(maxRetries: 0)); // Or, configure per-request: $result = $client->messages->create( maxTokens: 1024, messages: [['role' => 'user', 'content' => 'Hello, Claude']], model: 'claude-opus-4-6', requestOptions: RequestOptions::with(maxRetries: 5), ); Pagination ---------------- List methods in the Claude API are paginated. This library provides auto-paginating iterators with each list response, so you do not have to request successive pages manually: $client = new Client( apiKey: getenv("ANTHROPIC_API_KEY") ?: "my-anthropic-api-key" ); $page = $client->beta->messages->batches->list(limit: 20); var_dump($page); // fetch items from the current page foreach ($page->getItems() as $item) { var_dump($item->id); } // make additional network requests to fetch items from all pages, including and after the current page foreach ($page->pagingEachItem() as $item) { var_dump($item->id); } Advanced usage -------------------- ### Undocumented properties You can send undocumented parameters to any endpoint, and read undocumented response properties, like so: The `extra*` parameters of the same name override the documented parameters. messages->create( maxTokens: 1024, messages: [['role' => 'user', 'content' => 'Hello, Claude']], model: 'claude-opus-4-6', requestOptions: RequestOptions::with( extraQueryParams: ['my_query_parameter' => 'value'], extraBodyParams: ['my_body_parameter' => 'value'], extraHeaders: ['my-header' => 'value'], ), ); ### Undocumented request params If you want to explicitly send an extra param, you can do so with the `extraQueryParams`, `extraBodyParams`, and `extraHeaders` options under `RequestOptions::with()` when making a request, as seen in the example above. ### Undocumented endpoints To make requests to undocumented endpoints while retaining the benefit of auth, retries, and so on, you can make requests using `client->request`, like so: $client = new Client(); $response = $client->request( method: "post", path: '/undocumented/endpoint', query: ['dog' => 'woof'], headers: ['useful-header' => 'interesting-value'], body: ['hello' => 'world'] ); Semantic versioning ------------------------- This package follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions. As the library is in initial development and has a major version of `0`, APIs may change at any time. This package considers improvements to the (non-runtime) PHPDoc type definitions to be non-breaking changes. Additional resources -------------------------- * [GitHub repository](https://github.com/anthropics/anthropic-sdk-php) * [Packagist](https://packagist.org/packages/anthropic-ai/sdk) * [API reference](https://platform.claude.com/docs/en/api/overview) * [Streaming guide](https://platform.claude.com/docs/en/build-with-claude/streaming) | | | | --- | --- | | Other HTTP error | `APIStatusException` | | | | | --- | --- | | Timeout | `APITimeoutException` | | | | | --- | --- | | Network error | `APIConnectionException` | --- # Client SDKs - Claude API Docs Loading... Client SDKs Overview Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Anthropic provides official client SDKs in multiple languages to make it easier to work with the Claude API. Each SDK provides idiomatic interfaces, type safety, and built-in support for features like streaming, retries, and error handling. [CLI\ \ Shell scripting, typed flags, response transforms](https://platform.claude.com/docs/en/api/sdks/cli) [Python\ \ Sync and async clients, Pydantic models](https://platform.claude.com/docs/en/api/sdks/python) [TypeScript\ \ Node.js, Deno, Bun, and browser support](https://platform.claude.com/docs/en/api/sdks/typescript) [Java\ \ Builder pattern, CompletableFuture async](https://platform.claude.com/docs/en/api/sdks/java) [Go\ \ Context-based cancellation, functional options](https://platform.claude.com/docs/en/api/sdks/go) [Ruby\ \ Sorbet types, streaming helpers](https://platform.claude.com/docs/en/api/sdks/ruby) [C#\ \ .NET Standard 2.0+, IChatClient integration](https://platform.claude.com/docs/en/api/sdks/csharp) [PHP\ \ Value objects, builder pattern](https://platform.claude.com/docs/en/api/sdks/php) Quick installation ------------------------ CLI CLI Python Python TypeScript TypeScript C# C# Go Go Java Java PHP PHP Ruby Ruby Quick start ----------------- CLI ant messages create \ --model claude-opus-4-6 \ --max-tokens 1024 \ --message '{role: user, content: "Hello, Claude"}' \ --transform content Platform support ---------------------- All SDKs support multiple deployment options: | Platform | Description | | --- | --- | | Claude API | Connect directly to Claude API endpoints | | [Amazon Bedrock](https://platform.claude.com/docs/en/build-with-claude/claude-in-amazon-bedrock) | Use Claude through AWS | | [Google Vertex AI](https://platform.claude.com/docs/en/build-with-claude/claude-on-vertex-ai) | Use Claude through Google Cloud | | [Microsoft Foundry](https://platform.claude.com/docs/en/build-with-claude/claude-in-microsoft-foundry) | Use Claude through Microsoft Azure | See individual SDK pages for platform-specific setup instructions. Beta features ------------------- Access beta features using the `beta` namespace in any SDK: CLI ant beta:messages create \ --model claude-opus-4-6 \ --max-tokens 1024 \ --message '{role: user, content: "Hello"}' \ --beta feature-name See [Beta headers](https://platform.claude.com/docs/en/api/beta-headers) for available beta features. Requirements ------------------ | SDK | Minimum Version | | --- | --- | | Python | 3.9+ | | TypeScript | 4.9+ (Node.js 20+) | | Java | 8+ | | Go | 1.23+ | | Ruby | 3.2.0+ | | C# | .NET Standard 2.0 | | PHP | 8.1.0+ | GitHub repositories ------------------------- * [anthropic-sdk-python](https://github.com/anthropics/anthropic-sdk-python) * [anthropic-sdk-typescript](https://github.com/anthropics/anthropic-sdk-typescript) * [anthropic-sdk-java](https://github.com/anthropics/anthropic-sdk-java) * [anthropic-sdk-go](https://github.com/anthropics/anthropic-sdk-go) * [anthropic-sdk-ruby](https://github.com/anthropics/anthropic-sdk-ruby) * [anthropic-sdk-csharp](https://github.com/anthropics/anthropic-sdk-csharp) * [anthropic-sdk-php](https://github.com/anthropics/anthropic-sdk-php) Was this page helpful? --- # Usage and Cost API - Claude API Docs Loading... Monitoring Usage and Cost API Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page **The Admin API is unavailable for individual accounts.** To collaborate with teammates and add members, set up your organization in **Console → Settings → Organization**. The Usage & Cost Admin API provides programmatic and granular access to historical API usage and cost data for your organization. This data is similar to the information available in the [Usage](https://platform.claude.com/usage) and [Cost](https://platform.claude.com/cost) pages of the Claude Console. This API enables you to better monitor, analyze, and optimize your Claude implementations: * **Accurate Usage Tracking:** Get precise token counts and usage patterns instead of relying solely on response token counting * **Cost Reconciliation:** Match internal records with Anthropic billing for finance and accounting teams * **Product performance and improvement:** Monitor product performance while measuring if changes to the system have improved it, or setup alerting * **[Rate limit](https://platform.claude.com/docs/en/api/rate-limits) and [Priority Tier](https://platform.claude.com/docs/en/api/service-tiers#get-started-with-priority-tier) optimization:** Optimize features like [prompt caching](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) or specific prompts to make the most of one’s allocated capacity, or purchase dedicated capacity. * **Advanced Analysis:** Perform deeper data analysis than what's available in Console **Admin API key required** This API is part of the [Admin API](https://platform.claude.com/docs/en/build-with-claude/administration-api) . These endpoints require an Admin API key (starting with `sk-ant-admin...`) that differs from standard API keys. Only organization members with the admin role can provision Admin API keys through the [Claude Console](https://platform.claude.com/settings/admin-keys) . Partner solutions ----------------------- Leading observability platforms offer ready-to-use integrations for monitoring your Claude API usage and cost, without writing custom code. These integrations provide dashboards, alerting, and analytics to help you manage your API usage effectively. [CloudZero\ \ Cloud intelligence platform for tracking and forecasting costs](https://docs.cloudzero.com/docs/connections-anthropic) [Datadog\ \ LLM Observability with automatic tracing and monitoring](https://docs.datadoghq.com/integrations/anthropic/) [Grafana Cloud\ \ Agentless integration for easy LLM observability with out-of-the-box dashboards and alerts](https://grafana.com/docs/grafana-cloud/monitor-infrastructure/integrations/integration-reference/integration-anthropic/) [Honeycomb\ \ Advanced querying and visualization through OpenTelemetry](https://docs.honeycomb.io/integrations/anthropic-usage-monitoring/) [Vantage\ \ FinOps platform for LLM cost & usage observability](https://docs.vantage.sh/connecting_anthropic) Quick start ----------------- Get your organization's daily usage for the last 7 days: curl "https://api.anthropic.com/v1/organizations/usage_report/messages?\ starting_at=2025-01-08T00:00:00Z&\ ending_at=2025-01-15T00:00:00Z&\ bucket_width=1d" \ --header "anthropic-version: 2023-06-01" \ --header "x-api-key: $ADMIN_API_KEY" **Set a User-Agent header for integrations** If you're building an integration, set your User-Agent header to help us understand usage patterns: User-Agent: YourApp/1.0.0 (https://yourapp.com) Usage API --------------- Track token consumption across your organization with detailed breakdowns by model, workspace, and service tier with the `/v1/organizations/usage_report/messages` endpoint. ### Key concepts * **Time buckets**: Aggregate usage data in fixed intervals (`1m`, `1h`, or `1d`) * **Token tracking**: Measure uncached input, cached input, cache creation, and output tokens * **Filtering & grouping**: Filter by API key, workspace, model, service tier, context window, [data residency](https://platform.claude.com/docs/en/build-with-claude/data-residency) , or speed (beta), and group results by these dimensions * **Server tool usage**: Track usage of server-side tools like web search For complete parameter details and response schemas, see the [Usage API reference](https://platform.claude.com/docs/en/api/admin-api/usage-cost/get-messages-usage-report) . ### Basic examples #### Daily usage by model curl "https://api.anthropic.com/v1/organizations/usage_report/messages?\ starting_at=2025-01-01T00:00:00Z&\ ending_at=2025-01-08T00:00:00Z&\ group_by[]=model&\ bucket_width=1d" \ --header "anthropic-version: 2023-06-01" \ --header "x-api-key: $ADMIN_API_KEY" #### Hourly usage with filtering curl "https://api.anthropic.com/v1/organizations/usage_report/messages?\ starting_at=2025-01-15T00:00:00Z&\ ending_at=2025-01-15T23:59:59Z&\ models[]=claude-opus-4-6&\ service_tiers[]=batch&\ context_window[]=0-200k&\ bucket_width=1h" \ --header "anthropic-version: 2023-06-01" \ --header "x-api-key: $ADMIN_API_KEY" #### Filter usage by API keys and workspaces curl "https://api.anthropic.com/v1/organizations/usage_report/messages?\ starting_at=2025-01-01T00:00:00Z&\ ending_at=2025-01-08T00:00:00Z&\ api_key_ids[]=apikey_01Rj2N8SVvo6BePZj99NhmiT&\ api_key_ids[]=apikey_01ABC123DEF456GHI789JKL&\ workspace_ids[]=wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ&\ workspace_ids[]=wrkspc_01XYZ789ABC123DEF456MNO&\ bucket_width=1d" \ --header "anthropic-version: 2023-06-01" \ --header "x-api-key: $ADMIN_API_KEY" To retrieve your organization's API key IDs, use the [List API Keys](https://platform.claude.com/docs/en/api/admin-api/apikeys/list-api-keys) endpoint. To retrieve your organization's workspace IDs, use the [List Workspaces](https://platform.claude.com/docs/en/api/admin-api/workspaces/list-workspaces) endpoint, or find your organization's workspace IDs in the Anthropic Console. #### Data residency Track your [data residency controls](https://platform.claude.com/docs/en/build-with-claude/data-residency) by grouping and filtering usage with the `inference_geo` dimension. This is useful for verifying geographic routing across your organization. curl "https://api.anthropic.com/v1/organizations/usage_report/messages?\ starting_at=2026-02-01T00:00:00Z&\ ending_at=2026-02-08T00:00:00Z&\ group_by[]=inference_geo&\ group_by[]=model&\ bucket_width=1d" \ --header "anthropic-version: 2023-06-01" \ --header "x-api-key: $ADMIN_API_KEY" You can also filter to a specific geo. Valid values are `global`, `us`, and `not_available`: curl "https://api.anthropic.com/v1/organizations/usage_report/messages?\ starting_at=2026-02-01T00:00:00Z&\ ending_at=2026-02-08T00:00:00Z&\ inference_geos[]=us&\ group_by[]=model&\ bucket_width=1d" \ --header "anthropic-version: 2023-06-01" \ --header "x-api-key: $ADMIN_API_KEY" Models released before February 2026 (prior to Claude Opus 4.6) don't support the `inference_geo` request parameter, so their usage reports return `"not_available"` for this dimension. You can use `not_available` as a filter value in `inference_geos[]` to target those models. #### Fast mode (beta: research preview) Track [fast mode](https://platform.claude.com/docs/en/build-with-claude/fast-mode) usage by grouping and filtering with the `speed` dimension. This is useful for monitoring standard vs. fast mode usage. curl "https://api.anthropic.com/v1/organizations/usage_report/messages?\ starting_at=2026-02-01T00:00:00Z&\ ending_at=2026-02-08T00:00:00Z&\ group_by[]=speed&\ group_by[]=model&\ bucket_width=1d" \ --header "anthropic-version: 2023-06-01" \ --header "anthropic-beta: fast-mode-2026-02-01" \ --header "x-api-key: $ADMIN_API_KEY" You can also filter to a specific speed. Valid values are `standard` and `fast`: curl "https://api.anthropic.com/v1/organizations/usage_report/messages?\ starting_at=2026-02-01T00:00:00Z&\ ending_at=2026-02-08T00:00:00Z&\ speeds[]=fast&\ group_by[]=model&\ bucket_width=1d" \ --header "anthropic-version: 2023-06-01" \ --header "anthropic-beta: fast-mode-2026-02-01" \ --header "x-api-key: $ADMIN_API_KEY" Both the `speeds[]` filter and the `speed` group\_by value require the `fast-mode-2026-02-01` beta header. ### Time granularity limits | Granularity | Default Limit | Maximum Limit | Use Case | | --- | --- | --- | --- | | `1m` | 60 buckets | 1440 buckets | Real-time monitoring | | `1h` | 24 buckets | 168 buckets | Daily patterns | | `1d` | 7 buckets | 31 buckets | Weekly/monthly reports | Cost API -------------- Retrieve service-level cost breakdowns in USD with the `/v1/organizations/cost_report` endpoint. ### Key concepts * **Currency**: All costs in USD, reported as decimal strings in lowest units (cents) * **Cost types**: Track token usage, web search, and code execution costs * **Grouping**: Group costs by workspace or description for detailed breakdowns. When grouping by `description`, responses include parsed fields like `model` and `inference_geo` * **Time buckets**: Daily granularity only (`1d`) For complete parameter details and response schemas, see the [Cost API reference](https://platform.claude.com/docs/en/api/admin-api/usage-cost/get-cost-report) . Priority Tier costs use a different billing model and are not included in the cost endpoint. Track Priority Tier usage through the usage endpoint instead. ### Basic example curl "https://api.anthropic.com/v1/organizations/cost_report?\ starting_at=2025-01-01T00:00:00Z&\ ending_at=2025-01-31T00:00:00Z&\ group_by[]=workspace_id&\ group_by[]=description" \ --header "anthropic-version: 2023-06-01" \ --header "x-api-key: $ADMIN_API_KEY" Pagination ---------------- Both endpoints support pagination for large datasets: 1. Make your initial request 2. If `has_more` is `true`, use the `next_page` value in your next request 3. Continue until `has_more` is `false` # First request curl "https://api.anthropic.com/v1/organizations/usage_report/messages?\ starting_at=2025-01-01T00:00:00Z&\ ending_at=2025-01-31T00:00:00Z&\ limit=7" \ --header "anthropic-version: 2023-06-01" \ --header "x-api-key: $ADMIN_API_KEY" # Response includes: "has_more": true, "next_page": "page_xyz..." # Next request with pagination curl "https://api.anthropic.com/v1/organizations/usage_report/messages?\ starting_at=2025-01-01T00:00:00Z&\ ending_at=2025-01-31T00:00:00Z&\ limit=7&\ page=page_xyz..." \ --header "anthropic-version: 2023-06-01" \ --header "x-api-key: $ADMIN_API_KEY" Common use cases ---------------------- Explore detailed implementations in [Claude Cookbook](https://platform.claude.com/cookbooks) : * **Daily usage reports**: Track token consumption trends * **Cost attribution**: Allocate expenses by workspace for chargebacks * **Cache efficiency**: Measure and optimize prompt caching * **Budget monitoring**: Set up alerts for spending thresholds * **CSV export**: Generate reports for finance teams Frequently asked questions -------------------------------- ### How fresh is the data? Usage and cost data typically appears within 5 minutes of API request completion, though delays may occasionally be longer. ### What's the recommended polling frequency? The API supports polling once per minute for sustained use. For short bursts (e.g., downloading paginated data), more frequent polling is acceptable. Cache results for dashboards that need frequent updates. ### How do I track code execution usage? Code execution costs appear in the cost endpoint grouped under `Code Execution Usage` in the description field. Code execution is not included in the usage endpoint. ### How do I track Priority Tier usage? Filter or group by `service_tier` in the usage endpoint and look for the `priority` value. Priority Tier costs are not available in the cost endpoint. ### What happens with Workbench usage? API usage from the Workbench is not associated with an API key, so `api_key_id` will be `null` even when grouping by that dimension. ### How is the default workspace represented? Usage and costs attributed to the default workspace have a `null` value for `workspace_id`. ### How do I get per-user cost breakdowns for Claude Code? Use the [Claude Code Analytics API](https://platform.claude.com/docs/en/build-with-claude/claude-code-analytics-api) , which provides per-user estimated costs and productivity metrics without the performance limitations of breaking down costs by many API keys. For general API usage with many keys, use the [Usage API](https://platform.claude.com/docs/en/build-with-claude/usage-cost-api#usage-api) to track token consumption as a cost proxy. See also -------------- The Usage and Cost APIs can be used to help you deliver a better experience for your users, help you manage costs, and preserve your rate limit. Learn more about some of these other features: * [Admin API overview](https://platform.claude.com/docs/en/build-with-claude/administration-api) * [Admin API reference](https://platform.claude.com/docs/en/api/admin) * [Pricing](https://platform.claude.com/docs/en/about-claude/pricing) * [Prompt caching](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) - Optimize costs with caching * [Batch processing](https://platform.claude.com/docs/en/build-with-claude/batch-processing) - 50% discount on batch requests * [Rate limits](https://platform.claude.com/docs/en/api/rate-limits) - Understand usage tiers * [Data residency](https://platform.claude.com/docs/en/build-with-claude/data-residency) - Control inference geography Was this page helpful? --- # What's new in Claude 4.6 - Claude API Docs Loading... Models What's new in Claude 4.6 Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Claude 4.6 represents the next generation of Claude models, bringing significant new capabilities and API improvements. This page summarizes all new features available at launch. New models ---------------- | Model | API model ID | Description | | --- | --- | --- | | Claude Opus 4.6 | `claude-opus-4-6` | The most intelligent model for building agents and coding | | Claude Sonnet 4.6 | `claude-sonnet-4-6` | The best combination of speed and intelligence | Claude Opus 4.6 and Sonnet 4.6 both support a [1M token context window](https://platform.claude.com/docs/en/build-with-claude/context-windows) , extended thinking, and all existing Claude API features. Opus 4.6 offers 128k max output tokens; Sonnet 4.6 offers 64k max output tokens. For complete pricing and specs, see the [models overview](https://platform.claude.com/docs/en/about-claude/models/overview) . New features ------------------ ### Adaptive thinking mode [Adaptive thinking](https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking) (`thinking: {type: "adaptive"}`) is the recommended thinking mode for Opus 4.6 and Sonnet 4.6. Claude dynamically decides when and how much to think. At the default effort level (`high`), Claude almost always thinks. At lower effort levels, it may skip thinking for simpler problems. `thinking: {type: "enabled"}` and `budget_tokens` are **deprecated** on Opus 4.6 and Sonnet 4.6. They remain functional but will be removed in a future model release. Use adaptive thinking and the [effort parameter](https://platform.claude.com/docs/en/build-with-claude/effort) to control thinking depth instead. Adaptive thinking also automatically enables interleaved thinking. Python response = client.messages.create( model="claude-opus-4-6", max_tokens=16000, thinking={"type": "adaptive"}, messages=[{"role": "user", "content": "Solve this complex problem..."}], ) ### Effort parameter GA The [effort parameter](https://platform.claude.com/docs/en/build-with-claude/effort) is now generally available (no beta header required). A new `max` effort level provides the absolute highest capability on Opus 4.6. Combine effort with adaptive thinking for optimal cost-quality tradeoffs. Sonnet 4.6 introduces the effort parameter to the Sonnet family. Consider setting effort to `medium` for most Sonnet 4.6 use cases to balance speed, cost, and performance. ### Code execution is now free with web tools [Code execution](https://platform.claude.com/docs/en/agents-and-tools/tool-use/code-execution-tool) is now free when used with [web search](https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-search-tool) or [web fetch](https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-fetch-tool) . When either tool is included in your API request, there are no additional charges for code execution beyond standard input and output token costs. Code execution enables dynamic filtering in web search and web fetch tools, improving accuracy while reducing token consumption. See the [code execution pricing](https://platform.claude.com/docs/en/agents-and-tools/tool-use/code-execution-tool#usage-and-pricing) for details on standalone usage. ### Improved web search and web fetch with dynamic filtering [Web search](https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-search-tool) and [web fetch](https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-fetch-tool) tools now support dynamic filtering with Opus 4.6 and Sonnet 4.6. Claude can write and execute code to filter results before they reach the context window, keeping only relevant information and improving accuracy while reducing token consumption. To enable dynamic filtering, use the `web_search_20260209` or `web_fetch_20260209` tool versions. ### Tools graduating to general availability The following tools are now generally available: * [Code execution](https://platform.claude.com/docs/en/agents-and-tools/tool-use/code-execution-tool) (free with web tools) * [Web fetch](https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-fetch-tool) * [Programmatic tool calling](https://platform.claude.com/docs/en/agents-and-tools/tool-use/programmatic-tool-calling) * [Tool search tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-search-tool) * [Tool use examples](https://platform.claude.com/docs/en/agents-and-tools/tool-use/define-tools#providing-tool-use-examples) * [Memory tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/memory-tool) ### Compaction API (beta) [Compaction](https://platform.claude.com/docs/en/build-with-claude/compaction) provides automatic, server-side context summarization, enabling effectively infinite conversations. When context approaches the window limit, the API automatically summarizes earlier parts of the conversation. ### Fast mode (beta: research preview) [Fast mode](https://platform.claude.com/docs/en/build-with-claude/fast-mode) (`speed: "fast"`) delivers significantly faster output token generation for Opus models. Fast mode is up to 2.5x as fast at premium pricing ($30/$150 per MTok). This is the same model running with faster inference (no change to intelligence or capabilities). Python response = client.beta.messages.create( model="claude-opus-4-6", max_tokens=4096, speed="fast", betas=["fast-mode-2026-02-01"], messages=[{"role": "user", "content": "Refactor this module..."}], ) ### Fine-grained tool streaming (GA) [Fine-grained tool streaming](https://platform.claude.com/docs/en/agents-and-tools/tool-use/fine-grained-tool-streaming) is now generally available on all models and platforms. No beta header is required. ### Higher output token limits Opus 4.6 supports up to 128k output tokens. This enables longer thinking budgets and more comprehensive responses. The SDKs require streaming for requests with large `max_tokens` values to avoid HTTP timeouts. If you don't need to process events incrementally, use `.stream()` with `.get_final_message()` to get the complete response. See [Streaming Messages](https://platform.claude.com/docs/en/build-with-claude/streaming#get-the-final-message-without-handling-events) for details. On the Message Batches API, Opus 4.6 and Sonnet 4.6 can generate up to 300k output tokens by using the `output-300k-2026-03-24` beta header. See [Batch processing](https://platform.claude.com/docs/en/build-with-claude/batch-processing#extended-output-beta) for details. ### Data residency controls [Data residency controls](https://platform.claude.com/docs/en/build-with-claude/data-residency) allow you to specify where model inference runs using the `inference_geo` parameter. You can choose `"global"` (default) or `"us"` routing per request. US-only inference is priced at 1.1x on Claude Opus 4.6 and newer models. Deprecations ------------------ ### `type: "enabled"` and `budget_tokens` `thinking: {type: "enabled", budget_tokens: N}` is [**deprecated**](https://platform.claude.com/docs/en/build-with-claude/overview#feature-availability) on Opus 4.6 and Sonnet 4.6. It is still functional but no longer recommended and will be removed in a future model release. Migrate to `thinking: {type: "adaptive"}` with the [effort parameter](https://platform.claude.com/docs/en/build-with-claude/effort) . ### `interleaved-thinking-2025-05-14` beta header The `interleaved-thinking-2025-05-14` beta header is **deprecated** on Opus 4.6. It is safely ignored if included, but is no longer required. [Adaptive thinking](https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking) automatically enables [interleaved thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking#interleaved-thinking) . Remove `betas=["interleaved-thinking-2025-05-14"]` from your requests when using Opus 4.6. On **Sonnet 4.6**, the `interleaved-thinking-2025-05-14` beta header is still functional for use with manual extended thinking (`thinking: {type: "enabled"}`), but manual mode is deprecated. Adaptive thinking is the recommended path and automatically enables interleaved thinking. ### `output_format` The `output_format` parameter for [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs) has been moved to `output_config.format`. The old parameter remains functional but is deprecated and will be removed in a future model release. Python # Before response = client.messages.create( output_format={"type": "json_schema", "schema": {...}}, # ... ) # After response = client.messages.create( output_config={"format": {"type": "json_schema", "schema": {...}}}, # ... ) Breaking changes ---------------------- ### Prefill removal Prefilling assistant messages (last-assistant-turn prefills) is **not supported** on Opus 4.6. Requests with prefilled assistant messages return a 400 error. **Alternatives:** * [Structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs) for controlling response format * System prompt instructions for guiding response style * [`output_config.format`](https://platform.claude.com/docs/en/build-with-claude/structured-outputs#json-outputs) for JSON output ### Tool parameter quoting Opus 4.6 may produce slightly different JSON string escaping in tool call arguments (e.g., different handling of Unicode escapes or forward slash escaping). Standard JSON parsers handle these differences automatically. If you parse tool call `input` as a raw string rather than using `json.loads()` or `JSON.parse()`, verify your parsing logic still works. Migration guide --------------------- For step-by-step migration instructions, see [Migrating to Claude 4.6](https://platform.claude.com/docs/en/about-claude/models/migration-guide) . Next steps ---------------- [Adaptive thinking\ \ Learn how to use adaptive thinking mode.](https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking) [Models overview\ \ Compare all Claude models.](https://platform.claude.com/docs/en/about-claude/models/overview) [Compaction\ \ Explore server-side context compaction.](https://platform.claude.com/docs/en/build-with-claude/compaction) [](https://platform.claude.com/docs/en/build-with-claude/fast-mode) Was this page helpful? Fast mode Faster output token generation for Opus models. [Migration guide\ \ Step-by-step migration instructions.](https://platform.claude.com/docs/en/about-claude/models/migration-guide) --- # API Overview - Claude API Docs Loading... Using the API Features overview Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page The Claude API is a RESTful API at `https://api.anthropic.com` that provides programmatic access to Claude models and Claude Managed Agents. **New to Claude?** For direct model access, start with [Get started](https://platform.claude.com/docs/en/get-started) and [Working with Messages](https://platform.claude.com/docs/en/build-with-claude/working-with-messages) . For managed agent infrastructure, see the [Claude Managed Agents quickstart](https://platform.claude.com/docs/en/managed-agents/quickstart) . Prerequisites ------------------- To use the Claude API, you'll need: * A [Claude Console account](https://platform.claude.com/) * An [API key](https://platform.claude.com/settings/keys) For step-by-step setup instructions, see [Get started](https://platform.claude.com/docs/en/get-started) . Available APIs -------------------- The Claude API includes the following APIs: **General Availability:** * **[Messages API](https://platform.claude.com/docs/en/api/messages/create) **: Send messages to Claude for conversational interactions (`POST /v1/messages`) * **[Message Batches API](https://platform.claude.com/docs/en/api/creating-message-batches) **: Process large volumes of Messages requests asynchronously with 50% cost reduction (`POST /v1/messages/batches`) * **[Token Counting API](https://platform.claude.com/docs/en/api/messages-count-tokens) **: Count tokens in a message before sending to manage costs and rate limits (`POST /v1/messages/count_tokens`) * **[Models API](https://platform.claude.com/docs/en/api/models-list) **: List available Claude models and their details (`GET /v1/models`) **Beta:** * **[Files API](https://platform.claude.com/docs/en/api/files-create) **: Upload and manage files for use across multiple API calls (`POST /v1/files`, `GET /v1/files`) * **[Skills API](https://platform.claude.com/docs/en/api/skills/create-skill) **: Create and manage custom agent skills (`POST /v1/skills`, `GET /v1/skills`) * **[Agents API](https://platform.claude.com/docs/en/api/beta/agents/create) **: Define reusable, versioned agent configurations for Claude Managed Agents (`POST /v1/agents`, `GET /v1/agents`) * **[Sessions API](https://platform.claude.com/docs/en/api/beta/sessions/create) **: Run stateful agent sessions in managed cloud containers (`POST /v1/sessions`, `GET /v1/sessions/{id}/stream`) * **[Environments API](https://platform.claude.com/docs/en/api/beta/environments/create) **: Configure container templates for agent sessions (`POST /v1/environments`, `GET /v1/environments`) For the complete API reference with all endpoints, parameters, and response schemas, explore the API reference pages listed in the navigation. To access beta features, see [Beta headers](https://platform.claude.com/docs/en/api/beta-headers) . Authentication -------------------- All requests to the Claude API must include these headers: | Header | Value | Required | | --- | --- | --- | | `x-api-key` | Your API key from Console | Yes | | `anthropic-version` | API version (e.g., `2023-06-01`) | Yes | | `content-type` | `application/json` | Yes | If you are using the [Client SDKs](https://platform.claude.com/docs/en/api/overview#client-sdks) , the SDK will send these headers automatically. For API versioning details, see [API versions](https://platform.claude.com/docs/en/api/versioning) . ### Getting API Keys The API is made available via the web [Console](https://platform.claude.com/) . You can use the [Workbench](https://platform.claude.com/workbench) to try out the API in the browser and then generate API keys in [Account Settings](https://platform.claude.com/settings/keys) . Use [workspaces](https://platform.claude.com/settings/workspaces) to segment your API keys and [control spend](https://platform.claude.com/docs/en/api/rate-limits) by use case. Client SDKs ----------------- Anthropic provides official SDKs that simplify API integration by handling authentication, request formatting, error handling, and more. **Benefits**: * Automatic header management (x-api-key, anthropic-version, content-type) * Type-safe request and response handling * Built-in retry logic and error handling * Streaming support * Request timeouts and connection management For a list of client SDKs and their respective installation instructions, see [Client SDKs](https://platform.claude.com/docs/en/api/client-sdks) . Availability on partner platforms --------------------------------------- Claude is available through the direct Claude API and through partner platforms. Choose based on your infrastructure, compliance requirements, and pricing preferences. ### Claude API * **Direct access** to the latest models and features first * **Anthropic billing and support** * **Best for**: New integrations, full feature access, direct relationship with Anthropic ### Third-Party Platform APIs Access Claude through AWS, Google Cloud, or Microsoft Azure: * **Integrated** with cloud provider billing and IAM * **May have feature delays** or differences from the direct API * **Best for**: Existing cloud commitments, specific compliance requirements, consolidated cloud billing | Platform | Provider | Documentation | | --- | --- | --- | | Amazon Bedrock | AWS | [Claude in Amazon Bedrock](https://platform.claude.com/docs/en/build-with-claude/claude-in-amazon-bedrock) | | Vertex AI | Google Cloud | [Claude on Vertex AI](https://platform.claude.com/docs/en/build-with-claude/claude-on-vertex-ai) | | Azure AI | Microsoft Azure | [Claude on Azure AI](https://platform.claude.com/docs/en/build-with-claude/claude-in-microsoft-foundry) | Claude Managed Agents is available only through the direct Claude API. For feature availability across platforms, see the [Features overview](https://platform.claude.com/docs/en/build-with-claude/overview) . Request and Response Format --------------------------------- ### Request size limits | Endpoint | Maximum request size | | --- | --- | | Messages, Token Counting | 32 MB | | [Batch API](https://platform.claude.com/docs/en/build-with-claude/batch-processing) | 256 MB | | [Files API](https://platform.claude.com/docs/en/build-with-claude/files) | 500 MB | | Sessions, Agents, Environments | 32 MB | If you exceed these limits, you'll receive a 413 `request_too_large` error. Third-party platforms have their own request size limits: Vertex AI limits requests to 30 MB, and Amazon Bedrock limits requests to 20 MB. Consult your platform's documentation for current values. ### Response Headers The Claude API includes the following headers in every response: * `request-id`: A globally unique identifier for the request * `anthropic-organization-id`: The organization ID associated with the API key used in the request Rate Limits and Availability ---------------------------------- ### Rate Limits The API enforces rate limits and spend limits to prevent misuse and manage capacity. Limits are organized into usage tiers that increase automatically as you use the API. Each tier has: * **Spend limits**: Maximum monthly cost for API usage * **Rate limits**: Maximum number of requests per minute (RPM) and tokens per minute (TPM) You can view your organization's current limits in the [Console](https://platform.claude.com/settings/limits) . For higher limits or Priority Tier (enhanced service levels with committed spend), contact sales through the Console. For detailed information about limits, tiers, and the token bucket algorithm used for rate limiting, see [Rate limits](https://platform.claude.com/docs/en/api/rate-limits) . ### Availability The Claude API is available in [many countries and regions](https://platform.claude.com/docs/en/api/supported-regions) worldwide. Check the supported regions page to confirm availability in your location. Next Steps ---------------- [Messages API reference\ \ Complete API specification for direct model interactions](https://platform.claude.com/docs/en/api/messages/create) [Claude Managed Agents reference\ \ Agents, Sessions, and Environments endpoints](https://platform.claude.com/docs/en/api/beta/sessions) [Client SDKs\ \ Python, TypeScript, Java, Go, C#, Ruby, and PHP](https://platform.claude.com/docs/en/api/client-sdks) [Rate limits\ \ Usage tiers, spend limits, and token bucket algorithm](https://platform.claude.com/docs/en/api/rate-limits) Was this page helpful? --- # Claude in Microsoft Foundry - Claude API Docs Loading... 3rd-party platforms Microsoft Foundry Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Was this page helpful? This guide walks you through the process of setting up and making API calls to Claude in Foundry in Python, TypeScript, or using direct HTTP requests. When you can access Claude in Foundry, you are billed for Claude usage in the Microsoft Marketplace with your Azure subscription, allowing you to access Claude's latest capabilities while managing costs through your Azure subscription. Regional availability: At launch, Claude is available as a Global Standard deployment type in Foundry resources (US DataZone coming soon). Pricing for Claude in the Microsoft Marketplace uses Anthropic's standard API pricing. Visit the [pricing page](https://claude.com/pricing#api) for details. Foundry is supported by the C#, Java, PHP, Python, and TypeScript SDKs. The Go and Ruby SDKs do not currently support Microsoft Foundry. For available SDK platform integrations, see [Client SDKs](https://platform.claude.com/docs/en/api/client-sdks) . Preview ------------- In this preview platform integration, Claude models run on Anthropic's infrastructure. This is a commercial integration for billing and access through Azure. As an independent processor for Microsoft, customers using Claude through Microsoft Foundry are subject to Anthropic's data use terms. Anthropic continues to provide its industry-leading safety and data commitments, including zero data retention availability. Prerequisites ------------------- Before you begin, ensure you have: * An active Azure subscription * Access to [Foundry](https://ai.azure.com/) * The [Azure CLI](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli) installed (optional, for resource management) Install an SDK -------------------- Anthropic's [client SDKs](https://platform.claude.com/docs/en/api/client-sdks) support Foundry through platform-specific packages. Provisioning ------------------ Foundry uses a two-level hierarchy: **resources** contain your security and billing configuration, while **deployments** are the model instances you call via API. You'll first create a Foundry resource, then create one or more Claude deployments within it. ### Provisioning Foundry resources Create a Foundry resource, which is required to use and manage services in Azure. You can follow these instructions to create a [Foundry resource](https://learn.microsoft.com/en-us/azure/ai-services/multi-service-resource?pivots=azportal#create-a-new-azure-ai-foundry-resource) . Alternatively, you can start by creating a [Foundry project](https://learn.microsoft.com/en-us/azure/ai-foundry/how-to/create-projects?tabs=ai-foundry) , which involves creating a Foundry resource. To provision your resource: 1. Navigate to the [Foundry portal](https://ai.azure.com/) 2. Create a new Foundry resource or select an existing one 3. Configure access management using Azure-issued API keys or Entra ID for role-based access control 4. Optionally configure the resource to be part of a private network (Azure Virtual Network) for enhanced security 5. Note your resource name. You'll use this as `{resource}` in API endpoints (e.g., `https://{resource}.services.ai.azure.com/anthropic/v1/*`) ### Creating Foundry deployments After creating your resource, deploy a Claude model to make it available for API calls: 1. In the Foundry portal, navigate to your resource 2. Go to **Models + endpoints** and select **\+ Deploy model** > **Deploy base model** 3. Search for and select a Claude model (e.g., `claude-sonnet-4-6`) 4. Configure deployment settings: * **Deployment name:** Defaults to the model ID, but you can customize it (e.g., `my-claude-deployment`). The deployment name cannot be changed after it has been created. * **Deployment type:** Select Global Standard (recommended for Claude) 5. Select **Deploy** and wait for provisioning to complete 6. Once deployed, you can find your endpoint URL and keys under **Keys and Endpoint** The deployment name you choose becomes the value you pass in the `model` parameter of your API requests. You can create multiple deployments of the same model with different names to manage separate configurations or rate limits. Authentication -------------------- Claude on Foundry supports two authentication methods: API keys and Entra ID tokens. Both methods use Azure-hosted endpoints in the format `https://{resource}.services.ai.azure.com/anthropic/v1/*`. ### API key authentication After provisioning your Foundry Claude resource, you can obtain an API key from the Foundry portal: 1. Navigate to your resource in the Foundry portal 2. Go to **Keys and Endpoint** section 3. Copy one of the provided API keys 4. Use either the `api-key` or `x-api-key` header in your requests, or provide it to the SDK The Python and TypeScript SDKs require an API key and either a resource name or base URL. The SDKs will automatically read these from the following environment variables if they are defined: * `ANTHROPIC_FOUNDRY_API_KEY` - Your API key * `ANTHROPIC_FOUNDRY_RESOURCE` - Your resource name (e.g., `example-resource`) * `ANTHROPIC_FOUNDRY_BASE_URL` - Alternative to resource name; the full base URL (e.g., `https://example-resource.services.ai.azure.com/anthropic/`) The `resource` and `base_url` parameters are mutually exclusive. Provide either the resource name (which the SDK uses to construct the URL as `https://{resource}.services.ai.azure.com/anthropic/`) or the full base URL directly. **Example using API key:** Keep your API keys secure. Never commit them to version control or share them publicly. Anyone with access to your API key can make requests to Claude through your Foundry resource. Microsoft Entra authentication ------------------------------------ For enhanced security and centralized access management, you can use Entra ID (formerly Azure Active Directory) tokens: 1. Enable Entra authentication for your Foundry resource 2. Obtain an access token from Entra ID 3. Use the token in the `Authorization: Bearer {TOKEN}` header **Example using Entra ID:** Azure Entra ID authentication allows you to manage access using Azure RBAC, integrate with your organization's identity management, and avoid managing API keys manually. Correlation request IDs ----------------------------- Foundry includes request identifiers in HTTP response headers for debugging and tracing. When contacting support, provide both the `request-id` and `apim-request-id` values to help teams quickly locate and investigate your request across both Anthropic and Azure systems. Supported features ------------------------ Claude on Foundry supports most of Claude's powerful features. You can find all the features currently supported in the [overview documentation](https://platform.claude.com/docs/en/build-with-claude/overview) . ### Context window Claude Opus 4.6 and Claude Sonnet 4.6 have a [1M-token context window](https://platform.claude.com/docs/en/build-with-claude/context-windows) on Microsoft Foundry. Other Claude models, including Sonnet 4.5, have a 200k-token context window. ### Features not supported * Admin API (`/v1/organizations/*` endpoints) * Models API (`/v1/models`) * Message Batch API (`/v1/messages/batches`) API responses ------------------- API responses from Claude on Foundry follow the standard [Claude API response format](https://platform.claude.com/docs/en/api/messages/create) . This includes the `usage` object in response bodies, which provides detailed token consumption information for your requests. The `usage` object is consistent across all platforms (first-party API, Foundry, Amazon Bedrock, and Google Vertex AI). For details on response headers specific to Foundry, see the [correlation request IDs section](https://platform.claude.com/docs/en/build-with-claude/claude-in-microsoft-foundry#correlation-request-ids) . API model IDs and deployments ----------------------------------- The following Claude models are available through Foundry. The latest generation models (Opus 4.6, Sonnet 4.6, and Haiku 4.5) offer the most advanced capabilities: | Model | Default Deployment Name | | --- | --- | | Claude Opus 4.6 | `claude-opus-4-6` | | Claude Opus 4.5 | `claude-opus-4-5` | | Claude Sonnet 4.6 | `claude-sonnet-4-6` | | Claude Sonnet 4.5 | `claude-sonnet-4-5` | | Claude Opus 4.1 | `claude-opus-4-1` | | Claude Haiku 4.5 | `claude-haiku-4-5` | By default, deployment names match the model IDs shown above. However, you can create custom deployments with different names in the Foundry portal to manage different configurations, versions, or rate limits. Use the deployment name (not necessarily the model ID) in your API requests. Monitoring and logging ---------------------------- Azure provides comprehensive monitoring and logging capabilities for your Claude usage through standard Azure patterns: * **Azure Monitor:** Track API usage, latency, and error rates * **Azure Log Analytics:** Query and analyze request/response logs * **Cost Management:** Monitor and forecast costs associated with Claude usage Anthropic recommends logging your activity on at least a 30-day rolling basis to understand usage patterns and investigate any potential issues. Azure's logging services are configured within your Azure subscription. Enabling logging does not provide Microsoft or Anthropic access to your content beyond what's necessary for billing and service operation. Troubleshooting --------------------- ### Authentication errors **Error:** `401 Unauthorized` or `Invalid API key` * **Solution:** Verify your API key is correct. You can obtain a new API key from the Azure portal under **Keys and Endpoint** for your Claude resource. * **Solution:** If using Azure Entra ID, ensure your access token is valid and hasn't expired. Tokens typically expire after 1 hour. **Error:** `403 Forbidden` * **Solution:** Your Azure account may lack the necessary permissions. Ensure you have the appropriate Azure RBAC role assigned (e.g., "Cognitive Services OpenAI User"). ### Rate limiting **Error:** `429 Too Many Requests` * **Solution:** You've exceeded your rate limit. Implement exponential backoff and retry logic in your application. * **Solution:** Consider requesting rate limit increases through the Azure portal or Azure support. #### Rate limit headers Foundry does not include Anthropic's standard rate limit headers (`anthropic-ratelimit-tokens-limit`, `anthropic-ratelimit-tokens-remaining`, `anthropic-ratelimit-tokens-reset`, `anthropic-ratelimit-input-tokens-limit`, `anthropic-ratelimit-input-tokens-remaining`, `anthropic-ratelimit-input-tokens-reset`, `anthropic-ratelimit-output-tokens-limit`, `anthropic-ratelimit-output-tokens-remaining`, and `anthropic-ratelimit-output-tokens-reset`) in responses. Manage rate limiting through Azure's monitoring tools instead. ### Model and deployment errors **Error:** `Model not found` or `Deployment not found` * **Solution:** Verify you're using the correct deployment name. If you haven't created a custom deployment, use the default model ID (e.g., `claude-sonnet-4-6`). * **Solution:** Ensure the model/deployment is available in your Azure region. **Error:** `Invalid model parameter` * **Solution:** The model parameter should contain your deployment name, which can be customized in the Foundry portal. Verify the deployment exists and is properly configured. [Claude Mythos Preview](https://anthropic.com/glasswing) is a research preview available to invited customers on Microsoft Foundry. For more information, see [Project Glasswing](https://anthropic.com/glasswing) . Additional resources -------------------------- * **Foundry documentation:** [ai.azure.com/catalog](https://ai.azure.com/catalog/publishers/anthropic) * **Azure pricing:** [azure.microsoft.com/en-us/pricing](https://azure.microsoft.com/en-us/pricing/) * **Anthropic pricing details:** [Pricing documentation](https://platform.claude.com/docs/en/about-claude/pricing#third-party-platform-pricing) * **Authentication guide:** See the [authentication section](https://platform.claude.com/docs/en/build-with-claude/claude-in-microsoft-foundry#authentication) above * **Azure portal:** [portal.azure.com](https://portal.azure.com/) Python Python TypeScript TypeScript C# C# Java Java PHP PHP Shell Shell CLI CLI Python Python TypeScript TypeScript C# C# Java Java PHP PHP Ruby Ruby Shell Shell Python Python TypeScript TypeScript C# C# Java Java PHP PHP Ruby Ruby --- # OpenAI SDK compatibility - Claude API Docs Loading... Compatibility OpenAI SDK compatibility Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Was this page helpful? This compatibility layer is primarily intended to test and compare model capabilities, and is not considered a long-term or production-ready solution for most use cases. While it is intended to remain fully functional and not have breaking changes, the priority is the reliability and effectiveness of the [Claude API](https://platform.claude.com/docs/en/api/overview) . For more information on known compatibility limitations, see [Important OpenAI compatibility limitations](https://platform.claude.com/docs/en/api/openai-sdk#important-openai-compatibility-limitations) . If you encounter any issues with the OpenAI SDK compatibility feature, please share your feedback via this [compatibility feedback form](https://forms.gle/oQV4McQNiuuNbz9n8) . For the best experience and access to Claude API full feature set ([PDF processing](https://platform.claude.com/docs/en/build-with-claude/pdf-support) , [citations](https://platform.claude.com/docs/en/build-with-claude/citations) , [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking) , and [prompt caching](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) ), use the native [Claude API](https://platform.claude.com/docs/en/api/overview) . Getting started with the OpenAI SDK ----------------------------------------- To use the OpenAI SDK compatibility feature, you'll need to: 1. Use an official OpenAI SDK 2. Change the following * Update your base URL to point to the Claude API * Replace your API key with a [Claude API key](https://platform.claude.com/settings/keys) * Update your model name to use a [Claude model](https://platform.claude.com/docs/en/about-claude/models/overview) 3. Review the documentation below for what features are supported ### Quick start example Important OpenAI compatibility limitations ------------------------------------------------ ### API behavior Here are the most substantial differences from using OpenAI: * The `strict` parameter for function calling is ignored, which means the tool use JSON is not guaranteed to follow the supplied schema. For guaranteed schema conformance, use the native [Claude API with Structured Outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs) . * Audio input is not supported; it will simply be ignored and stripped from input * Prompt caching is not supported, but it is supported in [the Anthropic SDK](https://platform.claude.com/docs/en/api/client-sdks) * System/developer messages are hoisted and concatenated to the beginning of the conversation, as Anthropic only supports a single initial system message. Most unsupported fields are silently ignored rather than producing errors. These are all documented below. ### Output quality considerations If you’ve done lots of tweaking to your prompt, it’s likely to be well-tuned to OpenAI specifically. Consider using the [prompt improver in the Claude Console](https://platform.claude.com/dashboard) as a good starting point. ### System / developer message hoisting Most of the inputs to the OpenAI SDK clearly map directly to Anthropic’s API parameters, but one distinct difference is the handling of system / developer prompts. These two prompts can be put throughout a chat conversation via OpenAI. Since Anthropic only supports an initial system message, the API takes all system/developer messages and concatenates them together with a single newline (`\n`) in between them. This full string is then supplied as a single system message at the start of the messages. ### Extended thinking support You can enable [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking) capabilities by adding the `thinking` parameter. While this improves Claude's reasoning for complex tasks, the OpenAI SDK doesn't return Claude's detailed thought process. For full extended thinking features, including access to Claude's step-by-step reasoning output, use the native Claude API. Python response = client.chat.completions.create( model="claude-sonnet-4-6", messages=[{"role": "user", "content": "Who are you?"}], extra_body={"thinking": {"type": "enabled", "budget_tokens": 2000}}, ) Rate limits ----------------- Rate limits follow Anthropic's [standard limits](https://platform.claude.com/docs/en/api/rate-limits) for the `/v1/messages` endpoint. Detailed OpenAI compatible API support -------------------------------------------- ### Request fields #### Simple fields | Field | Support status | | --- | --- | | `model` | Use Claude model names | | `max_tokens` | Fully supported | | `max_completion_tokens` | Fully supported | | `stream` | Fully supported | | `stream_options` | Fully supported | | `top_p` | Fully supported | | `parallel_tool_calls` | Fully supported | | `stop` | All non-whitespace stop sequences work | #### `tools` / `functions` fields ### Show fields #### `messages` array fields ### Show fields ### Response fields | Field | Support status | | --- | --- | | `id` | Fully supported | | `choices[]` | Will always have a length of 1 | | `choices[].finish_reason` | Fully supported | | `choices[].index` | Fully supported | | `choices[].message.role` | Fully supported | | `choices[].message.content` | Fully supported | | `choices[].message.tool_calls` | Fully supported | | `object` | ### Error message compatibility The compatibility layer maintains consistent error formats with the OpenAI API. However, the detailed error messages will not be equivalent. Only use the error messages for logging and debugging. ### Header compatibility While the OpenAI SDK automatically manages headers, here is the complete list of headers supported by the Claude API for developers who need to work with them directly. | Header | Support Status | | --- | --- | | `x-ratelimit-limit-requests` | Fully supported | | `x-ratelimit-limit-tokens` | Fully supported | | `x-ratelimit-remaining-requests` | Fully supported | | `x-ratelimit-remaining-tokens` | Fully supported | | `x-ratelimit-reset-requests` | Fully supported | | `x-ratelimit-reset-tokens` | Fully supported | | `retry-after` | Fully supported | | `request-id` | Python import os from openai import OpenAI client = OpenAI( api_key=os.environ.get("ANTHROPIC_API_KEY"), # Your Claude API key base_url="https://api.anthropic.com/v1/", # the Claude API endpoint ) response = client.chat.completions.create( model="claude-opus-4-6", # Claude model name messages=[\ {"role": "system", "content": "You are a helpful assistant."},\ {"role": "user", "content": "Who are you?"},\ ], ) print(response.choices[0].message.content) | | | | --- | --- | | `temperature` | Between 0 and 1 (inclusive). Values greater than 1 are capped at 1. | | | | | --- | --- | | `n` | Must be exactly 1 | | | | | --- | --- | | `logprobs` | Ignored | | | | | --- | --- | | `metadata` | Ignored | | | | | --- | --- | | `response_format` | Ignored. For JSON output, use [Structured Outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)
with the native Claude API | | | | | --- | --- | | `prediction` | Ignored | | | | | --- | --- | | `presence_penalty` | Ignored | | | | | --- | --- | | `frequency_penalty` | Ignored | | | | | --- | --- | | `seed` | Ignored | | | | | --- | --- | | `service_tier` | Ignored | | | | | --- | --- | | `audio` | Ignored | | | | | --- | --- | | `logit_bias` | Ignored | | | | | --- | --- | | `store` | Ignored | | | | | --- | --- | | `user` | Ignored | | | | | --- | --- | | `modalities` | Ignored | | | | | --- | --- | | `top_logprobs` | Ignored | | | | | --- | --- | | `reasoning_effort` | Ignored | Fully supported | | | | --- | --- | | `created` | Fully supported | | | | | --- | --- | | `model` | Fully supported | | | | | --- | --- | | `finish_reason` | Fully supported | | | | | --- | --- | | `content` | Fully supported | | | | | --- | --- | | `usage.completion_tokens` | Fully supported | | | | | --- | --- | | `usage.prompt_tokens` | Fully supported | | | | | --- | --- | | `usage.total_tokens` | Fully supported | | | | | --- | --- | | `usage.completion_tokens_details` | Always empty | | | | | --- | --- | | `usage.prompt_tokens_details` | Always empty | | | | | --- | --- | | `choices[].message.refusal` | Always empty | | | | | --- | --- | | `choices[].message.audio` | Always empty | | | | | --- | --- | | `logprobs` | Always empty | | | | | --- | --- | | `service_tier` | Always empty | | | | | --- | --- | | `system_fingerprint` | Always empty | Fully supported | | | | --- | --- | | `openai-version` | Always `2020-10-01` | | | | | --- | --- | | `authorization` | Fully supported | | | | | --- | --- | | `openai-processing-ms` | Always empty | --- # Claude on Vertex AI - Claude API Docs Loading... 3rd-party platforms Vertex AI Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Was this page helpful? The Vertex API for accessing Claude is nearly-identical to the [Messages API](https://platform.claude.com/docs/en/api/messages/create) and supports all of the same options, with two key differences: * In Vertex, `model` is not passed in the request body. Instead, it is specified in the Google Cloud endpoint URL. * In Vertex, `anthropic_version` is passed in the request body (rather than as a header), and must be set to the value `vertex-2023-10-16`. Vertex is also supported by Anthropic's official [client SDKs](https://platform.claude.com/docs/en/api/client-sdks) . This guide walks you through making a request to Claude on Vertex AI using one of Anthropic's client SDKs. Note that this guide assumes you already have a GCP project that is able to use Vertex AI. See [using the Claude 3 models from Anthropic](https://cloud.google.com/vertex-ai/generative-ai/docs/partner-models/use-claude) for more information on the setup required, as well as a full walkthrough. Install an SDK for accessing Vertex AI -------------------------------------------- First, install Anthropic's [client SDK](https://platform.claude.com/docs/en/api/client-sdks) for your language of choice. Python Python TypeScript TypeScript C# C# Go Go Java Java PHP PHP Ruby Ruby Accessing Vertex AI ------------------------- ### Model availability Note that Anthropic model availability varies by region. Search for "Claude" in the [Vertex AI Model Garden](https://cloud.google.com/model-garden) or go to [Use Claude 3](https://cloud.google.com/vertex-ai/generative-ai/docs/partner-models/use-claude) for the latest information. #### API model IDs | Model | Vertex AI API model ID | | --- | --- | | Claude Opus 4.6 | claude-opus-4-6 | | Claude Sonnet 4.6 | claude-sonnet-4-6 | | Claude Sonnet 4.5 | claude-sonnet-4-5@20250929 | | Claude Sonnet 4 | claude-sonnet-4@20250514 | | Claude Sonnet 3.7 ⚠️ | claude-3-7-sonnet@20250219 | | Claude Opus 4.5 | claude-opus-4-5@20251101 | | Claude Opus 4.1 | claude-opus-4-1@20250805 | | Claude Opus 4 | claude-opus-4@20250514 | | Claude Haiku 4.5 | claude-haiku-4-5@20251001 | | Claude Haiku 3.5 ⚠️ | claude-3-5-haiku@20241022 | | Claude Haiku 3 ⚠️ | ### Making requests Before running requests you may need to run `gcloud auth application-default login` to authenticate with GCP. The following examples show how to generate text from Claude on Vertex AI: See the [client SDKs](https://platform.claude.com/docs/en/api/client-sdks) and the official [Vertex AI docs](https://cloud.google.com/vertex-ai/docs) for more details. Claude is also available through [Amazon Bedrock](https://platform.claude.com/docs/en/build-with-claude/claude-in-amazon-bedrock) and [Microsoft Foundry](https://platform.claude.com/docs/en/build-with-claude/claude-in-microsoft-foundry) . Activity logging ---------------------- Vertex provides a [request-response logging service](https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/request-response-logging) that allows customers to log the prompts and completions associated with your usage. Anthropic recommends that you log your activity on at least a 30-day rolling basis in order to understand your activity and investigate any potential misuse. Turning on this service does not give Google or Anthropic any access to your content. Feature support --------------------- For all currently supported features on Vertex AI, see [API features overview](https://platform.claude.com/docs/en/api/overview) . ### Context window Claude Opus 4.6 and Claude Sonnet 4.6 have a [1M-token context window](https://platform.claude.com/docs/en/build-with-claude/context-windows) on Vertex AI. Other Claude models, including Sonnet 4.5 and Sonnet 4, have a 200k-token context window. Vertex AI limits request payloads to 30 MB. When sending large documents or many images, you may reach this limit before the token limit. Global, multi-region, and regional endpoints -------------------------------------------------- Google Vertex AI offers three endpoint types: * **Global endpoints:** Dynamic routing for maximum availability * **Multi-region endpoints:** Dynamic routing within a geographic area (for example, the United States) for data residency with high availability * **Regional endpoints:** Guaranteed data routing through specific geographic regions Regional and multi-region endpoints include a 10% pricing premium over global endpoints. This applies to Claude Sonnet 4.5 and future models only. Older models (Claude Sonnet 4, Opus 4, and earlier) maintain their existing pricing structures. ### When to use each option **Global endpoints (recommended):** * Provide maximum availability and uptime * Dynamically route requests to regions with available capacity * No pricing premium * Best for applications where data residency is flexible * Only supports pay-as-you-go traffic (provisioned throughput requires regional endpoints) **Multi-region endpoints:** * Dynamically route requests across regions within a geographic area (currently `us`, with `eu` coming soon) * Useful when you need data residency within a broad geography but want higher availability than a single region * 10% pricing premium over global endpoints * Only supports pay-as-you-go traffic (provisioned throughput requires regional endpoints) **Regional endpoints:** * Route traffic through specific geographic regions * Required for single-region data residency, strict compliance mandates, or provisioned throughput * Support both pay-as-you-go and provisioned throughput * 10% pricing premium reflects infrastructure costs for dedicated regional capacity ### Implementation **Using global endpoints (recommended):** Set the `region` parameter to `"global"` when initializing the client: **Using multi-region endpoints:** Set the `region` parameter to a multi-region identifier such as `"us"`. The SDK routes requests to the multi-region endpoint (for example, `https://aiplatform.us.rep.googleapis.com`), which dynamically balances traffic across regions within that geography. **Using regional endpoints:** Specify a specific region like `"us-east1"` or `"europe-west1"`: Claude Mythos Preview is a research preview available to invited customers on Google Vertex AI. For more information, see [Project Glasswing](https://anthropic.com/glasswing) . ### Additional resources * **Google Vertex AI pricing:** [cloud.google.com/vertex-ai/generative-ai/pricing](https://cloud.google.com/vertex-ai/generative-ai/pricing) * **Claude models documentation:** [Claude on Vertex AI](https://cloud.google.com/vertex-ai/generative-ai/docs/partner-models/claude) * **Google blog post:** [Global endpoint for Claude models](https://cloud.google.com/blog/products/ai-machine-learning/global-endpoint-for-claude-models-generally-available-on-vertex-ai) * **Anthropic pricing details:** [Pricing documentation](https://platform.claude.com/docs/en/about-claude/pricing#third-party-platform-pricing) claude-3-haiku@20240307 Shell MODEL_ID=claude-opus-4-6 LOCATION=global PROJECT_ID=MY_PROJECT_ID curl \ -X POST \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/json" \ https://$LOCATION-aiplatform.googleapis.com/v1/projects/${PROJECT_ID}/locations/${LOCATION}/publishers/anthropic/models/${MODEL_ID}:streamRawPredict -d \ '{ "anthropic_version": "vertex-2023-10-16", "messages": [{\ "role": "user",\ "content": "Hey Claude!"\ }], "max_tokens": 100, }' CLI # The ant CLI does not yet support Vertex AI. Python from anthropic import AnthropicVertex project_id = "MY_PROJECT_ID" region = "us" # Multi-region: routes within US regions client = AnthropicVertex(project_id=project_id, region=region) message = client.messages.create( model="claude-opus-4-6", max_tokens=100, messages=[\ {\ "role": "user",\ "content": "Hey Claude!",\ }\ ], ) print(message) CLI # The ant CLI does not yet support Vertex AI. --- # Text generation - Claude API Docs Loading... Documentation Page Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Prompts are best written as natural language queries as if you are instructing someone to do something, with the more detail the better. You can further improve your baseline prompt with [prompt engineering](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/overview) . * * * Text capabilities and use cases ------------------------------------- Claude has a broad range of text-based capabilities, including but not limited to: | Capability | This enables you to... | | --- | --- | | Text Summarization | Distill lengthy content into key insights for executives, social media, or product teams. | | Content Generation | Craft compelling content from blog posts and emails to marketing slogans and product descriptions. | | Data / Entity Extraction | Uncover structured insights from unstructured text like reviews, news articles, or transcripts. | | Question Answering | Build intelligent, interactive systems from customer support chatbots to educational AI tutors. | | Text Translation | Seamlessly communicate across languages in products, support, and content creation. | | Text Analysis & Recommendations | Understand sentiment, preferences, and patterns to personalize user experiences and offerings. | | Dialogue and Conversation | Create engaging, context-aware interactions in games, virtual assistants, and storytelling apps. | | Code Explanation & Generation | Accelerate development with instant code reviews, boilerplate generation, and interactive tutorials. | * * * Claude Cookbook --------------------- Dive into practical examples and hands-on tutorials with the collection of Jupyter notebooks. [PDF Upload & Summarization\ \ Learn how to upload PDFs and have Claude summarize their content, making it easy to digest long documents.](https://platform.claude.com/cookbook/misc-pdf-upload-summarization) [Tool Use & Function Calling\ \ Discover how to extend Claude's capabilities by integrating external tools and functions into your workflows.](https://platform.claude.com/cookbook/tool-use-calculator-tool) [Embeddings with VoyageAI\ \ Explore how to create and use embeddings with VoyageAI for advanced text similarity and search tasks.](https://platform.claude.com/cookbook/capabilities-contextual-embeddings-guide) More Resources -------------------- From crafting the perfect prompt to understanding API details, these resources can help. [Prompt Engineering Guide\ \ Master the art of prompt crafting to get the most out of Claude.](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/overview) [API Documentation\ \ Everything you need to interact with Claude via the API: request formats, response handling, and troubleshooting.](https://platform.claude.com/docs/en/api/overview) Was this page helpful? --- # Create a Message - Claude API Reference Loading... Messages Create Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... --- # Sessions - Claude API Reference Loading... Beta Sessions Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... --- # Messages - Claude API Reference Loading... API Reference Messages Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... --- # Count tokens in a Message - Claude API Reference Loading... Messages Count tokens Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... --- # Retrieve a Message Batch - Claude API Reference Loading... Batches Retrieve Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... --- # Upload File - Claude API Reference Loading... Files Upload Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... --- # Delete a Message Batch - Claude API Reference Loading... Batches Delete Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... --- # List Models - Claude API Reference Loading... Models List Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... --- # Retrieve Message Batch results - Claude API Reference Loading... Batches Results Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... --- # Cancel a Message Batch - Claude API Reference Loading... Batches Cancel Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... --- # Create a Message Batch - Claude API Reference Loading... Batches Create Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... --- # Create Skill - Claude API Reference Loading... Skills Create Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... --- # List Message Batches - Claude API Reference Loading... Batches List Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... --- # Glossar - Claude API Docs Loading... Ressourcen Glossar Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Context window -------------------- Das „Context window" bezieht sich auf die Menge an Text, auf die ein Sprachmodell zurückblicken und verweisen kann, wenn es neuen Text generiert. Dies unterscheidet sich vom großen Datenbestand, auf dem das Sprachmodell trainiert wurde, und stellt stattdessen einen „Arbeitsspeicher" für das Modell dar. Ein größeres Context window ermöglicht es dem Modell, komplexere und längere Eingabeaufforderungen zu verstehen und darauf zu reagieren, während ein kleineres Context window die Fähigkeit des Modells, längere Eingabeaufforderungen zu verarbeiten oder die Kohärenz über längere Gespräche hinweg zu bewahren, einschränken kann. Siehe unseren [Leitfaden zum Verständnis von Context Windows](https://platform.claude.com/docs/de/build-with-claude/context-windows) , um mehr zu erfahren. Fine-tuning ----------------- Fine-tuning ist der Prozess des weiteren Trainings eines vortrainierten Sprachmodells mit zusätzlichen Daten. Dies führt dazu, dass das Modell beginnt, die Muster und Merkmale des Fine-tuning-Datensatzes darzustellen und nachzuahmen. Claude ist kein reines Sprachmodell; es wurde bereits fine-tuned, um ein hilfreicher Assistent zu sein. Unsere API bietet derzeit kein Fine-tuning an, aber bitte kontaktieren Sie Ihren Anthropic-Ansprechpartner, wenn Sie daran interessiert sind, diese Option zu erkunden. Fine-tuning kann nützlich sein, um ein Sprachmodell an eine bestimmte Domäne, Aufgabe oder einen bestimmten Schreibstil anzupassen, erfordert aber eine sorgfältige Überlegung der Fine-tuning-Daten und der möglichen Auswirkungen auf die Leistung und Verzerrungen des Modells. HHH --------- Diese drei H's stellen Anthropics Ziele dar, um sicherzustellen, dass Claude der Gesellschaft zugute kommt: * Ein **hilfreicher** KI wird versuchen, die Aufgabe auszuführen oder die gestellte Frage nach besten Kräften zu beantworten und relevante und nützliche Informationen bereitzustellen. * Eine **ehrliche** KI wird genaue Informationen geben und nicht halluzinieren oder konfabulieren. Sie wird ihre Grenzen und Unsicherheiten angemessen anerkennen. * Eine **harmlose** KI wird nicht beleidigend oder diskriminierend sein, und wenn sie aufgefordert wird, bei einer gefährlichen oder unethischen Handlung zu helfen, sollte die KI höflich ablehnen und erklären, warum sie nicht zustimmen kann. Latency ------------- Latency bezieht sich im Kontext von generativer KI und großen Sprachmodellen auf die Zeit, die das Modell benötigt, um auf eine gegebene Eingabeaufforderung zu reagieren. Es ist die Verzögerung zwischen dem Absenden einer Eingabeaufforderung und dem Empfang der generierten Ausgabe. Eine niedrigere Latency deutet auf schnellere Antwortzeiten hin, was für Echtzeitanwendungen, Chatbots und interaktive Erfahrungen entscheidend ist. Faktoren, die die Latency beeinflussen können, sind die Modellgröße, Hardwarefunktionen, Netzwerkbedingungen und die Komplexität der Eingabeaufforderung und der generierten Antwort. LLM --------- Large Language Models (LLMs) sind KI-Sprachmodelle mit vielen Parametern, die eine Vielzahl überraschend nützlicher Aufgaben ausführen können. Diese Modelle werden auf großen Mengen von Textdaten trainiert und können menschenähnliche Texte generieren, Fragen beantworten, Informationen zusammenfassen und vieles mehr. Claude ist ein Konversationsassistent, der auf einem großen Sprachmodell basiert, das mit RLHF fine-tuned und trainiert wurde, um hilfreicher, ehrlicher und harmloser zu sein. MCP (Model Context Protocol) ---------------------------------- Model Context Protocol (MCP) ist ein offenes Protokoll, das standardisiert, wie Anwendungen Kontext für LLMs bereitstellen. Wie ein USB-C-Anschluss für KI-Anwendungen bietet MCP eine einheitliche Möglichkeit, KI-Modelle mit verschiedenen Datenquellen und Tools zu verbinden. MCP ermöglicht es KI-Systemen, einen konsistenten Kontext über Interaktionen hinweg zu bewahren und auf externe Ressourcen auf standardisierte Weise zuzugreifen. Siehe unsere [MCP-Dokumentation](https://platform.claude.com/docs/de/mcp) , um mehr zu erfahren. MCP connector ------------------- Der MCP connector ist eine Funktion, die es API-Benutzern ermöglicht, sich direkt von der Messages API aus mit MCP-Servern zu verbinden, ohne einen MCP-Client zu erstellen. Dies ermöglicht eine nahtlose Integration mit MCP-kompatiblen Tools und Services über die Claude API. Der MCP connector unterstützt Funktionen wie Tool Calling und ist in öffentlicher Beta verfügbar. Siehe unsere [MCP-Connector-Dokumentation](https://platform.claude.com/docs/de/agents-and-tools/mcp-connector) , um mehr zu erfahren. Pretraining ----------------- Pretraining ist der anfängliche Prozess des Trainings von Sprachmodellen auf einem großen, nicht gekennzeichneten Textkorpus. Im Fall von Claude werden autoregressive Sprachmodelle (wie Claudes zugrunde liegendes Modell) vortrainiert, um das nächste Wort vorherzusagen, gegeben den vorherigen Kontext des Textes im Dokument. Diese vortrainierten Modelle sind nicht von Natur aus gut darin, Fragen zu beantworten oder Anweisungen zu befolgen, und erfordern oft tiefe Fähigkeiten im Prompt Engineering, um gewünschte Verhaltensweisen hervorzurufen. Fine-tuning und RLHF werden verwendet, um diese vortrainierten Modelle zu verfeinern und sie für eine breite Palette von Aufgaben nützlicher zu machen. RAG (Retrieval augmented generation) ------------------------------------------ Retrieval augmented generation (RAG) ist eine Technik, die Informationsbeschaffung mit Sprachmodellgenerierung kombiniert, um die Genauigkeit und Relevanz des generierten Textes zu verbessern und die Antwort des Modells besser in Evidenz zu verankern. Bei RAG wird ein Sprachmodell mit einer externen Wissensdatenbank oder einer Reihe von Dokumenten erweitert, die in das Context window übergeben werden. Die Daten werden zur Laufzeit abgerufen, wenn eine Abfrage an das Modell gesendet wird, obwohl das Modell selbst die Daten nicht unbedingt abruft (aber mit [Tool Use](https://platform.claude.com/docs/de/agents-and-tools/tool-use/overview) und einer Abruffunktion kann). Bei der Textgenerierung müssen zunächst relevante Informationen aus der Wissensdatenbank basierend auf der Eingabeaufforderung abgerufen und dann zusammen mit der ursprünglichen Abfrage an das Modell übergeben werden. Das Modell nutzt diese Informationen, um die Ausgabe zu lenken, die es generiert. Dies ermöglicht es dem Modell, auf Informationen zuzugreifen und diese zu nutzen, die über seine Trainingsdaten hinausgehen, wodurch die Abhängigkeit von Memorisierung verringert und die faktische Genauigkeit des generierten Textes verbessert wird. RAG kann besonders nützlich für Aufgaben sein, die aktuelle Informationen, domänenspezifisches Wissen oder explizite Quellenangaben erfordern. Die Effektivität von RAG hängt jedoch von der Qualität und Relevanz der externen Wissensdatenbank und des Wissens ab, das zur Laufzeit abgerufen wird. RLHF ---------- Reinforcement Learning from Human Feedback (RLHF) ist eine Technik, die verwendet wird, um ein vortrainiertes Sprachmodell so zu trainieren, dass es sich auf eine Weise verhält, die mit menschlichen Vorlieben übereinstimmt. Dies kann dem Modell helfen, Anweisungen effektiver zu befolgen oder sich mehr wie ein Chatbot zu verhalten. Menschliches Feedback besteht darin, eine Reihe von zwei oder mehr Beispieltexten zu bewerten, und der Reinforcement-Learning-Prozess ermutigt das Modell, Ausgaben zu bevorzugen, die den höher bewerteten ähnlich sind. Claude wurde mit RLHF trainiert, um ein hilfreicher Assistent zu sein. Weitere Details finden Sie in [Anthropics Papier zu diesem Thema](https://arxiv.org/abs/2204.05862) . Temperature ----------------- Temperature ist ein Parameter, der die Zufälligkeit der Vorhersagen eines Modells während der Textgenerierung steuert. Höhere Temperaturen führen zu kreativeren und vielfältigeren Ausgaben und ermöglichen mehrere Variationen in der Formulierung und im Fall von Fiktion auch Variationen in den Antworten. Niedrigere Temperaturen führen zu konservativeren und deterministischeren Ausgaben, die sich an die wahrscheinlichste Formulierung und Antworten halten. Durch die Anpassung der Temperature können Benutzer ein Sprachmodell dazu ermutigen, seltene, ungewöhnliche oder überraschende Wortwahlmöglichkeiten und Sequenzen zu erkunden, anstatt nur die wahrscheinlichsten Vorhersagen auszuwählen. Benutzer können auf Nicht-Determinismus in APIs stoßen. Selbst wenn die Temperature auf 0 eingestellt ist, sind die Ergebnisse nicht vollständig deterministisch und identische Eingaben können über API-Aufrufe hinweg unterschiedliche Ausgaben erzeugen. Dies gilt sowohl für Anthropics First-Party-Inferenzdienst als auch für Inferenzen über Cloud-Provider von Drittanbietern. TTFT (Time to first token) -------------------------------- Time to First Token (TTFT) ist eine Leistungsmetrik, die die Zeit misst, die ein Sprachmodell benötigt, um das erste Token seiner Ausgabe zu generieren, nachdem es eine Eingabeaufforderung erhalten hat. Es ist ein wichtiger Indikator für die Reaktionsfähigkeit des Modells und ist besonders relevant für interaktive Anwendungen, Chatbots und Echtzeitssysteme, in denen Benutzer schnelles initiales Feedback erwarten. Ein niedrigeres TTFT zeigt an, dass das Modell schneller mit der Generierung einer Antwort beginnen kann und ein nahtloseres und ansprechenderes Benutzererlebnis bietet. Faktoren, die TTFT beeinflussen können, sind die Modellgröße, Hardwarefunktionen, Netzwerkbedingungen und die Komplexität der Eingabeaufforderung. Tokens ------------ Tokens sind die kleinsten einzelnen Einheiten eines Sprachmodells und können Wörtern, Subwörtern, Zeichen oder sogar Bytes (im Fall von Unicode) entsprechen. Für Claude stellt ein Token ungefähr 3,5 englische Zeichen dar, obwohl die genaue Anzahl je nach verwendeter Sprache variieren kann. Tokens sind normalerweise verborgen, wenn mit Sprachmodellen auf der „Text"-Ebene interagiert wird, werden aber relevant, wenn die genauen Eingaben und Ausgaben eines Sprachmodells untersucht werden. Wenn Claude Text zur Bewertung bereitgestellt wird, wird der Text (bestehend aus einer Reihe von Zeichen) in eine Reihe von Tokens für das Modell zur Verarbeitung kodiert. Größere Tokens ermöglichen Dateneffizienz während Inferenz und Pretraining (und werden wenn möglich genutzt), während kleinere Tokens es einem Modell ermöglichen, ungewöhnliche oder noch nie zuvor gesehene Wörter zu verarbeiten. Die Wahl der Tokenisierungsmethode kann die Leistung des Modells, die Vokabulargröße und die Fähigkeit, mit Wörtern außerhalb des Vokabulars umzugehen, beeinflussen. Was this page helpful? --- # Documentation - Claude API Docs Loading... Ressourcen Übersicht Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Modellkarten ---------------- [Claude Opus 4.6 System Card\ \ Detaillierte Dokumentation von Claude Opus 4.6.](https://www.anthropic.com/claude-opus-4-6-system-card) [Claude Opus 4.5 System Card\ \ Detaillierte Dokumentation von Claude Opus 4.5.](https://www.anthropic.com/claude-opus-4-5-system-card) [Claude Haiku 4.5 System Card\ \ Detaillierte Dokumentation von Claude Haiku 4.5.](https://www.anthropic.com/claude-haiku-4-5-system-card) [Claude Sonnet 4.5 System Card\ \ Detaillierte Dokumentation von Claude Sonnet 4.5.](https://www.anthropic.com/claude-sonnet-4-5-system-card) [Claude Opus 4.1 System Card\ \ Detaillierte Dokumentation von Claude Opus 4.1.](https://www.anthropic.com/claude-opus-4-1-system-card) [Claude 4 System Card\ \ Detaillierte Dokumentation von Claude 4 Modellen.](https://www-cdn.anthropic.com/6be99a52cb68eb70eb9572b4cafad13df32ed995.pdf) [Claude Sonnet 3.7 System Card\ \ System Card für Claude Sonnet 3.7 mit Leistungs- und Sicherheitsdetails.](https://anthropic.com/claude-3-7-sonnet-system-card) [Claude 3 Model Card\ \ Detaillierte Dokumentation von Claude 3 Modellen einschließlich des neuesten 3.5 Anhangs.](https://assets.anthropic.com/m/61e7d27f8c8f5919/original/Claude-3-Model-Card.pdf) Lernressourcen ------------------ [Schnellstarts\ \ Bereitstellbare Anwendungen, die mit unserer API erstellt wurden.](https://github.com/anthropics/anthropic-quickstarts) [Kurse\ \ Schritt-für-Schritt-Lektionen zum Erstellen mit Claude.](https://anthropic.skilljar.com/) [Cookbook\ \ Reproduzierbare Codebeispiele und Implementierungen.](https://platform.claude.com/cookbooks) [Anwendungsfallanleitungen\ \ Umfassende Produktionsleitfäden zum Erstellen häufiger Anwendungsfälle mit Claude.](https://platform.claude.com/docs/de/about-claude/use-case-guides/overview) [Glossar\ \ Wichtige Begriffe und Konzepte für die Arbeit mit Claude und Sprachmodellen.](https://platform.claude.com/docs/de/about-claude/glossary) Ressourcen für KI-Aufnahme ------------------------------ [API-Grundlagen für Claude-Aufnahme\ \ Prägnanter API-Leitfaden für die Aufnahme durch Claude.](https://platform.claude.com/docs/de/claude_api_primer.md) [Claude API Docs Übersicht\ \ Prägnante Übersicht der Claude API-Dokumentation, optimiert für LLM-Aufnahme.](https://platform.claude.com/docs/for-claude) [llms.txt\ \ LLM-optimierter Dokumentationsindex.](https://platform.claude.com/llms.txt) [llms-full.txt\ \ Vollständige LLM-optimierte Dokumentation.](https://platform.claude.com/llms-full.txt) --- # Leitfäden für häufige Anwendungsfälle - Claude API Docs Loading... Anwendungsfälle Übersicht Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Claude ist darauf ausgelegt, bei einer Vielzahl von Aufgaben zu überzeugen. Entdecken Sie diese ausführlichen Produktionsleitfäden, um zu erfahren, wie Sie häufige Anwendungsfälle mit Claude umsetzen können. [Ticket-Routing\ \ Best Practices für die Verwendung von Claude zur Klassifizierung und Weiterleitung von Kundenservice-Tickets im großen Maßstab.](https://platform.claude.com/docs/de/about-claude/use-case-guides/ticket-routing) [Kundenservice-Agent\ \ Entwickeln Sie intelligente, kontextbewusste Chatbots mit Claude zur Verbesserung von Kundenservice-Interaktionen.](https://platform.claude.com/docs/de/about-claude/use-case-guides/customer-support-chat) [Inhaltsmoderationt\ \ Techniken und Best Practices für die Verwendung von Claude zur Inhaltsfilterung und allgemeinen Inhaltsmoderation.](https://platform.claude.com/docs/de/about-claude/use-case-guides/content-moderation) [Rechtliche Zusammenfassung\ \ Fassen Sie juristische Dokumente mit Claude zusammen, um wichtige Informationen zu extrahieren und die Recherche zu beschleunigen.](https://platform.claude.com/docs/de/about-claude/use-case-guides/legal-summarization) Was this page helpful? --- # Kundenservice-Agent - Claude API Docs Loading... Anwendungsfälle Kundenservice-Agent Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Vor dem Aufbau mit Claude ------------------------------- ### Entscheiden Sie, ob Sie Claude für Support-Chat verwenden möchten Hier sind einige wichtige Indikatoren dafür, dass Sie ein LLM wie Claude einsetzen sollten, um Teile Ihres Kundenservice-Prozesses zu automatisieren: ### Hohes Volumen sich wiederholender Anfragen ### Bedarf an schneller Informationssynthese ### Anforderung für 24/7-Verfügbarkeit ### Schnelle Skalierung während Spitzenzeiten ### Konsistente Markenstimme Einige Überlegungen zur Wahl von Claude gegenüber anderen LLMs: * Sie priorisieren natürliche, nuancierte Konversation: Claudes ausgefeiltes Sprachverständnis ermöglicht natürlichere, kontextbewusste Gespräche, die sich menschlicher anfühlen als Chats mit anderen LLMs. * Sie erhalten häufig komplexe und offene Anfragen: Claude kann eine breite Palette von Themen und Anfragen bearbeiten, ohne vorgefertigte Antworten zu generieren oder umfangreiche Programmierung von Variationen von Benutzeräußerungen zu erfordern. * Sie benötigen skalierbaren mehrsprachigen Support: Claudes mehrsprachige Fähigkeiten ermöglichen es, Gespräche in über 200 Sprachen zu führen, ohne dass separate Chatbots oder umfangreiche Übersetzungsprozesse für jede unterstützte Sprache erforderlich sind. ### Definieren Sie Ihre ideale Chat-Interaktion Skizzieren Sie eine ideale Kundeninteraktion, um zu definieren, wie und wann Sie erwarten, dass der Kunde mit Claude interagiert. Diese Skizze hilft bei der Bestimmung der technischen Anforderungen Ihrer Lösung. Hier ist ein Beispiel für eine Chat-Interaktion für Kundenservice bei Autoversicherungen: * **Kunde**: Initiiert Support-Chat-Erlebnis * **Claude**: Begrüßt den Kunden herzlich und leitet das Gespräch ein * **Kunde**: Fragt nach Versicherung für sein neues Elektroauto * **Claude**: Bietet relevante Informationen zur Deckung von Elektrofahrzeugen * **Kunde**: Stellt Fragen zu besonderen Anforderungen für Elektroauto-Versicherungen * **Claude**: Antwortet mit genauen und informativen Antworten und bietet Links zu den Quellen * **Kunde**: Stellt themenfremde Fragen, die nicht mit Versicherung oder Autos zu tun haben * **Claude**: Klärt auf, dass es keine unabhängigen Themen diskutiert, und lenkt den Benutzer zurück zur Autoversicherung * **Kunde**: Zeigt Interesse an einem Versicherungsangebot * **Claude**: Stellt eine Reihe von Fragen, um das passende Angebot zu bestimmen, und passt sich ihren Antworten an * **Claude**: Sendet eine Anfrage zur Verwendung des Angebotsgenerator-API-Tools zusammen mit den vom Benutzer erfassten notwendigen Informationen * **Claude**: Erhält die Antwortiinformationen vom API-Tool-Einsatz, synthetisiert die Informationen in eine natürliche Antwort und präsentiert dem Benutzer das bereitgestellte Angebot * **Kunde**: Stellt Anschlussfragen * **Claude**: Beantwortet Anschlussfragen nach Bedarf * **Claude**: Leitet den Kunden zu den nächsten Schritten im Versicherungsprozess und beendet das Gespräch Im echten Beispiel, das Sie für Ihren eigenen Anwendungsfall schreiben, könnte es hilfreich sein, die tatsächlichen Wörter in dieser Interaktion aufzuschreiben, damit Sie auch ein Gefühl für den idealen Ton, die Antwortlänge und das Detaillierungsniveau bekommen, das Claude haben soll. ### Unterteilen Sie die Interaktion in eindeutige Aufgaben Customer-Support-Chat ist eine Sammlung mehrerer verschiedener Aufgaben, von der Beantwortung von Fragen über Informationsbeschaffung bis hin zur Durchführung von Anfragen, alles in einer einzigen Kundeninteraktion. Bevor Sie mit dem Aufbau beginnen, unterteilen Sie Ihre ideale Kundeninteraktion in jede Aufgabe, die Claude ausführen soll. Dies stellt sicher, dass Sie Claude für jede Aufgabe auffordern und bewerten können, und gibt Ihnen ein gutes Verständnis für die Bandbreite der Interaktionen, die Sie bei der Erstellung von Testfällen berücksichtigen müssen. Kunden finden es manchmal hilfreich, dies als Interaktions-Flussdiagramm möglicher Gesprächsinflexionspunkte je nach Benutzeranfragen zu visualisieren. Hier sind die wichtigsten Aufgaben, die mit der obigen Beispiel-Versicherungsinteraktion verbunden sind: 1. Begrüßung und allgemeine Anleitung * Begrüßen Sie den Kunden herzlich und leiten Sie das Gespräch ein * Bieten Sie allgemeine Informationen über das Unternehmen und die Interaktion 2. Produktinformationen * Bieten Sie Informationen zur Deckung von Elektrofahrzeugen Dies erfordert, dass Claude die notwendigen Informationen in seinem Kontext hat, und könnte bedeuten, dass eine [RAG-Integration](https://platform.claude.com/cookbook/capabilities-retrieval-augmented-generation-guide) erforderlich ist. * Beantworten Sie Fragen zu besonderen Anforderungen für Elektroauto-Versicherungen * Beantworten Sie Anschlussfragen zum Angebot oder zu Versicherungsdetails * Bieten Sie Links zu Quellen an, wenn angemessen 3. Gesprächsverwaltung * Bleiben Sie beim Thema (Autoversicherung) * Leiten Sie themenfremde Fragen zurück zu relevanten Themen 4. Angebotsgenerierung * Stellen Sie angemessene Fragen, um die Angebotsberechtigung zu bestimmen * Passen Sie Fragen basierend auf Kundenreaktionen an * Übermitteln Sie erfasste Informationen an die Angebotsgenerator-API * Präsentieren Sie das bereitgestellte Angebot dem Kunden ### Etablieren Sie Erfolgskriterien Arbeiten Sie mit Ihrem Support-Team zusammen, um [klare Erfolgskriterien zu definieren](https://platform.claude.com/docs/de/test-and-evaluate/define-success) und schreiben Sie [detaillierte Bewertungen](https://platform.claude.com/docs/de/test-and-evaluate/develop-tests) mit messbaren Benchmarks und Zielen. Hier sind Kriterien und Benchmarks, die zur Bewertung der erfolgreichen Ausführung der definierten Aufgaben durch Claude verwendet werden können: ### Genauigkeit des Abfrageverständnisses ### Relevanz der Antwort ### Genauigkeit der Antwort ### Relevanz der Zitierbereitstellung ### Themeneinhaltung ### Effektivität der Inhaltsgenerierung ### Eskalationseffizienz Hier sind Kriterien und Benchmarks, die zur Bewertung der geschäftlichen Auswirkungen des Einsatzes von Claude für Support verwendet werden können: ### Stimmungserhaltung ### Deflektionsrate ### Kundenzufriedenheitsscore ### Durchschnittliche Bearbeitungszeit So implementieren Sie Claude als Kundenservice-Agent ---------------------------------------------------------- ### Wählen Sie das richtige Claude-Modell Die Wahl des Modells hängt von den Kompromissen zwischen Kosten, Genauigkeit und Antwortzeit ab. Für Customer-Support-Chat ist Claude Opus 4.6 gut geeignet, um Intelligenz, Latenz und Kosten auszugleichen. Für Fälle, in denen Sie einen Gesprächsfluss mit mehreren Prompts haben, einschließlich RAG, Tool-Einsatz und/oder Prompts mit langem Kontext, kann Claude Haiku 4.5 besser geeignet sein, um die Latenz zu optimieren. ### Erstellen Sie einen starken Prompt Die Verwendung von Claude für Kundenservice erfordert, dass Claude genug Anleitung und Kontext hat, um angemessen zu reagieren, während er genug Flexibilität hat, um eine breite Palette von Kundenanfragen zu bearbeiten. Beginnen wir mit dem Schreiben der Elemente eines starken Prompts, beginnend mit einem System-Prompt: IDENTITY = """You are Eva, a friendly and knowledgeable AI assistant for Acme Insurance Company. Your role is to warmly welcome customers and provide information on Acme's insurance offerings, which include car insurance and electric car insurance. You can also help customers get quotes for their insurance needs.""" Während Sie möglicherweise versucht sind, alle Ihre Informationen in einen System-Prompt zu packen, um Anweisungen von der Benutzerkonversation zu trennen, funktioniert Claude tatsächlich am besten, wenn der Großteil des Prompt-Inhalts in der ersten `User`\-Runde geschrieben wird (mit der einzigen Ausnahme von Rollen-Prompting). Lesen Sie mehr unter [Claude eine Rolle mit einem System-Prompt geben](https://platform.claude.com/docs/de/build-with-claude/prompt-engineering/system-prompts) . Es ist am besten, komplexe Prompts in Unterabschnitte zu unterteilen und jeweils einen Teil zu schreiben. Für jede Aufgabe könnten Sie größeren Erfolg haben, wenn Sie einem schrittweisen Prozess folgen, um die Teile des Prompts zu definieren, die Claude benötigt, um die Aufgabe gut zu erfüllen. Für dieses Beispiel des Kundenservice bei Autoversicherungen schreiben wir schrittweise alle Teile für einen Prompt, beginnend mit der Aufgabe "Begrüßung und allgemeine Anleitung". Dies macht auch das Debuggen Ihres Prompts einfacher, da Sie einzelne Teile des Gesamtprompts schneller anpassen können. Wir werden alle diese Teile in eine Datei namens `config.py` einfügen. STATIC_GREETINGS_AND_GENERAL = """ Acme Auto Insurance: Your Trusted Companion on the Road About: At Acme Insurance, we understand that your vehicle is more than just a mode of transportation—it's your ticket to life's adventures. Since 1985, we've been crafting auto insurance policies that give drivers the confidence to explore, commute, and travel with peace of mind. Whether you're navigating city streets or embarking on cross-country road trips, Acme is there to protect you and your vehicle. Our innovative auto insurance policies are designed to adapt to your unique needs, covering everything from fender benders to major collisions. With Acme's award-winning customer service and swift claim resolution, you can focus on the joy of driving while we handle the rest. We're not just an insurance provider—we're your co-pilot in life's journeys. Choose Acme Auto Insurance and experience the assurance that comes with superior coverage and genuine care. Because at Acme, we don't just insure your car—we fuel your adventures on the open road. Note: We also offer specialized coverage for electric vehicles, ensuring that drivers of all car types can benefit from our protection. Acme Insurance offers the following products: - Car insurance - Electric car insurance - Two-wheeler insurance Business hours: Monday-Friday, 9 AM - 5 PM EST Customer service number: 1-800-123-4567 """ Wir werden dann dasselbe für unsere Informationen zu Autoversicherungen und Elektroauto-Versicherungen tun. STATIC_CAR_INSURANCE=""" Car Insurance Coverage: Acme's car insurance policies typically cover: 1. Liability coverage: Pays for bodily injury and property damage you cause to others. 2. Collision coverage: Pays for damage to your car in an accident. 3. Comprehensive coverage: Pays for damage to your car from non-collision incidents. 4. Medical payments coverage: Pays for medical expenses after an accident. 5. Uninsured/underinsured motorist coverage: Protects you if you're hit by a driver with insufficient insurance. Optional coverages include: - Rental car reimbursement - Roadside assistance - New car replacement """ STATIC_ELECTRIC_CAR_INSURANCE=""" Electric Car Insurance: Our specialized electric car insurance goes beyond traditional auto coverage, offering tailored protection for your high-tech investment. In addition to standard coverages, we offer: - Safeguarding expensive battery systems - Covering home charging equipment - Adapting to the rapidly evolving world of electric vehicles Whether you're driving a Rivian, Nissan Leaf, Chevrolet Bolt, or any other electric vehicle, our knowledgeable agents are ready to craft a policy that gives you the confidence to enjoy every electron-powered mile. """ Jetzt, da wir unseren statischen Inhalt haben, fügen wir mindestens 4-5 Beispiele für "gute" Interaktionen hinzu, um Claudes Antworten zu lenken. Diese Beispiele sollten repräsentativ für Ihre ideale Kundeninteraktion sein und können Schutzmaßnahmen, Tool-Aufrufe usw. enthalten. EXAMPLES=""" Here are a few examples of how you can interact with customers: H: Hi, do you offer commercial insurance for small businesses? A: Ah! Unfortunately, we don't offer commercial insurance at this time. However, we do provide a range of personal insurance products including car insurance and electric car insurance. Would you like to know more about these offerings? H: Hi, what are your business hours? A: Our business hours are Monday to Friday, 9 AM to 5 PM EST. If you have any questions or need assistance, feel free to reach out during those times. How else can I assist you today? H: I'm shopping for car insurance. What does Acme offer? A: Great choice! Acme's car insurance policies typically include: - Liability coverage: Protects you if you're at fault in an accident - Collision coverage: Pays for damage to your car in an accident - Comprehensive coverage: Covers non-collision incidents like theft or vandalism - Medical payments coverage: Pays for medical expenses after an accident - Uninsured/underinsured motorist coverage: Protects you from drivers with insufficient insurance We also offer optional coverages like rental car reimbursement, roadside assistance, and new car replacement. Would you like more details on any of these coverages, or do you have specific questions about insuring your vehicle? H: I'd like to hear about your electric car insurance. A: Certainly! Our electric car insurance is specially designed to meet the unique needs of electric vehicle owners. In addition to all the standard coverages we offer for regular cars, our electric car policies include: - Battery coverage: Protection against damage or degradation of your vehicle's expensive battery system - Tech package: Covers repairs or replacement of advanced electronics and onboard computer systems - Charging station coverage: Protects both home and portable charging equipment - Cybersecurity protection: Coverage against hacking or digital threats - Specialized roadside assistance: Includes flatbed towing to protect the vehicle's undercarriage We cover a wide range of electric vehicles, including popular models from Tesla, Rivian, Nissan, Chevrolet, and more. Is there a specific electric vehicle you're looking to insure, or would you like more details on any of these coverages? H: I'd like to get a quote for my car insurance. A: Certainly! I'd be happy to help you get a quote for your car insurance. To provide you with an accurate quote, I'll need to collect some information about your vehicle and the primary driver. Let's start with the basics: 1. What is the make and model of your vehicle? 2. What year was it manufactured? 3. Approximately how many miles have you driven? 4. What is the age of the primary driver? Once you provide this information, I'll use our quoting tool to generate a personalized insurance quote for you. """ Sie werden auch wichtige Anweisungen einbeziehen möchten, die die Gebote und Verbote für die Interaktion von Claude mit dem Kunden beschreiben. Dies kann sich aus Markenrichtlinien oder Support-Richtlinien ergeben. ADDITIONAL_GUARDRAILS = """Please adhere to the following guardrails: 1. Only provide information about insurance types listed in our offerings. 2. If asked about an insurance type we don't offer, politely state that we don't provide that service. 3. Do not speculate about future product offerings or company plans. 4. Don't make promises or enter into agreements it's not authorized to make. You only provide information and guidance. 5. Do not mention any competitor's products or services. """ Jetzt kombinieren wir alle diese Abschnitte in einen einzelnen String, um ihn als unseren Prompt zu verwenden. TASK_SPECIFIC_INSTRUCTIONS = ' '.join([\ STATIC_GREETINGS_AND_GENERAL,\ STATIC_CAR_INSURANCE,\ STATIC_ELECTRIC_CAR_INSURANCE,\ EXAMPLES,\ ADDITIONAL_GUARDRAILS,\ ]) ### Fügen Sie dynamische und agentengestützte Fähigkeiten mit Tool-Einsatz hinzu Claude ist in der Lage, Maßnahmen zu ergreifen und Informationen dynamisch mithilfe der Client-seitigen Tool-Einsatz-Funktionalität abzurufen. Beginnen Sie mit einer Liste aller externen Tools oder APIs, die der Prompt verwenden sollte. Für dieses Beispiel beginnen wir mit einem Tool zur Berechnung des Angebots. Zur Erinnerung: Dieses Tool führt die tatsächliche Berechnung nicht durch, es signalisiert nur der Anwendung, dass ein Tool mit den angegebenen Argumenten verwendet werden sollte. Beispiel-Versicherungsangebots-Rechner: TOOLS = [{\ "name": "get_quote",\ "description": "Calculate the insurance quote based on user input. Returned value is per month premium.",\ "input_schema": {\ "type": "object",\ "properties": {\ "make": {"type": "string", "description": "The make of the vehicle."},\ "model": {"type": "string", "description": "The model of the vehicle."},\ "year": {"type": "integer", "description": "The year the vehicle was manufactured."},\ "mileage": {"type": "integer", "description": "The mileage on the vehicle."},\ "driver_age": {"type": "integer", "description": "The age of the primary driver."}\ },\ "required": ["make", "model", "year", "mileage", "driver_age"]\ }\ }] def get_quote(make, model, year, mileage, driver_age): """Returns the premium per month in USD""" # You can call an http endpoint or a database to get the quote. # Here, we simulate a delay of 1 seconds and return a fixed quote of 100. time.sleep(1) return 100 ### Stellen Sie Ihre Prompts bereit Es ist schwierig zu wissen, wie gut Ihr Prompt funktioniert, ohne ihn in einer Test-Produktionsumgebung bereitzustellen und [Bewertungen durchzuführen](https://platform.claude.com/docs/de/test-and-evaluate/develop-tests) . Lassen Sie uns eine kleine Anwendung mit unserem Prompt, dem Anthropic SDK und Streamlit für eine Benutzeroberfläche erstellen. In einer Datei namens `chatbot.py` beginnen Sie mit der Einrichtung der ChatBot-Klasse, die die Interaktionen mit dem Anthropic SDK kapselt. Die Klasse sollte zwei Hauptmethoden haben: `generate_message` und `process_user_input`. from anthropic import Anthropic from config import IDENTITY, TOOLS, MODEL, get_quote from dotenv import load_dotenv load_dotenv() class ChatBot: def __init__(self, session_state): self.anthropic = Anthropic() self.session_state = session_state def generate_message( self, messages, max_tokens, ): try: response = self.anthropic.messages.create( model=MODEL, system=IDENTITY, max_tokens=max_tokens, messages=messages, tools=TOOLS, ) return response except Exception as e: return {"error": str(e)} def process_user_input(self, user_input): self.session_state.messages.append({"role": "user", "content": user_input}) response_message = self.generate_message( messages=self.session_state.messages, max_tokens=2048, ) if "error" in response_message: return f"An error occurred: {response_message['error']}" if response_message.content[-1].type == "tool_use": tool_use = response_message.content[-1] func_name = tool_use.name func_params = tool_use.input tool_use_id = tool_use.id result = self.handle_tool_use(func_name, func_params) self.session_state.messages.append( {"role": "assistant", "content": response_message.content} ) self.session_state.messages.append({ "role": "user", "content": [{\ "type": "tool_result",\ "tool_use_id": tool_use_id,\ "content": f"{result}",\ }], }) follow_up_response = self.generate_message( messages=self.session_state.messages, max_tokens=2048, ) if "error" in follow_up_response: return f"An error occurred: {follow_up_response['error']}" response_text = follow_up_response.content[0].text self.session_state.messages.append( {"role": "assistant", "content": response_text} ) return response_text elif response_message.content[0].type == "text": response_text = response_message.content[0].text self.session_state.messages.append( {"role": "assistant", "content": response_text} ) return response_text else: raise Exception("An error occurred: Unexpected response type") def handle_tool_use(self, func_name, func_params): if func_name == "get_quote": premium = get_quote(**func_params) return f"Quote generated: ${premium:.2f} per month" raise Exception("An unexpected tool was used") ### Erstellen Sie Ihre Benutzeroberfläche Testen Sie die Bereitstellung dieses Codes mit Streamlit mit einer Hauptmethode. Diese `main()`\-Funktion richtet eine Streamlit-basierte Chat-Schnittstelle ein. Wir werden dies in einer Datei namens `app.py` tun import streamlit as st from chatbot import ChatBot from config import TASK_SPECIFIC_INSTRUCTIONS def main(): st.title("Chat with Eva, Acme Insurance Company's Assistant🤖") if "messages" not in st.session_state: st.session_state.messages = [\ {'role': "user", "content": TASK_SPECIFIC_INSTRUCTIONS},\ {'role': "assistant", "content": "Understood"},\ ] chatbot = ChatBot(st.session_state) # Display user and assistant messages skipping the first two for message in st.session_state.messages[2:]: # ignore tool use blocks if isinstance(message["content"], str): with st.chat_message(message["role"]): st.markdown(message["content"]) if user_msg := st.chat_input("Type your message here..."): st.chat_message("user").markdown(user_msg) with st.chat_message("assistant"): with st.spinner("Eva is thinking..."): response_placeholder = st.empty() full_response = chatbot.process_user_input(user_msg) response_placeholder.markdown(full_response) if __name__ == "__main__": main() Führen Sie das Programm mit aus: streamlit run app.py ### Bewerten Sie Ihre Prompts Prompting erfordert oft Tests und Optimierung, um produktionsreif zu sein. Um die Bereitschaft Ihrer Lösung zu bestimmen, bewerten Sie die Chatbot-Leistung mit einem systematischen Prozess, der quantitative und qualitative Methoden kombiniert. Das Erstellen einer [starken empirischen Bewertung](https://platform.claude.com/docs/de/test-and-evaluate/develop-tests#building-evals-and-test-cases) basierend auf Ihren definierten Erfolgskriterien ermöglicht es Ihnen, Ihre Prompts zu optimieren. Die [Claude Console](https://platform.claude.com/dashboard) verfügt jetzt über ein Evaluierungstool, mit dem Sie Ihre Prompts unter verschiedenen Szenarien testen können. ### Verbessern Sie die Leistung In komplexen Szenarien kann es hilfreich sein, zusätzliche Strategien zur Verbesserung der Leistung über Standard-[Prompt-Engineering-Techniken](https://platform.claude.com/docs/de/build-with-claude/prompt-engineering/overview) und [Schutzmaßnahmen-Implementierungsstrategien](https://platform.claude.com/docs/de/test-and-evaluate/strengthen-guardrails/reduce-hallucinations) hinaus zu erwägen. Hier sind einige häufige Szenarien: #### Reduzieren Sie die Latenz des langen Kontexts mit RAG Bei großen Mengen an statischem und dynamischem Kontext kann das Einbeziehen aller Informationen in den Prompt zu hohen Kosten, langsameren Antwortzeiten und dem Erreichen von Kontextfenster-Limits führen. In diesem Szenario können RAG-Techniken (Retrieval Augmented Generation) die Leistung und Effizienz erheblich verbessern. Durch die Verwendung von [Embedding-Modellen wie Voyage](https://platform.claude.com/docs/de/build-with-claude/embeddings) zur Umwandlung von Informationen in Vektordarstellungen können Sie ein skalierbares und reaktionsschnelleres System erstellen. Dieser Ansatz ermöglicht das dynamische Abrufen relevanter Informationen basierend auf der aktuellen Abfrage, anstatt alle möglichen Kontexte in jeden Prompt einzubeziehen. Die Implementierung von RAG für Support-Anwendungsfälle [RAG-Rezept](https://platform.claude.com/cookbook/capabilities-retrieval-augmented-generation-guide) hat sich gezeigt, dass sie die Genauigkeit erhöht, die Antwortzeiten verkürzt und die API-Kosten in Systemen mit umfangreichen Kontextanforderungen senkt. #### Integrieren Sie Echtzeitdaten mit Tool-Einsatz Bei Abfragen, die Echtzeitinformationen erfordern, wie Kontostände oder Richtliniendetails, sind Embedding-basierte RAG-Ansätze nicht ausreichend. Stattdessen können Sie Tool-Einsatz nutzen, um die Fähigkeit Ihres Chatbots erheblich zu verbessern, genaue Echtzeitantworten bereitzustellen. Beispielsweise können Sie Tool-Einsatz verwenden, um Kundeninformationen nachzuschlagen, Bestelldetails abzurufen und Bestellungen im Namen des Kunden zu stornieren. Dieser Ansatz, [in unserem Tool-Einsatz: Kundenservice-Agent-Rezept beschrieben](https://platform.claude.com/cookbook/tool-use-customer-service-agent) , ermöglicht es Ihnen, Live-Daten nahtlos in Claudes Antworten zu integrieren und ein personalisierteres und effizienteres Kundenerlebnis zu bieten. #### Stärken Sie Ein- und Ausgabeschutzmaßnahmen Bei der Bereitstellung eines Chatbots, besonders in Kundenservice-Szenarien, ist es entscheidend, Risiken im Zusammenhang mit Missbrauch, Anfragen außerhalb des Geltungsbereichs und unangemessenen Antworten zu verhindern. Während Claude von Natur aus widerstandsfähig gegen solche Szenarien ist, finden Sie hier zusätzliche Schritte zur Stärkung Ihrer Chatbot-Schutzmaßnahmen: * [Reduzieren Sie Halluzinationen](https://platform.claude.com/docs/de/test-and-evaluate/strengthen-guardrails/reduce-hallucinations) : Implementieren Sie Faktenprüfungsmechanismen und [Zitate](https://platform.claude.com/cookbook/misc-using-citations) , um Antworten in bereitgestellten Informationen zu verankern. * Überprüfen Sie Informationen: Überprüfen Sie, dass die Antworten des Agenten mit den Richtlinien und bekannten Fakten Ihres Unternehmens übereinstimmen. * Vermeiden Sie vertragliche Verpflichtungen: Stellen Sie sicher, dass der Agent keine Versprechungen macht oder Vereinbarungen eingeht, zu denen er nicht berechtigt ist. * [Mindern Sie Jailbreaks](https://platform.claude.com/docs/de/test-and-evaluate/strengthen-guardrails/mitigate-jailbreaks) : Verwenden Sie Methoden wie Harmlosigkeitsscreens und Eingabevalidierung, um Benutzer daran zu hindern, Modellschwachstellen auszunutzen und unangemessene Inhalte zu generieren. * Vermeiden Sie die Erwähnung von Konkurrenten: Implementieren Sie einen Filter für Konkurrentenerwähnungen, um den Markenfokus zu bewahren und keine Produkte oder Dienstleistungen von Konkurrenten zu erwähnen. * [Halten Sie Claude in Charakter](https://platform.claude.com/docs/de/test-and-evaluate/strengthen-guardrails/keep-claude-in-character) : Verhindern Sie, dass Claude seinen Stil oder Kontext ändert, auch während langer, komplexer Interaktionen. * Entfernen Sie persönlich identifizierbare Informationen (PII): Entfernen Sie sofern nicht ausdrücklich erforderlich und autorisiert, alle PII aus Antworten. #### Reduzieren Sie die wahrgenommene Antwortzeit mit Streaming Bei potenziell langen Antworten kann die Implementierung von Streaming die Benutzereinbindung und Zufriedenheit erheblich verbessern. In diesem Szenario erhalten Benutzer die Antwort schrittweise, anstatt auf die gesamte Antwortgenerierung zu warten. Hier ist, wie Sie Streaming implementieren: 1. Verwenden Sie die [Anthropic Streaming API](https://platform.claude.com/docs/de/build-with-claude/streaming) , um Streaming-Antworten zu unterstützen. 2. Richten Sie Ihr Frontend ein, um eingehende Textblöcke zu verarbeiten. 3. Zeigen Sie jeden Block an, sobald er ankommt, um echtzeitiges Tippen zu simulieren. 4. Implementieren Sie einen Mechanismus, um die vollständige Antwort zu speichern, damit Benutzer sie anzeigen können, wenn sie navigieren und zurückkehren. In einigen Fällen ermöglicht Streaming die Verwendung fortgeschrittenerer Modelle mit höheren Basis-Latenzen, da die progressive Anzeige die Auswirkungen längerer Verarbeitungszeiten mindert. #### Skalieren Sie Ihren Chatbot Mit zunehmender Komplexität Ihres Chatbots kann sich Ihre Anwendungsarchitektur entsprechend entwickeln. Bevor Sie weitere Schichten zu Ihrer Architektur hinzufügen, beachten Sie die folgenden weniger umfassenden Optionen: * Stellen Sie sicher, dass Sie das Beste aus Ihren Prompts herausholen und die Optimierung durch Prompt-Engineering durchführen. Verwenden Sie unsere [Prompt-Engineering-Leitfäden](https://platform.claude.com/docs/de/build-with-claude/prompt-engineering/overview) , um die effektivsten Prompts zu schreiben. * Fügen Sie zusätzliche [Tools](https://platform.claude.com/docs/de/build-with-claude/tool-use) zum Prompt hinzu (die [Prompt-Ketten](https://platform.claude.com/docs/de/build-with-claude/prompt-engineering/chain-prompts) enthalten können) und sehen Sie, ob Sie die erforderliche Funktionalität erreichen können. Wenn Ihr Chatbot unglaublich unterschiedliche Aufgaben bearbeitet, möchten Sie möglicherweise einen [separaten Intent-Klassifizierer](https://platform.claude.com/cookbook/capabilities-classification-guide) hinzufügen, um die anfängliche Kundenanfrage weiterzuleiten. Für die vorhandene Anwendung würde dies das Erstellen eines Entscheidungsbaums beinhalten, der Kundenanfragen durch den Klassifizierer und dann zu spezialisierten Gesprächen (mit ihren eigenen Tools und System-Prompts) weiterleitet. Beachten Sie, dass diese Methode einen zusätzlichen Aufruf an Claude erfordert, der die Latenz erhöhen kann. ### Integrieren Sie Claude in Ihren Support-Workflow Während sich unsere Beispiele auf Python-Funktionen konzentriert haben, die in einer Streamlit-Umgebung aufrufbar sind, erfordert die Bereitstellung von Claude für einen Echtzeit-Support-Chatbot einen API-Service. Hier ist, wie Sie vorgehen können: 1. Erstellen Sie einen API-Wrapper: Entwickeln Sie einen einfachen API-Wrapper um Ihre Klassifizierungsfunktion. Beispielsweise können Sie Flask API oder Fast API verwenden, um Ihren Code in einen HTTP-Service zu verpacken. Ihr HTTP-Service könnte die Benutzereingabe akzeptieren und die Assistentenreaktion in ihrer Gesamtheit zurückgeben. Daher könnte Ihr Service die folgenden Merkmale haben: * Server-Sent Events (SSE): SSE ermöglicht das Echtzeit-Streaming von Antworten vom Server zum Client. Dies ist entscheidend für die Bereitstellung eines reibungslosen, interaktiven Erlebnisses bei der Arbeit mit LLMs. * Caching: Die Implementierung von Caching kann die Antwortzeiten erheblich verbessern und unnötige API-Aufrufe reduzieren. * Kontextbeibehaltung: Die Beibehaltung des Kontexts, wenn ein Benutzer navigiert und zurückkehrt, ist wichtig für die Kontinuität in Gesprächen. 2. Erstellen Sie eine Web-Schnittstelle: Implementieren Sie eine benutzerfreundliche Web-UI für die Interaktion mit dem Claude-gestützten Agent. [Retrieval Augmented Generation (RAG) Cookbook\ \ Besuchen Sie unser RAG-Cookbook-Rezept für weitere Beispielcodes und detaillierte Anleitung.](https://platform.claude.com/cookbook/capabilities-retrieval-augmented-generation-guide) [Citations Cookbook\ \ Erkunden Sie unser Citations-Cookbook-Rezept, um zu erfahren, wie Sie die Genauigkeit und Erklärbarkeit von Informationen sicherstellen.](https://platform.claude.com/cookbook/misc-using-citations) Was this page helpful? --- # Tool reference - Claude API Docs Loading... Documentation Page Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page This page is a reference for the tools Anthropic provides and the optional properties you can set on any tool definition. For a conceptual introduction to tool use, see [Tool use with Claude](https://platform.claude.com/docs/en/agents-and-tools/tool-use/overview) . For guidance on implementing tool use in your application, see [Define tools](https://platform.claude.com/docs/en/agents-and-tools/tool-use/define-tools) . Anthropic-provided tools ------------------------------ Anthropic provides two kinds of tools: **server tools** that execute on Anthropic's infrastructure, and **client tools** where Anthropic defines the schema but your application handles execution. Both kinds appear in your request's `tools` array alongside any user-defined tools. | Tool | `type` | Execution | Status | | --- | --- | --- | --- | | [Web search tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-search-tool) | `web_search_20260209`
`web_search_20250305` | Server | GA | | [Web fetch tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-fetch-tool) | `web_fetch_20260209`
`web_fetch_20250910` | Server | GA | | [Code execution tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/code-execution-tool) | `code_execution_20260120`
`code_execution_20250825` | Server | GA | | [Tool search tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-search-tool) | `tool_search_tool_regex_20251119`
`tool_search_tool_bm25_20251119` | Server | GA | | [MCP connector](https://platform.claude.com/docs/en/agents-and-tools/mcp-connector) | `mcp_toolset` | Server | Beta: `mcp-client-2025-11-20` | | [Memory tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/memory-tool) | `memory_20250818` | Client | GA | | [Bash tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/bash-tool) | `bash_20250124` | Client | GA | | [Text editor tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/text-editor-tool) | `text_editor_20250728`
`text_editor_20250124` | Client | GA | | [Computer use tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/computer-use-tool) | `computer_20251124`
`computer_20250124` | Client | Beta: `computer-use-2025-11-24`
`computer-use-2025-01-24` | For model compatibility, see each tool's page. Supported models vary by tool and by tool version. The tool search `type` values also accept undated aliases: `tool_search_tool_regex` and `tool_search_tool_bm25`. These resolve to the latest dated version. ### Tool versioning Most Anthropic-provided tools carry a `_YYYYMMDD` suffix in the `type` string. A new version is released when the tool's behavior, schema, or model support changes. Older versions remain available so that existing integrations continue to work. When a tool has multiple active versions, the relationship between them varies: * **Capability-keyed:** `web_search_20260209` and `web_fetch_20260209` add dynamic content filtering over their predecessors. `code_execution_20260120` adds [programmatic tool calling](https://platform.claude.com/docs/en/agents-and-tools/tool-use/programmatic-tool-calling) from within the sandbox. In each case, both the new and old versions are current; which one you use depends on whether you need the new capability. * **Model-keyed:** `text_editor_20250728` is for Claude 4 models and `text_editor_20250124` is for earlier models. The version you use depends on the model you target. * **Variant, not version:** `tool_search_tool_regex_20251119` and `tool_search_tool_bm25_20251119` are two search algorithms released together. Neither supersedes the other. * **Legacy:** `code_execution_20250522` supports only Python. `code_execution_20250825` adds Bash and file operations. The `mcp_toolset` type is not date-versioned; versioning is carried in the `anthropic-beta` header instead. Tool definition properties -------------------------------- Every tool in the `tools` array, including user-defined tools, accepts optional properties that control how the tool is loaded, who can call it, and how its inputs are validated. These properties compose: you can set `defer_loading` and `cache_control` and `strict` on the same tool. | Property | Purpose | Available on | Detailed guide | | --- | --- | --- | --- | | `cache_control` | Set a prompt-cache breakpoint at this tool definition | All tools | [Prompt caching](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) | | `strict` | Guarantee schema validation on tool names and inputs | All tools except `mcp_toolset` | [Strict tool use](https://platform.claude.com/docs/en/agents-and-tools/tool-use/strict-tool-use) | | `defer_loading` | Exclude the tool from the initial system prompt; load it on demand when tool search returns a `tool_reference` for it | All tools (for `mcp_toolset`, see [tool configuration](https://platform.claude.com/docs/en/agents-and-tools/mcp-connector#mcp-toolset-configuration)
) | [Tool search tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-search-tool) | | `allowed_callers` | Restrict which callers can call the tool | All tools except `mcp_toolset` | [Programmatic tool calling](https://platform.claude.com/docs/en/agents-and-tools/tool-use/programmatic-tool-calling#the-allowed-callers-field) | | `input_examples` | Provide example input objects to help Claude understand how to call the tool | User-defined and Anthropic-schema client tools. Not available on server tools. | [Define tools](https://platform.claude.com/docs/en/agents-and-tools/tool-use/define-tools#providing-tool-use-examples) | | `eager_input_streaming` | Enable fine-grained input streaming (`true`) or keep standard buffered streaming (`false`) for this tool | User-defined tools only | [Fine-grained tool streaming](https://platform.claude.com/docs/en/agents-and-tools/tool-use/fine-grained-tool-streaming) | ### `allowed_callers` values `allowed_callers` is an array that accepts any combination of: | Value | Meaning | | --- | --- | | `"direct"` | The model can call this tool directly in a `tool_use` block. This is the default if `allowed_callers` is omitted. | | `"code_execution_20260120"` | Code running inside a `code_execution_20260120` sandbox can call this tool. | Omitting `"direct"` from the array (for example, `"allowed_callers": ["code_execution_20260120"]`) means the tool is callable only from within code execution. The response's `tool_use` block includes a `caller` field that identifies which caller called the tool. See [Programmatic tool calling](https://platform.claude.com/docs/en/agents-and-tools/tool-use/programmatic-tool-calling#the-allowed-callers-field) for the full treatment, including the `caller` response shape and error behavior. ### `defer_loading` and prompt caching Tools with `defer_loading: true` are stripped from the rendered tools section before the cache key is computed. They don't appear in the system-prompt prefix at all. When tool search discovers a deferred tool and returns a `tool_reference` for it, the tool's full definition is expanded inline at that point in the conversation body, not in the prefix. This means `defer_loading: true` preserves your prompt cache. You can add deferred tools to a request without invalidating an existing cache entry, and the cache remains valid across the turn where the tool is discovered and the turn where it's called. For how to combine `defer_loading` with `cache_control` breakpoints, see the [Tool search tool prompt caching guidance](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-search-tool#prompt-caching) . Was this page helpful? --- # Claude in Amazon Bedrock - Claude API Docs Loading... Documentation Page Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page This guide walks you through setting up and making API calls to Claude in Amazon Bedrock. Claude in Amazon Bedrock runs on AWS-managed infrastructure with zero operator access (Anthropic personnel have no access to the inference infrastructure), letting you build sensitive applications entirely inside the AWS security boundary while using the same Messages API shape you use with Anthropic's first-party API. This page covers the new Claude in Amazon Bedrock offering, which exposes the Messages API at `/anthropic/v1/messages`. For the legacy Bedrock integration (the `InvokeModel` API with ARN-versioned model identifiers and AWS event-stream encoding), see [Claude on Amazon Bedrock](https://platform.claude.com/docs/en/build-with-claude/claude-on-amazon-bedrock) . Research preview ---------------------- Claude in Amazon Bedrock is in research preview, available in the US East (N. Virginia) `us-east-1` region at launch. Contact your Anthropic account executive to request access. Prerequisites ------------------- Before you begin, ensure you have: * A **new AWS account** in `us-east-1`. The research preview requires a dedicated account for isolation. Your Anthropic account executive will submit your account ID to the Bedrock Marketplace team for allowlisting (typically processed within 24 hours). * The [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html) installed and configured (optional, for credential management) * After allowlisting, AWS sends a welcome email with your model ID and additional setup details. Authentication -------------------- Claude in Amazon Bedrock supports three authentication paths. Choose the one that best fits your security requirements. ### Bedrock service role (recommended) Use a Bedrock service role with AWS-managed keys for the most secure, long-lived access: 1. 1 Admin: provision the service role An AWS administrator provisions a Bedrock service role and grants developers `iam:PassRole` permission on the service role ARN. 2. 2 Developer: pass the role When calling the API, pass the service role ARN as a request parameter. Bedrock assumes the role on your behalf and signs requests with AWS-managed credentials. A code example showing where the ARN parameter goes will be added when the SDK packages publish. ### IAM assumed roles For identity-federated access with a 12-hour maximum session: 1. 1 Admin: configure the IAM role Create an IAM role scoped to your Claude models. The trust policy names your identity provider (SAML, OIDC, or AWS Identity Center). The permissions policy grants `bedrock-mantle:CreateInference` only on the allowed model ARNs. 2. 2 Developer: authenticate and assume Authenticate through your corporate identity provider, then assume the IAM role. AWS STS issues temporary credentials that the SDK or CLI uses to sign requests. ### Bearer tokens For short-term access without IAM roles (12-hour maximum, least preferred): 1. 1 Admin: restrict token types Block long-term keys by attaching a policy that denies `bedrock:CallWithBearerToken` unless the `bedrock:BearerTokenType` condition matches a short-term token. 2. 2 Developer: mint a token Use the `aws-bedrock-token-generator` CLI (link pending publication) to mint a bearer token. Pass it in the `x-api-key` header on each request. Install an SDK -------------------- Anthropic's [client SDKs](https://platform.claude.com/docs/en/api/client-sdks) support Claude in Amazon Bedrock through a Bedrock-specific package or module. Python Python TypeScript TypeScript C# C# Go Go Java Java PHP PHP Ruby Ruby Making your first request ------------------------------- The endpoint follows the pattern `https://bedrock-mantle.{region}.api.aws/anthropic/v1/messages`. Unlike the legacy Bedrock integration, this endpoint uses standard SSE streaming and the same request body shape as Anthropic's first-party API. The SDK resolves credentials and region using the standard AWS precedence: constructor arguments, then environment variables (`AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_SESSION_TOKEN`, `AWS_REGION`), then the AWS config file and credential chain (SSO, assumed roles, ECS task role, IMDS). Shell curl https://bedrock-mantle.us-east-1.api.aws/anthropic/v1/messages \ --aws-sigv4 "aws:amz:us-east-1:bedrock-mantle" \ --user "$AWS_ACCESS_KEY_ID:$AWS_SECRET_ACCESS_KEY" \ -H "x-amz-security-token: $AWS_SESSION_TOKEN" \ -H "content-type: application/json" \ -H "anthropic-version: 2023-06-01" \ -d '{ "model": "CLAUDE_MODEL_ID", "max_tokens": 1024, "messages": [\ {"role": "user", "content": "Hello, Claude"}\ ] }' If the dedicated `AnthropicBedrockMantle` client is not yet available in your language's SDK release, you can use the standard `Anthropic` client instead: set `base_url` to `https://bedrock-mantle.{region}.api.aws/anthropic` and pass your bearer token as `api_key`. This path supports bearer-token authentication only. SigV4 signing requires the dedicated client. Supported models ---------------------- Model IDs in Claude in Amazon Bedrock carry an `anthropic.` provider prefix. Model capabilities and behaviors are documented on the [Models overview](https://platform.claude.com/docs/en/about-claude/models/overview) page. See your AWS welcome email for the exact model ID enabled for your account. Feature availability -------------------------- Claude in Amazon Bedrock supports features that run inside the model. Features that require Anthropic-operated infrastructure are not available. **Supported:** * Messages API (`/v1/messages`) * Prompt caching * Extended thinking * Tool use (client-defined tools) * Citations * Structured outputs * In-region inference (requests stay in a single AWS region) **Not supported:** * Anthropic-defined tools (Web Search, Web Fetch, Remote MCP, Memory, Files API, Computer Use, Skills, Code Execution) * Agent API * Message Batches API * `/v1/users` endpoint Regions ------------- The research preview is available in `us-east-1` (IAD) only. Quotas ------------ Default quota is 2 million input tokens per minute (TPM). You can request up to 4 million input TPM without additional Anthropic approval. AWS enforces requests-per-minute (RPM) limits on the Bedrock side; contact AWS support for RPM adjustments. Data retention -------------------- All inference data is retained for 30 days in your AWS storage. There is no zero-data-retention opt-out on this offering. For standard customers, Anthropic can inspect stored data for safety and abuse review. For Select-tier customers, only AWS can inspect data; Anthropic can run automated operations but not manual review. For details on Select-tier eligibility, contact your Anthropic account executive. If your application requires zero data retention (ZDR), consider Claude Platform on AWS, where ZDR is available by contacting sales. Observability ------------------- Claude in Amazon Bedrock emits logs to both CloudWatch and CloudTrail. Anthropic recommends retaining activity logs on at least a 30-day rolling basis to understand usage patterns and investigate potential issues. Support ------------- For research preview support, contact **[\[email protected\]](https://platform.claude.com/cdn-cgi/l/email-protection#30525554425f535b1d515e441d55514070515d514a5f5e1e535f5d) **. Include your AWS account ID and the `request-id` from any failed API responses. Was this page helpful? --- # Handle tool calls - Claude API Docs Loading... Documentation Page Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page This page covers the tool-call lifecycle: reading `tool_use` blocks from Claude's response, formatting `tool_result` blocks in your reply, and signaling errors. For the SDK abstraction that handles this automatically, see [Tool Runner](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-runner) . **Simpler with Tool Runner**: The manual tool handling described on this page is automatically managed by [Tool Runner](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-runner) . Use this page when you need custom control over tool execution. Claude's response differs based on whether it uses a client or server tool. Handling results from client tools ---------------------------------------- The response will have a `stop_reason` of `tool_use` and one or more `tool_use` content blocks that include: * `id`: A unique identifier for this particular tool use block. This will be used to match up the tool results later. * `name`: The name of the tool being used. * `input`: An object containing the input being passed to the tool, conforming to the tool's `input_schema`. ### Example API response with a \`tool\_use\` content block When you receive a tool use response for a client tool, you should: 1. Extract the `name`, `id`, and `input` from the `tool_use` block. 2. Run the actual tool in your codebase corresponding to that tool name, passing in the tool `input`. 3. Continue the conversation by sending a new message with the `role` of `user`, and a `content` block containing the `tool_result` type and the following information: * `tool_use_id`: The `id` of the tool use request this is a result for. * `content`: The result of the tool, as a string (for example, `"content": "15 degrees"`), a list of nested content blocks (for example, `"content": [{"type": "text", "text": "15 degrees"}]`), or a list of document blocks (for example, `"content": [{"type": "document", "source": {"type": "text", "media_type": "text/plain", "data": "15 degrees"}}]`). These content blocks can use the `text`, `image`, or `document` types. * `is_error` (optional): Set to `true` if the tool execution resulted in an error. **Important formatting requirements**: * Tool result blocks must immediately follow their corresponding tool use blocks in the message history. You cannot include any messages between the assistant's tool use message and the user's tool result message. * In the user message containing tool results, the tool\_result blocks must come FIRST in the content array. Any text must come AFTER all tool results. For example, this will cause a 400 error: { "role": "user", "content": [\ { "type": "text", "text": "Here are the results:" }, // ❌ Text before tool_result\ { "type": "tool_result", "tool_use_id": "toolu_01" /* ... */ }\ ] } This is correct: { "role": "user", "content": [\ { "type": "tool_result", "tool_use_id": "toolu_01" /* ... */ },\ { "type": "text", "text": "What should I do next?" } // ✅ Text after tool_result\ ] } If you receive an error like "tool\_use ids were found without tool\_result blocks immediately after", check that your tool results are formatted correctly. ### Example of successful tool result ### Example of tool result with images ### Example of empty tool result ### Example of tool result with documents After receiving the tool result, Claude will use that information to continue generating a response to the original user prompt. Handling results from server tools ---------------------------------------- Claude executes the tool internally and incorporates the results directly into its response without requiring additional user interaction. **Differences from other APIs** Unlike APIs that separate tool use or use special roles like `tool` or `function`, the Claude API integrates tools directly into the `user` and `assistant` message structure. Messages contain arrays of `text`, `image`, `tool_use`, and `tool_result` blocks. `user` messages include client content and `tool_result`, while `assistant` messages contain AI-generated content and `tool_use`. Handling errors with is\_error ------------------------------------ There are a few different types of errors that can occur when using tools with Claude: ### Tool execution error ### Invalid tool name ### Server tool errors Next steps ---------------- * For running multiple tools in one turn, see [Parallel tool use](https://platform.claude.com/docs/en/agents-and-tools/tool-use/parallel-tool-use) . * For the SDK abstraction that automates this loop, see [Tool Runner](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-runner) . * For the full tool-use workflow, see [Define tools](https://platform.claude.com/docs/en/agents-and-tools/tool-use/define-tools) . Was this page helpful? --- # Tool Runner (SDK) - Claude API Docs Loading... Documentation Page Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Was this page helpful? Tool Runner handles the agentic loop, error wrapping, and type safety so you don't have to. Use the [manual loop](https://platform.claude.com/docs/en/agents-and-tools/tool-use/handle-tool-calls) only when you need human-in-the-loop approval, custom logging, or conditional execution. Available in Python, TypeScript, and Ruby SDKs. The tool runner provides an out-of-the-box solution for executing tools with Claude. Instead of manually handling tool calls, tool results, and conversation management, the tool runner automatically: * Executes tools when Claude calls them * Handles the request/response cycle * Manages conversation state * Provides type safety and validation Use the tool runner for most tool use implementations. The tool runner is currently in beta and available in the [Python](https://github.com/anthropics/anthropic-sdk-python/blob/main/tools.md) , [TypeScript](https://github.com/anthropics/anthropic-sdk-typescript/blob/main/helpers.md#tool-helpers) , and [Ruby](https://github.com/anthropics/anthropic-sdk-ruby/blob/main/helpers.md#3-auto-looping-tool-runner-beta) SDKs. **Automatic context management with compaction** The tool runner supports automatic [compaction](https://platform.claude.com/docs/en/build-with-claude/context-editing#client-side-compaction-sdk) , which generates summaries when token usage exceeds a threshold. This allows long-running agentic tasks to continue beyond context window limits. Basic usage ----------------- Define tools using the SDK helpers, then use the tool runner to execute them. The tool function must return a content block or content block array, including text, images, or document blocks. This allows tools to return rich, multimodal responses. Returned strings will be converted to a text content block. If you want to return a structured JSON object to Claude, encode it to a JSON string before returning it. Numbers, booleans, or other non-string primitives must also be converted to strings. Iterating over the tool runner ------------------------------------ The tool runner is an iterable that yields messages from Claude. This is often referred to as a "tool call loop". Each iteration, the runner checks if Claude requested a tool use. If so, it calls the tool and sends the result back to Claude automatically, then yields the next message from Claude to continue your loop. You can end the loop at any iteration with a `break` statement. The runner will loop until Claude returns a message without a tool use. If you don't need intermediate messages, you can get the final message directly: Advanced usage -------------------- Within the loop, you can fully customize the tool runner's next request to the Messages API. The runner automatically appends tool results to the message history, so you don't need to manually manage them. You can optionally inspect the tool result for logging or debugging, and modify the request parameters before the next API call. ### Debugging tool execution When a tool throws an exception, the tool runner catches it and returns the error to Claude as a tool result with `is_error: true`. By default, only the exception message is included, not the full stack trace. To view full stack traces and debug information, set the `ANTHROPIC_LOG` environment variable: # View info-level logs including tool errors export ANTHROPIC_LOG=info # View debug-level logs for more verbose output export ANTHROPIC_LOG=debug When enabled, the SDK logs full exception details (using Python's `logging` module, the console in TypeScript, or Ruby's logger), including the complete stack trace when a tool fails. ### Intercepting tool errors By default, tool errors are passed back to Claude, which can then respond appropriately. However, you may want to detect errors and handle them differently, for example, to stop execution early or implement custom error handling. Use the tool response method to intercept tool results and check for errors before they're sent to Claude: ### Modifying tool results You can modify tool results before they're sent back to Claude. This is useful for adding metadata like `cache_control` to enable [prompt caching](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) on tool results, or for transforming the tool output. Use the tool response method to get the tool result, then modify it before the runner proceeds. Whether you explicitly append the modified result or mutate it in place depends on the SDK; see the code comments in each tab. Adding `cache_control` to tool results is particularly useful when tools return large amounts of data (like document search results) that you want to cache for subsequent API calls. See [Prompt caching](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) for more details on caching strategies. Streaming --------------- Enable streaming to receive events as they arrive. Each iteration yields a stream object that you can iterate for events. Next steps ---------------- * For manual control over the tool-call loop, see [Handle tool calls](https://platform.claude.com/docs/en/agents-and-tools/tool-use/handle-tool-calls) . * For running multiple tools concurrently, see [Parallel tool use](https://platform.claude.com/docs/en/agents-and-tools/tool-use/parallel-tool-use) . * For the full tool-use workflow, see [Define tools](https://platform.claude.com/docs/en/agents-and-tools/tool-use/define-tools) . Python Python TypeScript TypeScript Ruby Ruby Python Python TypeScript TypeScript Ruby Ruby Python Python TypeScript TypeScript Ruby Ruby Python Python TypeScript TypeScript Ruby Ruby Python Python TypeScript TypeScript Ruby Ruby Python Python TypeScript TypeScript Ruby Ruby --- # Define tools - Claude API Docs Loading... Documentation Page Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Choosing a model ---------------------- Use the latest Claude Opus (4.6) model for complex tools and ambiguous queries; it handles multiple tools better and seeks clarification when needed. Use Claude Haiku models for straightforward tools, but note they may infer missing parameters. If using Claude with tool use and extended thinking, refer to the [extended thinking guide](https://platform.claude.com/docs/en/build-with-claude/extended-thinking) for more information. Specifying client tools ----------------------------- Client tools (both Anthropic-schema and user-defined) are specified in the `tools` top-level parameter of the API request. Each tool definition includes: | Parameter | Description | | --- | --- | | `name` | The name of the tool. Must match the regex `^[a-zA-Z0-9_-]{1,64}$`. | | `description` | A detailed plaintext description of what the tool does, when it should be used, and how it behaves. | | `input_schema` | A [JSON Schema](https://json-schema.org/)
object defining the expected parameters for the tool. | | `input_examples` | (Optional) An array of example input objects to help Claude understand how to use the tool. See [Providing tool use examples](https://platform.claude.com/docs/en/agents-and-tools/tool-use/define-tools#providing-tool-use-examples)
. | For the full set of optional properties available on any tool definition, including `cache_control`, `strict`, `defer_loading`, and `allowed_callers`, see the [Tool reference](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-reference#tool-definition-properties) . ### Example simple tool definition ### Tool use system prompt When you call the Claude API with the `tools` parameter, the API constructs a special system prompt from the tool definitions, tool configuration, and any user-specified system prompt. The constructed prompt is designed to instruct the model to use the specified tool(s) and provide the necessary context for the tool to operate properly: In this environment you have access to a set of tools you can use to answer the user's question. {{ FORMATTING INSTRUCTIONS }} String and scalar parameters should be specified as is, while lists and objects should use JSON format. Note that spaces for string values are not stripped. The output is not expected to be valid XML and is parsed with regular expressions. Here are the functions available in JSONSchema format: {{ TOOL DEFINITIONS IN JSON SCHEMA }} {{ USER SYSTEM PROMPT }} {{ TOOL CONFIGURATION }} ### Best practices for tool definitions To get the best performance out of Claude when using tools, follow these guidelines: * **Provide extremely detailed descriptions.** This is by far the most important factor in tool performance. Your descriptions should explain every detail about the tool, including: * What the tool does * When it should be used (and when it shouldn't) * What each parameter means and how it affects the tool's behavior * Any important caveats or limitations, such as what information the tool does not return if the tool name is unclear. The more context you can give Claude about your tools, the better it will be at deciding when and how to use them. Aim for at least 3-4 sentences per tool description, more if the tool is complex. * **Prioritize descriptions, but consider using `input_examples` for complex tools.** Clear descriptions are most important, but for tools with complex inputs, nested objects, or format-sensitive parameters, you can use the `input_examples` field to provide schema-validated examples. See [Providing tool use examples](https://platform.claude.com/docs/en/agents-and-tools/tool-use/define-tools#providing-tool-use-examples) for details. * **Consolidate related operations into fewer tools.** Rather than creating a separate tool for every action (`create_pr`, , ), group them into a single tool with an parameter. Fewer, more capable tools reduce selection ambiguity and make your tool surface easier for Claude to navigate. ### Example of a good tool description The good description clearly explains what the tool does, when to use it, what data it returns, and what the `ticker` parameter means. The poor description is too brief and leaves Claude with many open questions about the tool's behavior and usage. For deeper guidance on tool design (consolidation, naming, and response shaping), see [Writing tools for agents](https://www.anthropic.com/engineering/writing-tools-for-agents) . Providing tool use examples --------------------------------- You can provide concrete examples of valid tool inputs to help Claude understand how to use your tools more effectively. This is particularly useful for complex tools with nested objects, optional parameters, or format-sensitive inputs. ### Basic usage Add an optional `input_examples` field to your tool definition with an array of example input objects. Each example must be valid according to the tool's `input_schema`: Examples are included in the prompt alongside your tool schema, showing Claude concrete patterns for well-formed tool calls. This helps Claude understand when to include optional parameters, what formats to use, and how to structure complex inputs. ### Requirements and limitations * **Schema validation** - Each example must be valid according to the tool's `input_schema`. Invalid examples return a 400 error * **Not supported for server-side tools** - Input examples work on user-defined and Anthropic-schema client tools, but not on server tools like web search or code execution * **Token cost** - Examples add to prompt tokens: ~20-50 tokens for simple examples, ~100-200 tokens for complex nested objects Controlling Claude's output --------------------------------- ### Forcing tool use In some cases, you may want Claude to use a specific tool to answer the user's question, even if Claude would otherwise answer directly without calling a tool. You can do this by specifying the tool in the `tool_choice` field like so: tool_choice = {"type": "tool", "name": "get_weather"} When working with the tool\_choice parameter, there are four possible options: * `auto` allows Claude to decide whether to call any provided tools or not. This is the default value when `tools` are provided. * `any` tells Claude that it must use one of the provided tools, but doesn't force a particular tool. * `tool` forces Claude to always use a particular tool. * `none` prevents Claude from using any tools. This is the default value when no `tools` are provided. When using [prompt caching](https://platform.claude.com/docs/en/build-with-claude/prompt-caching#what-invalidates-the-cache) , changes to the `tool_choice` parameter will invalidate cached message blocks. Tool definitions and system prompts remain cached, but message content must be reprocessed. This diagram illustrates how each option works: ![Diagram showing the four tool_choice options: auto, any, tool, and none](https://platform.claude.com/docs/images/tool_choice.png) Note that when you have `tool_choice` as `any` or `tool`, the API prefills the assistant message to force a tool to be used. This means that the models will not emit a natural language response or explanation before `tool_use` content blocks, even if explicitly asked to do so. When using [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking) with tool use, `tool_choice: {"type": "any"}` and `tool_choice: {"type": "tool", "name": "..."}` are not supported and will result in an error. Only `tool_choice: {"type": "auto"}` (the default) and `tool_choice: {"type": "none"}` are compatible with extended thinking. [Claude Mythos Preview](https://anthropic.com/glasswing) does not support forced tool use. Requests with `tool_choice: {"type": "any"}` or `tool_choice: {"type": "tool", "name": "..."}` return a 400 error on this model. Use `tool_choice: {"type": "auto"}` (the default) or `tool_choice: {"type": "none"}` and rely on prompting to influence tool selection. Testing has shown that this should not reduce performance. If you would like the model to provide natural language context or explanations while still requesting that the model use a specific tool, you can use `{"type": "auto"}` for `tool_choice` (the default) and add explicit instructions in a `user` message. For example: `What's the weather like in London? Use the get_weather tool in your response.` **Guaranteed tool calls with strict tools** Combine `tool_choice: {"type": "any"}` with [strict tool use](https://platform.claude.com/docs/en/agents-and-tools/tool-use/strict-tool-use) to guarantee both that one of your tools will be called AND that the tool inputs strictly follow your schema. Set `strict: true` on your tool definitions to enable schema validation. ### Model responses with tools When using tools, Claude will often comment on what it's doing or respond naturally to the user before invoking tools. For example, given the prompt "What's the weather like in San Francisco right now, and what time is it there?", Claude might respond with: JSON { "role": "assistant", "content": [\ {\ "type": "text",\ "text": "I'll help you check the current weather and time in San Francisco."\ },\ {\ "type": "tool_use",\ "id": "toolu_01A09q90qw90lq917835lq9",\ "name": "get_weather",\ "input": { "location": "San Francisco, CA" }\ }\ ] } This natural response style helps users understand what Claude is doing and creates a more conversational interaction. You can guide the style and content of these responses through your system prompts and by providing `` in your prompts. It's important to note that Claude may use various phrasings and approaches when explaining its actions. Your code should treat these responses like any other assistant-generated text, and not rely on specific formatting conventions. Next steps ---------------- [Handle tool calls\ \ Parse tool\_use blocks and format tool\_result responses.](https://platform.claude.com/docs/en/agents-and-tools/tool-use/handle-tool-calls) [Tool Runner (SDK)\ \ Let the SDK handle the agentic loop automatically.](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-runner) [Tool reference\ \ Directory of Anthropic-provided tools and optional properties.](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-reference) Was this page helpful? `review_pr` `merge_pr` `action` * **Use meaningful namespacing in tool names.** When your tools span multiple services or resources, prefix names with the service (e.g., `github_list_prs`, `slack_send_message`). This makes tool selection unambiguous as your library grows, and is especially important when using [tool search](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-search-tool) . * **Design tool responses to return only high-signal information.** Return semantic, stable identifiers (e.g., slugs or UUIDs) rather than opaque internal references, and include only the fields Claude needs to reason about its next step. Bloated responses waste context and make it harder for Claude to extract what matters. ### Example poor tool description CLI ant messages create <<'YAML' model: claude-opus-4-6 max_tokens: 1024 tools: - name: get_weather description: Get the current weather in a given location input_schema: type: object properties: location: type: string description: The city and state, e.g. San Francisco, CA unit: type: string enum: [celsius, fahrenheit] description: The unit of temperature required: [location] input_examples: - location: San Francisco, CA unit: fahrenheit - location: Tokyo, Japan unit: celsius - location: New York, NY # 'unit' is optional messages: - role: user content: What's the weather like in San Francisco? YAML --- # Strict tool use - Claude API Docs Loading... Documentation Page Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Was this page helpful? Setting `strict: true` on a tool definition uses grammar-constrained sampling to guarantee Claude's tool inputs match your JSON Schema. This page covers why strict mode matters for agents, how to enable it, and common use cases. For the supported JSON Schema subset, see [JSON Schema limitations](https://platform.claude.com/docs/en/build-with-claude/structured-outputs#json-schema-limitations) . For non-strict schema guidance, see [Define tools](https://platform.claude.com/docs/en/agents-and-tools/tool-use/define-tools) . Strict tool use validates tool parameters, ensuring Claude calls your functions with correctly-typed arguments. Use strict tool use when you need to: * Validate tool parameters * Build agentic workflows * Ensure type-safe function calls * Handle complex tools with nested properties Why strict tool use matters for agents -------------------------------------------- Building reliable agentic systems requires guaranteed schema conformance. Without strict mode, Claude might return incompatible types (`"2"` instead of `2`) or missing required fields, breaking your functions and causing runtime errors. Strict tool use guarantees type-safe parameters: * Functions receive correctly-typed arguments every time * No need to validate and retry tool calls * Production-ready agents that work consistently at scale For example, suppose a booking system needs `passengers: int`. Without strict mode, Claude might provide `passengers: "two"` or `passengers: "2"`. With `strict: true`, the response will always contain `passengers: 2`. Quick start ----------------- **Response format:** Tool use blocks with validated inputs in `response.content[x].input` Output { "type": "tool_use", "name": "get_weather", "input": { "location": "San Francisco, CA" } } **Guarantees:** * Tool `input` strictly follows the `input_schema` * Tool `name` is always valid (from provided tools or server tools) How it works ------------------ 1. 1 Define your tool schema Create a JSON schema for your tool's `input_schema`. The schema uses standard JSON Schema format with some limitations (see [JSON Schema limitations](https://platform.claude.com/docs/en/build-with-claude/structured-outputs#json-schema-limitations) ). 2. 2 Add strict: true Set `"strict": true` as a top-level property in your tool definition, alongside `name`, `description`, and `input_schema`. 3. 3 Handle tool calls When Claude uses the tool, the `input` field in the tool\_use block will strictly follow your `input_schema`, and the `name` will always be valid. Common use cases ---------------------- ### Validated tool inputs Data retention -------------------- Strict tool use compiles tool `input_schema` definitions into grammars using the same pipeline as [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs) . Tool schemas are temporarily cached for up to 24 hours since last use. Prompts and responses are not retained beyond the API response. Strict tool use is HIPAA eligible, but **PHI must not be included in tool schema definitions**. The API caches compiled schemas separately from message content, and these cached schemas do not receive the same PHI protections as prompts and responses. Do not include PHI in `input_schema` property names, `enum` values, `const` values, or `pattern` regular expressions. PHI should only appear in message content (prompts and responses), where it is protected under HIPAA safeguards. For ZDR and HIPAA eligibility across all features, see [API and data retention](https://platform.claude.com/docs/en/build-with-claude/api-and-data-retention) . Shell 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-4-6", "max_tokens": 1024, "messages": [\ {"role": "user", "content": "What is the weather in San Francisco?"}\ ], "tools": [{\ "name": "get_weather",\ "description": "Get the current weather in a given location",\ "strict": true,\ "input_schema": {\ "type": "object",\ "properties": {\ "location": {\ "type": "string",\ "description": "The city and state, e.g. San Francisco, CA"\ },\ "unit": {\ "type": "string",\ "enum": ["celsius", "fahrenheit"]\ }\ },\ "required": ["location"],\ "additionalProperties": false\ }\ }] }' ### Agentic workflow with multiple validated tools --- # Claude Platform - Claude API Docs Loading... Übersicht Claude Platform Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Was this page helpful? Für Versionshinweise zu Claude Apps siehe die [Versionshinweise für Claude Apps im Claude Help Center](https://support.claude.com/en/articles/12138966-release-notes) . Für Updates zu Claude Code siehe die [vollständige CHANGELOG.md](https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md) im `claude-code` Repository. ### 5\. Februar 2026 * Wir haben [Claude Opus 4.6](https://www.anthropic.com/news/claude-opus-4-6) gestartet, unser intelligentestes Modell für komplexe agentengesteuerte Aufgaben und langfristige Arbeiten. Opus 4.6 empfiehlt [adaptives Denken](https://platform.claude.com/docs/de/build-with-claude/adaptive-thinking) (`thinking: {type: "adaptive"}`); manuelles Denken (`type: "enabled"` mit `budget_tokens`) ist veraltet. Opus 4.6 unterstützt nicht das Vorausfüllen von Assistentennachrichten. Weitere Informationen finden Sie unter [Neuerungen in Claude 4.6](https://platform.claude.com/docs/de/about-claude/models/whats-new-claude-4-6) . * Der [effort-Parameter](https://platform.claude.com/docs/de/build-with-claude/effort) ist jetzt allgemein verfügbar (kein Beta-Header erforderlich) und unterstützt Claude Opus 4.6. Effort ersetzt `budget_tokens` zur Kontrolle der Denktiefe bei neuen Modellen. * Wir haben die [Compaction API](https://platform.claude.com/docs/de/build-with-claude/compaction) in Beta gestartet, die serverseitige Kontextzusammenfassung für effektiv unendliche Gespräche bietet. Verfügbar auf Opus 4.6. * Wir haben [Datenresidenz-Kontrollen](https://platform.claude.com/docs/de/build-with-claude/data-residency) eingeführt, mit denen Sie angeben können, wo die Modellableitung mit dem `inference_geo`\-Parameter ausgeführt wird. Nur US-Inferenz ist mit 1,1x Preisgestaltung für Modelle verfügbar, die nach dem 1. Februar 2026 veröffentlicht wurden. * Das [1M-Token-Kontextfenster](https://platform.claude.com/docs/de/build-with-claude/context-windows#1m-token-context-window) ist jetzt in Beta für Claude Opus 4.6 verfügbar, zusätzlich zu Sonnet 4.5 und Sonnet 4. [Langkontext-Preisgestaltung](https://platform.claude.com/docs/de/about-claude/pricing#long-context-pricing) gilt für Anfragen, die 200K Eingabe-Token überschreiten. * [Feingranulares Tool-Streaming](https://platform.claude.com/docs/de/agents-and-tools/tool-use/fine-grained-tool-streaming) ist jetzt allgemein verfügbar auf allen Modellen und Plattformen (kein Beta-Header erforderlich). Der `output_format`\-Parameter für [strukturierte Ausgaben](https://platform.claude.com/docs/de/build-with-claude/structured-outputs) wurde zu `output_config.format` verschoben. ### 29\. Januar 2026 * [Strukturierte Ausgaben](https://platform.claude.com/docs/de/build-with-claude/structured-outputs) sind jetzt allgemein verfügbar auf der Claude API für Claude Sonnet 4.5, Claude Opus 4.5 und Claude Haiku 4.5. GA umfasst erweiterte Schema-Unterstützung, verbesserte Grammar-Kompilierungslatenz und einen vereinfachten Integrationspfad ohne Beta-Header erforderlich. Der `output_format`\-Parameter wurde zu `output_config.format` verschoben. Bestehende Beta-Benutzer können den Beta-Header während der Übergangsfrist weiterhin verwenden. Strukturierte Ausgaben bleiben in öffentlicher Beta auf Amazon Bedrock und Microsoft Foundry. ### 12\. Januar 2026 * `console.anthropic.com` leitet jetzt zu `platform.claude.com` weiter. Die Claude Console ist als Teil unserer Claude-Markenkonsolidierung zu ihrem neuen Zuhause umgezogen. Bestehende Lesezeichen und Links funktionieren weiterhin über automatische Umleitung. Weitere Details finden Sie in der [Ankündigung vom 16. September 2025](https://platform.claude.com/docs/de/release-notes/overview#september-16-2025) . ### 5\. Januar 2026 * Wir haben das Claude Opus 3 Modell (`claude-3-opus-20240229`) eingestellt. Alle Anfragen an dieses Modell geben jetzt einen Fehler zurück. Wir empfehlen ein Upgrade auf [Claude Opus 4.5](https://platform.claude.com/docs/de/about-claude/models/overview#latest-models-comparison) , das eine deutlich verbesserte Intelligenz zu einem Drittel der Kosten bietet. Forscher können über das [External Researcher Access Program](https://support.claude.com/en/articles/9125743-what-is-the-external-researcher-access-program) fortlaufenden Zugriff auf Claude Opus 3 auf der API anfordern. ### 19\. Dezember 2025 * Wir haben die Einstellung des Claude Haiku 3.5 Modells angekündigt. Weitere Informationen finden Sie in [unserer Dokumentation](https://platform.claude.com/docs/de/about-claude/model-deprecations) . ### 4\. Dezember 2025 * [Strukturierte Ausgaben](https://platform.claude.com/docs/de/build-with-claude/structured-outputs) unterstützen jetzt Claude Haiku 4.5. ### 24\. November 2025 * Wir haben [Claude Opus 4.5](https://www.anthropic.com/news/claude-opus-4-5) gestartet, unser intelligentestes Modell, das maximale Fähigkeit mit praktischer Leistung kombiniert. Ideal für komplexe spezialisierte Aufgaben, professionelle Softwareentwicklung und fortgeschrittene Agenten. Bietet Schrittveränderungen bei Verbesserungen in Vision, Codierung und Computernutzung zu einem zugänglicheren Preis als frühere Opus-Modelle. Weitere Informationen finden Sie in unserer [Modelle & Preisgestaltung Dokumentation](https://platform.claude.com/docs/de/about-claude/models) . * Wir haben [programmatisches Tool-Aufrufen](https://platform.claude.com/docs/de/agents-and-tools/tool-use/programmatic-tool-calling) in öffentlicher Beta gestartet, das Claude ermöglicht, Tools aus der Codeausführung heraus aufzurufen, um Latenz und Token-Nutzung in Multi-Tool-Workflows zu reduzieren. * Wir haben das [Tool-Such-Tool](https://platform.claude.com/docs/de/agents-and-tools/tool-use/tool-search-tool) in öffentlicher Beta gestartet, das Claude ermöglicht, Tools dynamisch zu entdecken und bei Bedarf aus großen Tool-Katalogen zu laden. * Wir haben den [effort-Parameter](https://platform.claude.com/docs/de/build-with-claude/effort) in öffentlicher Beta für Claude Opus 4.5 gestartet, mit dem Sie die Token-Nutzung kontrollieren können, indem Sie zwischen Antwortgründlichkeit und Effizienz abwägen. * Wir haben [clientseitige Kompression](https://platform.claude.com/docs/de/build-with-claude/context-editing#client-side-compaction-sdk) zu unseren Python- und TypeScript-SDKs hinzugefügt, die automatisch Gesprächskontexte durch Zusammenfassung verwalten, wenn `tool_runner` verwendet wird. ### 21\. November 2025 * Suchresultat-Inhaltsblöcke sind jetzt allgemein verfügbar auf Amazon Bedrock. Weitere Informationen finden Sie in unserer [Suchresultate-Dokumentation](https://platform.claude.com/docs/de/build-with-claude/search-results) . ### 19\. November 2025 * Wir haben eine **neue Dokumentationsplattform** unter [platform.claude.com/docs](https://platform.claude.com/docs) gestartet. Unsere Dokumentation lebt jetzt Seite an Seite mit der Claude Console und bietet eine einheitliche Entwicklererfahrung. Die vorherige Dokumentationsseite unter docs.claude.com leitet zur neuen Stelle weiter. ### 18\. November 2025 * Wir haben **Claude in Microsoft Foundry** gestartet und bringen Claude-Modelle zu Azure-Kunden mit Azure-Abrechnung und OAuth-Authentifizierung. Greifen Sie auf die vollständige Messages API einschließlich erweitertem Denken, Prompt-Caching (5-Minuten und 1-Stunde), PDF-Unterstützung, Files API, Agent Skills und Tool-Nutzung zu. Weitere Informationen finden Sie in unserer [Microsoft Foundry Dokumentation](https://platform.claude.com/docs/de/build-with-claude/claude-in-microsoft-foundry) . ### 14\. November 2025 * Wir haben [strukturierte Ausgaben](https://platform.claude.com/docs/de/build-with-claude/structured-outputs) in öffentlicher Beta gestartet, die garantierte Schema-Konformität für Claudes Antworten bieten. Verwenden Sie JSON-Ausgaben für strukturierte Datenausgaben oder striktes Tool-Aufrufen für validierte Tool-Eingaben. Verfügbar für Claude Sonnet 4.5 und Claude Opus 4.1. Um zu aktivieren, verwenden Sie den Beta-Header `structured-outputs-2025-11-13`. ### 28\. Oktober 2025 * Wir haben die Einstellung des Claude Sonnet 3.7 Modells angekündigt. Weitere Informationen finden Sie in [unserer Dokumentation](https://platform.claude.com/docs/de/about-claude/model-deprecations) . * Wir haben die Claude Sonnet 3.5 Modelle eingestellt. Alle Anfragen an diese Modelle geben jetzt einen Fehler zurück. * Wir haben die Kontextbearbeitung mit Denk-Block-Löschen (`clear_thinking_20251015`) erweitert, was die automatische Verwaltung von Denk-Blöcken ermöglicht. Weitere Informationen finden Sie in unserer [Kontextbearbeitungs-Dokumentation](https://platform.claude.com/docs/de/build-with-claude/context-editing) . ### 16\. Oktober 2025 * Wir haben [Agent Skills](https://www.anthropic.com/engineering/equipping-agents-for-the-real-world-with-agent-skills) (`skills-2025-10-02` Beta) gestartet, eine neue Möglichkeit, Claudes Fähigkeiten zu erweitern. Skills sind organisierte Ordner mit Anweisungen, Skripten und Ressourcen, die Claude dynamisch lädt, um spezialisierte Aufgaben auszuführen. Die erste Version umfasst: * **Von Anthropic verwaltete Skills**: Vorgefertigte Skills für die Arbeit mit PowerPoint (.pptx), Excel (.xlsx), Word (.docx) und PDF-Dateien * **Benutzerdefinierte Skills**: Laden Sie Ihre eigenen Skills über die Skills API (`/v1/skills` Endpunkte) hoch, um Fachwissen und Organisationsabläufe zu verpacken * Skills erfordern, dass das [Code-Ausführungs-Tool](https://platform.claude.com/docs/de/agents-and-tools/tool-use/code-execution-tool) aktiviert ist * Weitere Informationen finden Sie in unserer [Agent Skills Dokumentation](https://platform.claude.com/docs/de/agents-and-tools/agent-skills/overview) und [API-Referenz](https://platform.claude.com/docs/de/api/skills/create-skill) ### 15\. Oktober 2025 * Wir haben [Claude Haiku 4.5](https://www.anthropic.com/news/claude-haiku-4-5) gestartet, unser schnellstes und intelligentestes Haiku-Modell mit nahezu Frontier-Leistung. Ideal für Echtzeit-Anwendungen, Hochvolumen-Verarbeitung und kostenempfindliche Bereitstellungen, die starke Argumentation erfordern. Weitere Informationen finden Sie in unserer [Modelle & Preisgestaltung Dokumentation](https://platform.claude.com/docs/de/about-claude/models) . ### 29\. September 2025 * Wir haben [Claude Sonnet 4.5](https://www.anthropic.com/news/claude-sonnet-4-5) gestartet, unser bestes Modell für komplexe Agenten und Codierung, mit der höchsten Intelligenz bei den meisten Aufgaben. Weitere Informationen finden Sie in der [Modellübersicht](https://platform.claude.com/docs/de/about-claude/models/overview) . * Wir haben [globale Endpunkt-Preisgestaltung](https://platform.claude.com/docs/de/about-claude/pricing#third-party-platform-pricing) für AWS Bedrock und Google Vertex AI eingeführt. Die Claude API (1P) Preisgestaltung ist nicht betroffen. * Wir haben einen neuen Stop-Grund `model_context_window_exceeded` eingeführt, mit dem Sie die maximal möglichen Token anfordern können, ohne die Eingabegröße zu berechnen. Weitere Informationen finden Sie in unserer [Dokumentation zum Umgang mit Stop-Gründen](https://platform.claude.com/docs/de/build-with-claude/handling-stop-reasons) . * Wir haben das Memory-Tool in Beta gestartet, das Claude ermöglicht, Informationen über Gespräche hinweg zu speichern und zu konsultieren. Weitere Informationen finden Sie in unserer [Memory-Tool-Dokumentation](https://platform.claude.com/docs/de/agents-and-tools/tool-use/memory-tool) . * Wir haben die Kontextbearbeitung in Beta gestartet und bieten Strategien zur automatischen Verwaltung des Gesprächskontexts. Die erste Version unterstützt das Löschen älterer Tool-Ergebnisse und -Aufrufe bei Annäherung an Token-Limits. Weitere Informationen finden Sie in unserer [Kontextbearbeitungs-Dokumentation](https://platform.claude.com/docs/de/build-with-claude/context-editing) . ### 17\. September 2025 * Wir haben Tool-Helfer in Beta für die Python- und TypeScript-SDKs gestartet, die die Tool-Erstellung und -Ausführung mit typsicherer Eingabevalidierung und einem Tool-Runner für automatisierte Tool-Handhabung in Gesprächen vereinfachen. Weitere Details finden Sie in der Dokumentation für [das Python SDK](https://github.com/anthropics/anthropic-sdk-python/blob/main/tools.md) und [das TypeScript SDK](https://github.com/anthropics/anthropic-sdk-typescript/blob/main/helpers.md#tool-helpers) . ### 16\. September 2025 * Wir haben unsere Entwicklerangebote unter der Claude-Marke vereinheitlicht. Sie sollten aktualisierte Benennungen und URLs auf unserer Plattform und in der Dokumentation sehen, aber **unsere Entwicklerschnittstellen bleiben gleich**. Hier sind einige bemerkenswerte Änderungen: * Claude Console ([console.anthropic.com](https://console.anthropic.com/) ) → Claude Console ([platform.claude.com](https://platform.claude.com/) ). Die Console ist bis zum 12. Januar 2026 unter beiden URLs verfügbar. Nach diesem Datum leitet [console.anthropic.com](https://console.anthropic.com/) automatisch zu [platform.claude.com](https://platform.claude.com/) weiter. * Anthropic Docs ([docs.claude.com](https://docs.claude.com/) ) → Claude Docs ([docs.claude.com](https://docs.claude.com/) ) * Anthropic Help Center ([support.claude.com](https://support.claude.com/) ) → Claude Help Center ([support.claude.com](https://support.claude.com/) ) * API-Endpunkte, Header, Umgebungsvariablen und SDKs bleiben gleich. Ihre bestehenden Integrationen funktionieren weiterhin ohne Änderungen. ### 10\. September 2025 * Wir haben das Web-Abruf-Tool in Beta gestartet, das Claude ermöglicht, vollständige Inhalte von angegebenen Webseiten und PDF-Dokumenten abzurufen. Weitere Informationen finden Sie in unserer [Web-Abruf-Tool-Dokumentation](https://platform.claude.com/docs/de/agents-and-tools/tool-use/web-fetch-tool) . * Wir haben die [Claude Code Analytics API](https://platform.claude.com/docs/de/build-with-claude/claude-code-analytics-api) gestartet, die Organisationen ermöglicht, programmgesteuert auf tägliche aggregierte Nutzungsmetriken für Claude Code zuzugreifen, einschließlich Produktivitätsmetriken, Tool-Nutzungsstatistiken und Kostendaten. ### 8\. September 2025 * Wir haben eine Beta-Version des [C# SDK](https://github.com/anthropics/anthropic-sdk-csharp) gestartet. ### 5\. September 2025 * Wir haben [Rate-Limit-Diagramme](https://platform.claude.com/docs/de/api/rate-limits#monitoring-your-rate-limits-in-the-console) auf der Console [Usage](https://console.anthropic.com/settings/usage) Seite gestartet, mit denen Sie Ihre API-Rate-Limit-Nutzung und Caching-Raten im Laufe der Zeit überwachen können. ### 3\. September 2025 * Wir haben Unterstützung für zitierbare Dokumente in clientseitigen Tool-Ergebnissen gestartet. Weitere Informationen finden Sie in unserer [Tool-Nutzungs-Dokumentation](https://platform.claude.com/docs/de/agents-and-tools/tool-use/implement-tool-use) . ### 2\. September 2025 * Wir haben v2 des [Code-Ausführungs-Tools](https://platform.claude.com/docs/de/agents-and-tools/tool-use/code-execution-tool) in öffentlicher Beta gestartet, das das ursprüngliche Python-only-Tool durch Bash-Befehlsausführung und direkte Dateiverwaltungsfähigkeiten ersetzt, einschließlich des Schreibens von Code in anderen Sprachen. ### 27\. August 2025 * Wir haben eine Beta-Version des [PHP SDK](https://github.com/anthropics/anthropic-sdk-php) gestartet. ### 26\. August 2025 * Wir haben die Rate Limits für das [1M-Token-Kontextfenster](https://platform.claude.com/docs/de/build-with-claude/context-windows#1m-token-context-window) für Claude Sonnet 4 auf der Claude API erhöht. Weitere Informationen finden Sie unter [Langkontext-Rate-Limits](https://platform.claude.com/docs/de/api/rate-limits#long-context-rate-limits) . * Das 1M-Token-Kontextfenster ist jetzt auf Google Cloud's Vertex AI verfügbar. Weitere Informationen finden Sie unter [Claude auf Vertex AI](https://platform.claude.com/docs/de/build-with-claude/claude-on-vertex-ai) . ### 19\. August 2025 * Request-IDs sind jetzt direkt in Fehlerantwort-Texten neben dem bestehenden `request-id` Header enthalten. Weitere Informationen finden Sie in unserer [Fehler-Dokumentation](https://platform.claude.com/docs/de/api/errors#error-shapes) . ### 18\. August 2025 * Wir haben die [Usage & Cost API](https://platform.claude.com/docs/de/build-with-claude/usage-cost-api) veröffentlicht, die Administratoren ermöglicht, die Nutzungs- und Kostendaten ihrer Organisation programmgesteuert zu überwachen. * Wir haben einen neuen Endpunkt zur Admin API hinzugefügt, um Organisationsinformationen abzurufen. Weitere Details finden Sie in der [Organization Info Admin API Referenz](https://platform.claude.com/docs/de/api/admin-api/organization/get-me) . ### 13\. August 2025 * Wir haben die Einstellung der Claude Sonnet 3.5 Modelle (`claude-3-5-sonnet-20240620` und `claude-3-5-sonnet-20241022`) angekündigt. Diese Modelle werden am 28. Oktober 2025 eingestellt. Wir empfehlen die Migration zu Claude Sonnet 4.5 (`claude-sonnet-4-5-20250929`) für verbesserte Leistung und Fähigkeiten. Weitere Informationen finden Sie in der [Modell-Einstellungs-Dokumentation](https://platform.claude.com/docs/de/about-claude/model-deprecations) . * Die 1-Stunden-Cache-Dauer für Prompt-Caching ist jetzt allgemein verfügbar. Sie können jetzt die erweiterte Cache-TTL ohne Beta-Header verwenden. Weitere Informationen finden Sie in unserer [Prompt-Caching-Dokumentation](https://platform.claude.com/docs/de/build-with-claude/prompt-caching#1-hour-cache-duration) . ### 12\. August 2025 * Wir haben Beta-Unterstützung für ein [1M-Token-Kontextfenster](https://platform.claude.com/docs/de/build-with-claude/context-windows#1m-token-context-window) in Claude Sonnet 4 auf der Claude API und Amazon Bedrock gestartet. ### 11\. August 2025 * Einige Kunden könnten auf 429 (`rate_limit_error`) [Fehler](https://platform.claude.com/docs/de/api/errors) nach einem starken Anstieg der API-Nutzung aufgrund von Beschleunigungslimits auf der API stoßen. Zuvor würden in ähnlichen Szenarien 529 (`overloaded_error`) Fehler auftreten. ### 8\. August 2025 * Suchresultat-Inhaltsblöcke sind jetzt allgemein verfügbar auf der Claude API und Google Cloud's Vertex AI. Diese Funktion ermöglicht natürliche Zitate für RAG-Anwendungen mit ordnungsgemäßer Quellenattribution. Der Beta-Header `search-results-2025-06-09` ist nicht mehr erforderlich. Weitere Informationen finden Sie in unserer [Suchresultate-Dokumentation](https://platform.claude.com/docs/de/build-with-claude/search-results) . ### 5\. August 2025 * Wir haben [Claude Opus 4.1](https://www.anthropic.com/news/claude-opus-4-1) gestartet, ein inkrementelles Update zu Claude Opus 4 mit erweiterten Fähigkeiten und Leistungsverbesserungen.\* Weitere Informationen finden Sie in unserer [Modelle & Preisgestaltung Dokumentation](https://platform.claude.com/docs/de/about-claude/models) . _\* - Opus 4.1 erlaubt nicht, dass sowohl `temperature` als auch `top_p` Parameter angegeben werden. Bitte verwenden Sie nur einen._ ### 28\. Juli 2025 * Wir haben `text_editor_20250728` veröffentlicht, ein aktualisiertes Text-Editor-Tool, das einige Probleme aus den vorherigen Versionen behebt und einen optionalen `max_characters` Parameter hinzufügt, mit dem Sie die Kürzungslänge beim Anzeigen großer Dateien kontrollieren können. ### 24\. Juli 2025 * Wir haben [Rate Limits](https://platform.claude.com/docs/de/api/rate-limits) für Claude Opus 4 auf der Claude API erhöht, um Ihnen mehr Kapazität zum Bauen und Skalieren mit Claude zu geben. Für Kunden mit [Nutzungsstufe 1-4 Rate Limits](https://platform.claude.com/docs/de/api/rate-limits#rate-limits) gelten diese Änderungen sofort für Ihr Konto - keine Aktion erforderlich. ### 21\. Juli 2025 * Wir haben die Claude 2.0, Claude 2.1 und Claude Sonnet 3 Modelle eingestellt. Alle Anfragen an diese Modelle geben jetzt einen Fehler zurück. Weitere Informationen finden Sie in [unserer Dokumentation](https://platform.claude.com/docs/de/about-claude/model-deprecations) . ### 17\. Juli 2025 * Wir haben [Rate Limits](https://platform.claude.com/docs/de/api/rate-limits) für Claude Sonnet 4 auf der Claude API erhöht, um Ihnen mehr Kapazität zum Bauen und Skalieren mit Claude zu geben. Für Kunden mit [Nutzungsstufe 1-4 Rate Limits](https://platform.claude.com/docs/de/api/rate-limits#rate-limits) gelten diese Änderungen sofort für Ihr Konto - keine Aktion erforderlich. ### 3\. Juli 2025 * Wir haben Suchresultat-Inhaltsblöcke in Beta gestartet, die natürliche Zitate für RAG-Anwendungen ermöglichen. Tools können jetzt Suchergebnisse mit ordnungsgemäßer Quellenattribution zurückgeben, und Claude wird diese Quellen automatisch in seinen Antworten zitieren - was der Zitierqualität der Websuche entspricht. Dies beseitigt die Notwendigkeit für Dokument-Workarounds in benutzerdefinierten Knowledge-Base-Anwendungen. Weitere Informationen finden Sie in unserer [Suchresultate-Dokumentation](https://platform.claude.com/docs/de/build-with-claude/search-results) . Um diese Funktion zu aktivieren, verwenden Sie den Beta-Header `search-results-2025-06-09`. ### 30\. Juni 2025 * Wir haben die Einstellung des Claude Opus 3 Modells angekündigt. Weitere Informationen finden Sie in [unserer Dokumentation](https://platform.claude.com/docs/de/about-claude/model-deprecations) . ### 23\. Juni 2025 * Console-Benutzer mit der Developer-Rolle können jetzt auf die [Cost](https://console.anthropic.com/settings/cost) Seite zugreifen. Zuvor erlaubte die Developer-Rolle den Zugriff auf die [Usage](https://console.anthropic.com/settings/usage) Seite, aber nicht auf die Cost-Seite. ### 11\. Juni 2025 * Wir haben [feingranulares Tool-Streaming](https://platform.claude.com/docs/de/agents-and-tools/tool-use/fine-grained-tool-streaming) in öffentlicher Beta gestartet, eine Funktion, die Claude ermöglicht, Tool-Nutzungsparameter zu streamen, ohne zu puffern / JSON-Validierung. Um feingranulares Tool-Streaming zu aktivieren, verwenden Sie den [Beta-Header](https://platform.claude.com/docs/de/api/beta-headers) `fine-grained-tool-streaming-2025-05-14`. ### 22\. Mai 2025 * Wir haben [Claude Opus 4 und Claude Sonnet 4](http://www.anthropic.com/news/claude-4) gestartet, unsere neuesten Modelle mit erweiterten Denkfähigkeiten. Weitere Informationen finden Sie in unserer [Modelle & Preisgestaltung Dokumentation](https://platform.claude.com/docs/de/about-claude/models) . * Das Standardverhalten des [erweiterten Denkens](https://platform.claude.com/docs/de/build-with-claude/extended-thinking) in Claude 4 Modellen gibt eine Zusammenfassung von Claudes vollständigem Denkprozess zurück, wobei das vollständige Denken verschlüsselt und im `signature` Feld der `thinking` Block-Ausgabe zurückgegeben wird. * Wir haben [verschachteltes Denken](https://platform.claude.com/docs/de/build-with-claude/extended-thinking#interleaved-thinking) in öffentlicher Beta gestartet, eine Funktion, die Claude ermöglicht, zwischen Tool-Aufrufen zu denken. Um verschachteltes Denken zu aktivieren, verwenden Sie den [Beta-Header](https://platform.claude.com/docs/de/api/beta-headers) `interleaved-thinking-2025-05-14`. * Wir haben die [Files API](https://platform.claude.com/docs/de/build-with-claude/files) in öffentlicher Beta gestartet, die es Ihnen ermöglicht, Dateien hochzuladen und sie in der Messages API und dem Code-Ausführungs-Tool zu referenzieren. * Wir haben das [Code-Ausführungs-Tool](https://platform.claude.com/docs/de/agents-and-tools/tool-use/code-execution-tool) in öffentlicher Beta gestartet, ein Tool, das Claude ermöglicht, Python-Code in einer sicheren, isolierten Umgebung auszuführen. * Wir haben den in öffentlicher Beta gestartet, eine Funktion, die es Ihnen ermöglicht, sich direkt von der Messages API aus mit Remote-MCP-Servern zu verbinden. ### 21\. Mai 2025 * Wir haben unser [Ruby SDK](https://github.com/anthropics/anthropic-sdk-ruby) von Beta zu GA verschoben. ### 7\. Mai 2025 * Wir haben ein Web-Such-Tool in der API gestartet, das Claude ermöglicht, auf aktuelle Informationen aus dem Web zuzugreifen. Weitere Informationen finden Sie in unserer [Web-Such-Tool-Dokumentation](https://platform.claude.com/docs/de/agents-and-tools/tool-use/web-search-tool) . ### 1\. Mai 2025 * Cache-Kontrolle muss jetzt direkt im übergeordneten `content` Block von `tool_result` und `document.source` angegeben werden. Für Rückwärtskompatibilität wird, wenn Cache-Kontrolle auf dem letzten Block in `tool_result.content` oder `document.source.content` erkannt wird, automatisch auf den übergeordneten Block angewendet. Cache-Kontrolle auf anderen Blöcken innerhalb von `tool_result.content` und `document.source.content` führt zu einem Validierungsfehler. ### 9\. April 2025 * Wir haben eine Beta-Version des [Ruby SDK](https://github.com/anthropics/anthropic-sdk-ruby) gestartet ### 31\. März 2025 * Wir haben unser [Java SDK](https://github.com/anthropics/anthropic-sdk-java) von Beta zu GA verschoben. * Wir haben unser [Go SDK](https://github.com/anthropics/anthropic-sdk-go) von Alpha zu Beta verschoben. ### 27\. Februar 2025 * Wir haben URL-Quellblöcke für Bilder und PDFs in der Messages API hinzugefügt. Sie können jetzt direkt auf Bilder und PDFs über URL verweisen, anstatt sie base64-kodieren zu müssen. Weitere Informationen finden Sie in unserer [Vision-Dokumentation](https://platform.claude.com/docs/de/build-with-claude/vision) und [PDF-Unterstützungs-Dokumentation](https://platform.claude.com/docs/de/build-with-claude/pdf-support) . * Wir haben Unterstützung für eine `none` Option zum `tool_choice` Parameter in der Messages API hinzugefügt, die Claude daran hindert, Tools aufzurufen. Zusätzlich müssen Sie keine `tools` mehr bereitstellen, wenn Sie `tool_use` und `tool_result` Blöcke einbeziehen. * Wir haben einen OpenAI-kompatiblen API-Endpunkt gestartet, mit dem Sie Claude-Modelle testen können, indem Sie nur Ihren API-Schlüssel, die Basis-URL und den Modellnamen in bestehenden OpenAI-Integrationen ändern. Diese Kompatibilitätsschicht unterstützt Core-Chat-Completion-Funktionalität. Weitere Informationen finden Sie in unserer [OpenAI SDK Kompatibilitäts-Dokumentation](https://platform.claude.com/docs/de/api/openai-sdk) . ### 24\. Februar 2025 * Wir haben [Claude Sonnet 3.7](http://www.anthropic.com/news/claude-3-7-sonnet) gestartet, unser intelligentestes Modell bisher. Claude Sonnet 3.7 kann nahezu sofortige Antworten geben oder sein erweitertes Denken Schritt für Schritt zeigen. Ein Modell, zwei Arten zu denken. Weitere Informationen zu allen Claude-Modellen finden Sie in unserer [Modelle & Preisgestaltung Dokumentation](https://platform.claude.com/docs/de/about-claude/models) . * Wir haben Vision-Unterstützung zu Claude Haiku 3.5 hinzugefügt, was dem Modell ermöglicht, Bilder zu analysieren und zu verstehen. * Wir haben eine Token-effiziente Tool-Nutzungs-Implementierung veröffentlicht, die die Gesamtleistung bei der Verwendung von Tools mit Claude verbessert. Weitere Informationen finden Sie in unserer [Tool-Nutzungs-Dokumentation](https://platform.claude.com/docs/de/agents-and-tools/tool-use/overview) . * Wir haben die Standard-Temperatur in der [Console](https://console.anthropic.com/workbench) für neue Prompts von 0 auf 1 geändert, um Konsistenz mit der Standard-Temperatur in der API zu gewährleisten. Bestehende gespeicherte Prompts sind unverändert. * Wir haben aktualisierte Versionen unserer Tools veröffentlicht, die das Text-Edit- und Bash-Tool vom Computer-Nutzungs-System-Prompt entkoppeln: * `bash_20250124`: Gleiche Funktionalität wie vorherige Version, aber unabhängig von Computernutzung. Erfordert keinen Beta-Header. * : Gleiche Funktionalität wie vorherige Version, aber unabhängig von Computernutzung. Erfordert keinen Beta-Header. ### 10\. Februar 2025 * Wir haben den `anthropic-organization-id` Response-Header zu allen API-Antworten hinzugefügt. Dieser Header bietet die Organisations-ID, die dem in der Anfrage verwendeten API-Schlüssel zugeordnet ist. ### 31\. Januar 2025 * Wir haben unser [Java SDK](https://github.com/anthropics/anthropic-sdk-java) von Alpha zu Beta verschoben. ### 23\. Januar 2025 * Wir haben die Zitier-Fähigkeit in der API gestartet, die Claude ermöglicht, Quellenattribution für Informationen bereitzustellen. Weitere Informationen finden Sie in unserer [Zitier-Dokumentation](https://platform.claude.com/docs/de/build-with-claude/citations) . * Wir haben Unterstützung für Klartext-Dokumente und benutzerdefinierte Inhalts-Dokumente in der Messages API hinzugefügt. ### 21\. Januar 2025 * Wir haben die Einstellung der Claude 2, Claude 2.1 und Claude Sonnet 3 Modelle angekündigt. Weitere Informationen finden Sie in [unserer Dokumentation](https://platform.claude.com/docs/de/about-claude/model-deprecations) . ### 15\. Januar 2025 * Wir haben [Prompt-Caching](https://platform.claude.com/docs/de/build-with-claude/prompt-caching) aktualisiert, um einfacher zu verwenden. Jetzt, wenn Sie einen Cache-Haltepunkt setzen, lesen wir automatisch aus Ihrem längsten zuvor zwischengespeicherten Präfix. * Sie können jetzt Wörter in Claudes Mund legen, wenn Sie Tools verwenden. ### 10\. Januar 2025 * Wir haben die Unterstützung für [Prompt-Caching in der Message Batches API](https://platform.claude.com/docs/de/build-with-claude/batch-processing#using-prompt-caching-with-message-batches) optimiert, um die Cache-Hit-Rate zu verbessern. ### 19\. Dezember 2024 * Wir haben Unterstützung für einen [Delete-Endpunkt](https://platform.claude.com/docs/de/api/deleting-message-batches) in der Message Batches API hinzugefügt ### 17\. Dezember 2024 Die folgenden Funktionen sind jetzt allgemein verfügbar in der Claude API: * [Models API](https://platform.claude.com/docs/de/api/models-list) : Verfügbare Modelle abfragen, Modell-IDs validieren und [Modell-Aliase](https://platform.claude.com/docs/de/about-claude/models#model-names) zu ihren kanonischen Modell-IDs auflösen. * [Message Batches API](https://platform.claude.com/docs/de/build-with-claude/batch-processing) : Verarbeiten Sie große Batches von Nachrichten asynchron zu 50% der Standard-API-Kosten. * [Token Counting API](https://platform.claude.com/docs/de/build-with-claude/token-counting) : Berechnen Sie Token-Zählungen für Messages, bevor Sie sie an Claude senden. * [Prompt Caching](https://platform.claude.com/docs/de/build-with-claude/prompt-caching) : Reduzieren Sie Kosten um bis zu 90% und Latenz um bis zu 80%, indem Sie Prompt-Inhalte zwischenspeichern und wiederverwenden. * [PDF-Unterstützung](https://platform.claude.com/docs/de/build-with-claude/pdf-support) : Verarbeiten Sie PDFs, um sowohl Text- als auch visuelle Inhalte in Dokumenten zu analysieren. Wir haben auch neue offizielle SDKs veröffentlicht: * [Java SDK](https://github.com/anthropics/anthropic-sdk-java) (Alpha) * [Go SDK](https://github.com/anthropics/anthropic-sdk-go) (Alpha) ### 4\. Dezember 2024 * Wir haben die Möglichkeit hinzugefügt, nach API-Schlüssel auf den [Usage](https://console.anthropic.com/settings/usage) und [Cost](https://console.anthropic.com/settings/cost) Seiten der [Developer Console](https://console.anthropic.com/) zu gruppieren * Wir haben zwei neue **Last used at** und **Cost** Spalten und die Möglichkeit hinzugefügt, nach jeder Spalte auf der [API keys](https://console.anthropic.com/settings/keys) Seite der [Developer Console](https://console.anthropic.com/) zu sortieren ### 21\. November 2024 * Wir haben die [Admin API](https://platform.claude.com/docs/de/build-with-claude/administration-api) veröffentlicht, die Benutzern ermöglicht, die Ressourcen ihrer Organisation programmgesteuert zu verwalten. ### 20\. November 2024 * Wir haben unsere Rate Limits für die Messages API aktualisiert. Wir haben das Tokens-pro-Minute-Rate-Limit durch neue Input- und Output-Tokens-pro-Minute-Rate-Limits ersetzt. Weitere Informationen finden Sie in unserer [Dokumentation](https://platform.claude.com/docs/de/api/rate-limits) . * Wir haben Unterstützung für [Tool-Nutzung](https://platform.claude.com/docs/de/agents-and-tools/tool-use/overview) in der [Workbench](https://console.anthropic.com/workbench) hinzugefügt. ### 13\. November 2024 * Wir haben PDF-Unterstützung für alle Claude Sonnet 3.5 Modelle hinzugefügt. Weitere Informationen finden Sie in unserer [Dokumentation](https://platform.claude.com/docs/de/build-with-claude/pdf-support) . ### 6\. November 2024 * Wir haben die Claude 1 und Instant Modelle eingestellt. Weitere Informationen finden Sie in [unserer Dokumentation](https://platform.claude.com/docs/de/about-claude/model-deprecations) . ### 4\. November 2024 * [Claude Haiku 3.5](https://www.anthropic.com/claude/haiku) ist jetzt auf der Claude API als Text-only-Modell verfügbar. ### 1\. November 2024 * Wir haben PDF-Unterstützung für die Verwendung mit dem neuen Claude Sonnet 3.5 hinzugefügt. Weitere Informationen finden Sie in unserer [Dokumentation](https://platform.claude.com/docs/de/build-with-claude/pdf-support) . * Wir haben auch Token-Zählung hinzugefügt, mit der Sie die Gesamtzahl der Token in einer Message bestimmen können, bevor Sie sie an Claude senden. Weitere Informationen finden Sie in unserer [Dokumentation](https://platform.claude.com/docs/de/build-with-claude/token-counting) . ### 22\. Oktober 2024 * Wir haben von Anthropic definierte Computer-Nutzungs-Tools zu unserer API für die Verwendung mit dem neuen Claude Sonnet 3.5 hinzugefügt. Weitere Informationen finden Sie in unserer [Dokumentation](https://platform.claude.com/docs/de/agents-and-tools/tool-use/computer-use-tool) . * Claude Sonnet 3.5, unser intelligentestes Modell bisher, hat gerade ein Upgrade erhalten und ist jetzt auf der Claude API verfügbar. Weitere Informationen finden Sie in der [Claude Sonnet Dokumentation](https://www.anthropic.com/claude/sonnet) . ### 8\. Oktober 2024 * Die Message Batches API ist jetzt in Beta verfügbar. Verarbeiten Sie große Batches von Abfragen asynchron in der Claude API zu 50% weniger Kosten. Weitere Informationen finden Sie in unserer [Dokumentation](https://platform.claude.com/docs/de/build-with-claude/batch-processing) . * Wir haben die Einschränkungen bei der Reihenfolge von `user`/`assistant` Turns in unserer Messages API gelockert. Aufeinanderfolgende `user`/`assistant` Nachrichten werden zu einer einzelnen Nachricht kombiniert, anstatt einen Fehler zu verursachen, und wir erfordern nicht mehr, dass die erste Eingabenachricht eine `user` Nachricht ist. * Wir haben die Build- und Scale-Pläne zugunsten einer Standard-Feature-Suite (ehemals Build genannt) sowie zusätzlicher Funktionen, die über den Vertrieb verfügbar sind, eingestellt. Weitere Informationen finden Sie in unseren [API-Preisinformationen](https://claude.com/platform/api) . ### 3\. Oktober 2024 * Wir haben die Möglichkeit hinzugefügt, parallele Tool-Nutzung in der API zu deaktivieren. Setzen Sie `disable_parallel_tool_use: true` im `tool_choice` Feld, um sicherzustellen, dass Claude höchstens ein Tool verwendet. Weitere Informationen finden Sie in unserer [Dokumentation](https://platform.claude.com/docs/de/agents-and-tools/tool-use/implement-tool-use#parallel-tool-use) . ### 10\. September 2024 * Wir haben Workspaces zur [Developer Console](https://console.anthropic.com/) hinzugefügt. Workspaces ermöglichen es Ihnen, benutzerdefinierte Ausgaben- oder Rate-Limits zu setzen, API-Schlüssel zu gruppieren, Nutzung nach Projekt zu verfolgen und den Zugriff mit Benutzerrollen zu kontrollieren. Weitere Informationen finden Sie in unserem [Blog-Beitrag](https://www.anthropic.com/news/workspaces) . ### 4\. September 2024 * Wir haben die Einstellung der Claude 1 Modelle angekündigt. Weitere Informationen finden Sie in [unserer Dokumentation](https://platform.claude.com/docs/de/about-claude/model-deprecations) . ### 22\. August 2024 * Wir haben Unterstützung für die Verwendung des SDK in Browsern hinzugefügt, indem wir CORS-Header in den API-Antworten zurückgeben. Setzen Sie `dangerouslyAllowBrowser: true` in der SDK-Instanziierung, um diese Funktion zu aktivieren. ### 19\. August 2024 * Wir haben 8.192 Token-Ausgaben von Beta zu allgemeiner Verfügbarkeit für Claude Sonnet 3.5 verschoben. ### 14\. August 2024 * [Prompt Caching](https://platform.claude.com/docs/de/build-with-claude/prompt-caching) ist jetzt als Beta-Funktion in der Claude API verfügbar. Zwischenspeichern und verwenden Sie Prompts erneut, um Latenz um bis zu 80% und Kosten um bis zu 90% zu reduzieren. ### 15\. Juli 2024 * Generieren Sie Ausgaben bis zu 8.192 Token Länge von Claude Sonnet 3.5 mit dem neuen `anthropic-beta: max-tokens-3-5-sonnet-2024-07-15` Header. ### 9\. Juli 2024 * Generieren Sie automatisch Testfälle für Ihre Prompts mit Claude in der [Developer Console](https://console.anthropic.com/) . * Vergleichen Sie die Ausgaben von verschiedenen Prompts nebeneinander im neuen Output-Vergleichsmodus in der [Developer Console](https://console.anthropic.com/) . ### 27\. Juni 2024 * Sehen Sie API-Nutzung und Abrechnung aufgeschlüsselt nach Dollarbetrag, Token-Zählung und API-Schlüsseln in den neuen [Usage](https://console.anthropic.com/settings/usage) und [Cost](https://console.anthropic.com/settings/cost) Tabs in der [Developer Console](https://console.anthropic.com/) . * Sehen Sie Ihre aktuellen API-Rate-Limits in der neuen [Rate Limits](https://console.anthropic.com/settings/limits) Tab in der [Developer Console](https://console.anthropic.com/) . ### 20\. Juni 2024 * [Claude Sonnet 3.5](http://anthropic.com/news/claude-3-5-sonnet) , unser intelligentestes Modell bisher, ist jetzt allgemein verfügbar über die Claude API, Amazon Bedrock und Google Vertex AI. ### 30\. Mai 2024 * [Tool-Nutzung](https://platform.claude.com/docs/de/agents-and-tools/tool-use/overview) ist jetzt allgemein verfügbar über die Claude API, Amazon Bedrock und Google Vertex AI. ### 10\. Mai 2024 * Unser Prompt-Generator-Tool ist jetzt in der [Developer Console](https://console.anthropic.com/) verfügbar. Prompt Generator macht es einfach, Claude zu führen, um hochwertige Prompts zu generieren, die auf Ihre spezifischen Aufgaben zugeschnitten sind. Weitere Informationen finden Sie in unserem [Blog-Beitrag](https://www.anthropic.com/news/prompt-generator) . [MCP-Connector](https://platform.claude.com/docs/de/agents-and-tools/mcp-connector) * Um die Antwortqualität zu verbessern und Tool-Fehler zu verringern, haben wir den Standardwert für den `top_p` [Nucleus Sampling](https://en.wikipedia.org/wiki/Top-p_sampling) Parameter in der Messages API von 0,999 auf 0,99 für alle Modelle geändert. Um diese Änderung rückgängig zu machen, setzen Sie `top_p` auf 0,999. Zusätzlich können Sie, wenn erweitertes Denken aktiviert ist, `top_p` jetzt auf Werte zwischen 0,95 und 1 setzen. * Wir haben unser [Go SDK](https://github.com/anthropics/anthropic-sdk-go) von Beta zu GA verschoben. * Wir haben Minuten- und Stunden-Granularität zur [Usage](https://console.anthropic.com/settings/usage) Seite der Console neben 429-Fehlerraten auf der Usage-Seite hinzugefügt. `text_editor_20250124` * `computer_20250124`: Aktualisiertes Computer-Nutzungs-Tool mit neuen Befehlsoptionen einschließlich "hold\_key", "left\_mouse\_down", "left\_mouse\_up", "scroll", "triple\_click" und "wait". Dieses Tool erfordert den "computer-use-2025-01-24" anthropic-beta Header. Weitere Informationen finden Sie in unserer [Tool-Nutzungs-Dokumentation](https://platform.claude.com/docs/de/agents-and-tools/tool-use/overview) . --- # Server tools - Claude API Docs Loading... Documentation Page Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page This page covers the shared mechanics of server-executed tools: the `server_tool_use` block, `pause_turn` continuation, ZDR considerations, and domain filtering. For individual tools, see the [tool reference](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-reference) . The server\_tool\_use block --------------------------------- The `server_tool_use` block appears in Claude's response when a server-executed tool runs. Its `id` field uses the `srvtoolu_` prefix to distinguish it from client tool calls: { "type": "server_tool_use", "id": "srvtoolu_01A2B3C4D5E6F7G8H9", "name": "web_search", "input": { "query": "latest quantum computing breakthroughs" } } The API executes the tool internally. You see the call and its result in the response, but you don't handle execution. Unlike client `tool_use` blocks, you don't need to respond with a `tool_result`. The result block appears immediately after the `server_tool_use` block in the same assistant turn. The server-side loop and pause\_turn ------------------------------------------ When using server tools like web search, the API may return a `pause_turn` stop reason, indicating that the API has paused a long-running turn. Here's how to handle the `pause_turn` stop reason: Python # Initial request with web search response = client.messages.create( model="claude-opus-4-6", max_tokens=1024, messages=[\ {\ "role": "user",\ "content": "Search for comprehensive information about quantum computing breakthroughs in 2025",\ }\ ], tools=[{"type": "web_search_20250305", "name": "web_search", "max_uses": 10}], ) # Check if the response has pause_turn stop reason if response.stop_reason == "pause_turn": # Continue the conversation with the paused content messages = [\ {\ "role": "user",\ "content": "Search for comprehensive information about quantum computing breakthroughs in 2025",\ },\ {"role": "assistant", "content": response.content},\ ] # Send the continuation request continuation = client.messages.create( model="claude-opus-4-6", max_tokens=1024, messages=messages, tools=[{"type": "web_search_20250305", "name": "web_search", "max_uses": 10}], ) print(continuation) else: print(response) When handling `pause_turn`: * **Continue the conversation:** Pass the paused response back as-is in a subsequent request to let Claude continue its turn * **Modify if needed:** You can optionally modify the content before continuing if you want to interrupt or redirect the conversation * **Preserve tool state:** Include the same tools in the continuation request to maintain functionality ZDR and allowed\_callers ------------------------------ The basic versions of web search (`web_search_20250305`) and web fetch (`web_fetch_20250910`) are eligible for [Zero Data Retention (ZDR)](https://platform.claude.com/docs/en/build-with-claude/zero-data-retention) . The `_20260209` versions with dynamic filtering are **not** ZDR-eligible by default because dynamic filtering relies on code execution internally. To use a `_20260209` server tool with ZDR, disable dynamic filtering by setting `"allowed_callers": ["direct"]` on the tool: { "type": "web_search_20260209", "name": "web_search", "allowed_callers": ["direct"] } This restricts the tool to direct invocation only, bypassing the internal code execution step. While the web fetch tool itself is ZDR-eligible, website publishers may retain any parameters passed to the URL if Claude fetches content from their site. Domain filtering ---------------------- Server tools that access the web accept `allowed_domains` and `blocked_domains` parameters to control which domains Claude can reach. When using domain filters: * Domains should not include the HTTP/HTTPS scheme (use `example.com` instead of `https://example.com`) * Subdomains are automatically included (`example.com` covers `docs.example.com`) * Specific subdomains restrict results to only that subdomain (`docs.example.com` returns only results from that subdomain, not from `example.com` or `api.example.com`) * Subpaths are supported and match anything after the path (`example.com/blog` matches `example.com/blog/post-1`) * You can use either `allowed_domains` or `blocked_domains`, but not both in the same request **Wildcard support:** * Only one wildcard (`*`) is allowed per domain entry, and it must appear after the domain part (in the path) * Valid: `example.com/*`, `example.com/*/articles` * Invalid: `*.example.com`, `ex*.com`, `example.com/*/news/*` Invalid domain formats return an `invalid_tool_input` tool error. Request-level domain restrictions must be compatible with organization-level domain restrictions configured in the Console. Request-level domains can only further restrict domains, not override or expand beyond the organization-level list. If your request includes domains that conflict with organization settings, the API returns a validation error. Be aware that Unicode characters in domain names can create security vulnerabilities through homograph attacks, where visually similar characters from different scripts can bypass domain filters. For example, `аmazon.com` (using Cyrillic 'а') may appear identical to `amazon.com` but represents a different domain. When configuring domain allow/block lists: * Use ASCII-only domain names when possible * Consider that URL parsers may handle Unicode normalization differently * Test your domain filters with potential homograph variations * Regularly audit your domain configurations for suspicious Unicode characters Dynamic filtering with code execution ------------------------------------------- The `_20260209` versions of web search and web fetch use code execution internally to apply dynamic filters against search results. Including a standalone `code_execution` tool alongside `_20260209` versions of web tools creates two execution environments, which can confuse the model. Use one or the other, or pin both to the same version. Streaming server-tool events ---------------------------------- Server-tool events stream as part of the normal SSE flow. The `server_tool_use` block and its result arrive as `content_block_start` and `content_block_delta` events, the same way text and client tool calls stream. See [Streaming](https://platform.claude.com/docs/en/build-with-claude/streaming) for the full event reference. Individual tool pages document tool-specific event names where they differ. Batch requests -------------------- All server tools support batch processing. See [Batch processing](https://platform.claude.com/docs/en/build-with-claude/batch-processing) . Next steps ---------------- [Web search\ \ Search the web and cite results.](https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-search-tool) [Web fetch\ \ Retrieve content from specific URLs.](https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-fetch-tool) [Code execution\ \ Run Python in a sandboxed container.](https://platform.claude.com/docs/en/agents-and-tools/tool-use/code-execution-tool) [Tool search\ \ Discover and load tools on demand.](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-search-tool) Was this page helpful? --- # Parallel tool use - Claude API Docs Loading... Documentation Page Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Was this page helpful? This page covers parallel tool calls: when Claude calls multiple tools in one turn, how to format the message history so parallelism keeps working, and how to disable it. For the single-call flow, see [Handle tool calls](https://platform.claude.com/docs/en/agents-and-tools/tool-use/handle-tool-calls) . By default, Claude may use multiple tools to answer a user query. You can disable this behavior by: * Setting `disable_parallel_tool_use=true` when tool\_choice type is `auto`, which ensures that Claude uses **at most one** tool * Setting `disable_parallel_tool_use=true` when tool\_choice type is `any` or `tool`, which ensures that Claude uses **exactly one** tool Worked example -------------------- **Simpler with Tool Runner**: The example below shows manual parallel tool handling. For most use cases, [Tool Runner](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-runner) automatically handles parallel tool execution with much less code. Here's a complete, runnable script to test and verify parallel tool calls are working correctly: Python # Define tools tools = [\ {\ "name": "get_weather",\ "description": "Get the current weather in a given location",\ "input_schema": {\ "type": "object",\ "properties": {\ "location": {\ "type": "string",\ "description": "The city and state, e.g. San Francisco, CA",\ }\ },\ "required": ["location"],\ },\ },\ {\ "name": "get_time",\ "description": "Get the current time in a given timezone",\ "input_schema": {\ "type": "object",\ "properties": {\ "timezone": {\ "type": "string",\ "description": "The timezone, e.g. America/New_York",\ }\ },\ "required": ["timezone"],\ },\ },\ ] # Test conversation with parallel tool calls messages = [\ {\ "role": "user",\ "content": "What's the weather in SF and NYC, and what time is it there?",\ }\ ] # Make initial request print("Requesting parallel tool calls...") response = client.messages.create( model="claude-opus-4-6", max_tokens=1024, messages=messages, tools=tools ) # Check for parallel tool calls tool_uses = [block for block in response.content if block.type == "tool_use"] print(f"\n✓ Claude made {len(tool_uses)} tool calls") if len(tool_uses) > 1: print("✓ Parallel tool calls detected!") for tool in tool_uses: print(f" - {tool.name}: {tool.input}") else: print("✗ No parallel tool calls detected") # Simulate tool execution and format results correctly tool_results = [] for tool_use in tool_uses: if tool_use.name == "get_weather": if "San Francisco" in str(tool_use.input): result = "San Francisco: 68°F, partly cloudy" else: result = "New York: 45°F, clear skies" else: # get_time if "Los_Angeles" in str(tool_use.input): result = "2:30 PM PST" else: result = "5:30 PM EST" tool_results.append( {"type": "tool_result", "tool_use_id": tool_use.id, "content": result} ) # Continue conversation with tool results messages.extend( [\ {"role": "assistant", "content": response.content},\ {"role": "user", "content": tool_results}, # All results in one message!\ ] ) # Get final response print("\nGetting final response...") final_response = client.messages.create( model="claude-opus-4-6", max_tokens=1024, messages=messages, tools=tools ) print(f"\nClaude's response:\n{final_response.content[0].text}") # Verify formatting print("\n--- Verification ---") print(f"✓ Tool results sent in single user message: {len(tool_results)} results") print("✓ No text before tool results in content array") print("✓ Conversation formatted correctly for future parallel tool use") This script demonstrates: * How to properly format parallel tool calls and results * How to verify that parallel calls are being made * The correct message structure that encourages future parallel tool use * Common mistakes to avoid (like text before tool results) Run this script to test your implementation and ensure Claude is making parallel tool calls effectively. Maximizing parallel tool use ---------------------------------- While Claude 4 models have excellent parallel tool use capabilities by default, you can increase the likelihood of parallel tool execution across all models with targeted prompting: ### System prompts for parallel tool use ### User message prompting Troubleshooting --------------------- If Claude isn't making parallel tool calls when expected, check these common issues: **1\. Incorrect tool result formatting** The most common issue is formatting tool results incorrectly in the conversation history. This "teaches" Claude to avoid parallel calls. Specifically for parallel tool use: * ❌ **Wrong**: Sending separate user messages for each tool result * ✅ **Correct**: All tool results must be in a single user message // ❌ This reduces parallel tool use [\ {"role": "assistant", "content": [tool_use_1, tool_use_2]},\ {"role": "user", "content": [tool_result_1]},\ {"role": "user", "content": [tool_result_2]} // Separate message\ ] // ✅ This maintains parallel tool use [\ {"role": "assistant", "content": [tool_use_1, tool_use_2]},\ {"role": "user", "content": [tool_result_1, tool_result_2]} // Single message\ ] See [Handle tool calls](https://platform.claude.com/docs/en/agents-and-tools/tool-use/handle-tool-calls) for other formatting rules. **2\. Weak prompting** Default prompting may not be sufficient. Use the stronger system prompt from the [Maximizing parallel tool use](https://platform.claude.com/docs/en/agents-and-tools/tool-use/parallel-tool-use#maximizing-parallel-tool-use) section above. **3\. Measuring parallel tool usage** To verify parallel tool calls are working: # Calculate average tools per tool-calling message tool_call_messages = [\ msg for msg in messages if any(block.type == "tool_use" for block in msg.content)\ ] total_tool_calls = sum( len([b for b in msg.content if b.type == "tool_use"]) for msg in tool_call_messages ) avg_tools_per_message = ( total_tool_calls / len(tool_call_messages) if tool_call_messages else 0.0 ) print(f"Average tools per message: {avg_tools_per_message}") # Should be > 1.0 if parallel calls are working Next steps ---------------- * For the single-tool-call flow and `tool_result` formatting rules, see [Handle tool calls](https://platform.claude.com/docs/en/agents-and-tools/tool-use/handle-tool-calls) . * For the SDK abstraction that handles parallel execution automatically, see [Tool Runner](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-runner) . * For the full tool-use workflow, see [Define tools](https://platform.claude.com/docs/en/agents-and-tools/tool-use/define-tools) . --- # Documentation - Claude API Docs Loading... Home Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Erstellen Sie mit Claude Erfahren Sie, wie Sie mit der Claude Platform und Claude Code beginnen. Fragen Sie Claude nach Dokumentation... ⌘K Claude Platform ------------------- [Erste Schritte\ \ Tätigen Sie Ihren ersten API-Aufruf in wenigen Minuten.](https://platform.claude.com/docs/de/get-started) [Funktionsübersicht\ \ Erkunden Sie die erweiterten Funktionen und Möglichkeiten, die jetzt in Claude verfügbar sind.](https://platform.claude.com/docs/de/build-with-claude/overview) [Neuerungen in Claude 4.6\ \ Entdecken Sie die neuesten Fortschritte in Claude 4.6 Modellen.](https://platform.claude.com/docs/de/about-claude/models/whats-new-claude-4-6) [API-Referenz\ \ Integrieren und skalieren Sie mit unserer API und SDKs.](https://platform.claude.com/docs/de/api/overview) [Claude Console\ \ Erstellen und testen Sie leistungsstarke Prompts direkt in Ihrem Browser.](https://platform.claude.com/) [Versionshinweise\ \ Erfahren Sie mehr über Änderungen und neue Funktionen in der Claude Platform.](https://platform.claude.com/docs/de/release-notes/api) Claude Code --------------- [Claude Code Schnellstart\ \ Erste Schritte mit Claude Code.](https://code.claude.com/docs/de/quickstart) [Claude Code Referenz\ \ Konsultieren Sie die Claude Code Referenzdokumentation für Details zur Funktionsimplementierung und Konfiguration.](https://code.claude.com/docs/de/overview) [Claude Code Changelog\ \ Erfahren Sie mehr über Änderungen und neue Funktionen in Claude Code.](https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md) Lernressourcen ------------------ [Anthropic Kurse\ \ Erkunden Sie Anthropics Bildungskurse und Projekte.](https://anthropic.skilljar.com/) [Claude Cookbook\ \ Sehen Sie replizierbare Codebeispiele und Implementierungen.](https://platform.claude.com/cookbooks) [Claude Quickstarts\ \ Bereitstellbare Anwendungen, die mit unserer API erstellt wurden.](https://github.com/anthropics/anthropic-quickstarts) --- # Textgenerierung - Claude API Docs Loading... Documentation Page Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Prompts werden am besten als natürlichsprachliche Abfragen geschrieben, als würde man jemanden anweisen, etwas zu tun, wobei je mehr Details desto besser ist. Sie können Ihren grundlegenden Prompt weiter verbessern mit [Prompt Engineering](https://platform.claude.com/docs/de/build-with-claude/prompt-engineering/overview) . * * * Textfähigkeiten und Anwendungsfälle ----------------------------------------- Claude verfügt über eine breite Palette textbasierter Fähigkeiten, einschließlich, aber nicht beschränkt auf: | Fähigkeit | Dies ermöglicht es Ihnen zu... | | --- | --- | | Textzusammenfassung | Umfangreiche Inhalte in wichtige Erkenntnisse für Führungskräfte, soziale Medien oder Produktteams destillieren. | | Inhaltserstellung | Überzeugende Inhalte von Blogbeiträgen und E-Mails bis hin zu Marketing-Slogans und Produktbeschreibungen erstellen. | | Daten-/Entitätsextraktion | Strukturierte Erkenntnisse aus unstrukturiertem Text wie Bewertungen, Nachrichtenartikeln oder Transkripten aufdecken. | | Beantwortung von Fragen | Intelligente, interaktive Systeme von Kundenservice-Chatbots bis zu pädagogischen KI-Tutoren erstellen. | | Textübersetzung | Nahtlose Kommunikation über Sprachen hinweg in Produkten, Support und Inhaltserstellung. | | Textanalyse und Empfehlungen | Verstehen Sie Stimmung, Vorlieben und Muster, um Benutzererfahrungen und Angebote zu personalisieren. | | Dialog und Konversation | Erstellen Sie ansprechende, kontextbewusste Interaktionen in Spielen, virtuellen Assistenten und Storytelling-Apps. | | Code-Erklärung und -Generierung | Beschleunigen Sie die Entwicklung mit sofortigen Code-Reviews, Boilerplate-Generierung und interaktiven Tutorials. | * * * Claude Cookbook --------------------- Tauchen Sie ein in praktische Beispiele und praktische Tutorials mit unserer Sammlung von Jupyter-Notebooks. [PDF-Upload und Zusammenfassung\ \ Erfahren Sie, wie Sie PDFs hochladen und Claude deren Inhalte zusammenfassen lassen, um lange Dokumente leicht zu verstehen.](https://platform.claude.com/cookbook/misc-pdf-upload-summarization) [Tool Use und Function Calling\ \ Entdecken Sie, wie Sie Claudes Fähigkeiten erweitern, indem Sie externe Tools und Funktionen in Ihre Workflows integrieren.](https://platform.claude.com/cookbook/tool-use-calculator-tool) [Embeddings mit VoyageAI\ \ Erkunden Sie, wie Sie Embeddings mit VoyageAI für fortgeschrittene Textähnlichkeits- und Suchaufgaben erstellen und verwenden.](https://platform.claude.com/cookbook/capabilities-contextual-embeddings-guide) Weitere Ressourcen ------------------------ Von der Erstellung des perfekten Prompts bis zum Verständnis von API-Details haben wir alles für Sie. [Prompt Engineering Guide\ \ Beherrschen Sie die Kunst der Prompt-Erstellung, um das Beste aus Claude herauszuholen.](https://platform.claude.com/docs/de/build-with-claude/prompt-engineering/overview) [API-Dokumentation\ \ Alles, was Sie benötigen, um mit Claude über unsere API zu interagieren: Anforderungsformate, Antwortbehandlung und Fehlerbehebung.](https://platform.claude.com/docs/de/api/overview) Was this page helpful? --- # API und Datenspeicherung - Claude API Docs Loading... Verwaltung und Überwachung Zero Data Retention Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Informationen zu Anthropics Standardspeicherrichtlinien sind in [Anthropics kommerzieller Datenspeicherungsrichtlinie](https://privacy.claude.com/en/articles/7996866-how-long-do-you-store-my-organization-s-data) und der [Verbraucherdatenspeicherungsrichtlinie](https://privacy.claude.com/en/articles/10023548-how-long-do-you-store-my-data) festgelegt. Wenn Benutzer API-Endpunkte mit Nulldatenspeicherung (ZDR) verwenden, werden über diese Endpunkte übermittelte Kundendaten nach der Rückgabe der API-Antwort nicht dauerhaft gespeichert, außer wenn dies zur Einhaltung von Gesetzen oder zur Bekämpfung von Missbrauch erforderlich ist. Vorbehaltlich dieser Ausnahmen werden Kundendaten bei der Verwendung von ZDR-fähigen Endpunkten in Echtzeit verarbeitet und umgehend verworfen, ohne Protokollierung oder nicht-ephemere Speicherung von Eingaben oder Ausgaben. Unser Ansatz zur Datenspeicherung --------------------------------------- Verschiedene APIs und Funktionen haben unterschiedliche Speicher- und Aufbewahrungsanforderungen. Wenn eine API oder Funktion keine Speicherung von Kundeneingaben oder -antworten erfordert, kann sie für ZDR in Frage kommen. Wenn eine API oder Funktion notwendigerweise eine Speicherung von Kundeneingaben oder -antworten erfordert, ist Anthropic auf den kleinstmöglichen Speicherbedarf ausgelegt. Für diese Funktionen gilt: * Gespeicherte Daten werden ohne Ihre ausdrückliche Genehmigung niemals für das Modelltraining verwendet. * Es wird nur das technisch Notwendige für die Funktion der API und des Features gespeichert. Gesprächsinhalte (Ihre Eingaben und Claudes Ausgaben) werden niemals gespeichert, sofern nicht ausdrücklich angegeben. * Daten werden mit der kürzest möglichen TTL gelöscht, und Anthropic ist bestrebt, Kunden die Kontrolle darüber zu geben, wie lange Daten gespeichert werden. Was gespeichert wird und die Aufbewahrungsdauer, sofern eine bestimmte TTL gilt, ist auf der Seite jeder Funktion dokumentiert. In der [ZDR-Berechtigungstabelle](https://platform.claude.com/docs/de/build-with-claude/api-and-data-retention#zdr-eligibility-by-feature) sind einige Funktionen in der Spalte „ZDR-berechtigt" mit „Ja (qualifiziert)" gekennzeichnet. Wenn Ihre Organisation eine ZDR-Vereinbarung hat, können Sie diese Funktionen mit der Gewissheit nutzen, dass das, was Anthropic speichert, minimal ist und für eine optimale Leistung erforderlich ist. Umfang der Nulldatenspeicherung (ZDR) ------------------------------------------- **Was ZDR abdeckt** * **Bestimmte Claude-APIs:** ZDR gilt für die Claude Messages- und Token-Counting-APIs * **Claude Code:** ZDR gilt bei Verwendung mit kommerziellen Organisations-API-Schlüsseln oder über Claude Enterprise (siehe [Claude Code ZDR-Dokumentation](https://code.claude.com/docs/en/zero-data-retention) ) **Was ZDR NICHT abdeckt** * **Console und Workbench:** Jede Nutzung auf Console oder Workbench * **Claude-Verbraucherprodukte:** Claude Free-, Pro- oder Max-Pläne, einschließlich wenn Kunden mit diesen Plänen Claudes Web-, Desktop- oder mobile Apps oder Claude Code verwenden * **Claude Teams und Claude Enterprise:** Claude Teams- und Claude Enterprise-Produktoberflächen sind **nicht ZDR-berechtigt**, außer für Claude Code bei Verwendung über Claude Enterprise mit für die Organisation aktiviertem ZDR. Für andere Produktoberflächen sind nur kommerzielle Organisations-API-Schlüssel für ZDR berechtigt. * **Drittanbieter-Integrationen:** Daten, die von Drittanbieter-Websites, -Tools oder anderen Integrationen verarbeitet werden, sind **nicht ZDR-berechtigt**, obwohl einige möglicherweise ähnliche Angebote haben. Wenn Sie externe Dienste in Verbindung mit der Claude-API verwenden, stellen Sie sicher, dass Sie die Datenverwaltungspraktiken dieser Dienste überprüfen. Für die aktuellsten Informationen darüber, welche Produkte und Funktionen ZDR-berechtigt sind, lesen Sie Ihre Vertragsbedingungen oder wenden Sie sich an Ihren Anthropic-Kundenbetreuer. ZDR-Berechtigung nach Funktion ------------------------------------ | Funktion | Endpunkt | ZDR-berechtigt | Details zur Datenspeicherung | | --- | --- | --- | --- | | [Messages API](https://platform.claude.com/docs/de/build-with-claude/working-with-messages) | `/v1/messages` | Ja | Standard-API-Aufrufe zur Generierung von Claude-Antworten. | | [Token-Zählung](https://platform.claude.com/docs/de/build-with-claude/token-counting) | `/v1/messages/count_tokens` | Ja | Token vor dem Senden von Anfragen zählen. | | [Websuche](https://platform.claude.com/docs/de/agents-and-tools/tool-use/web-search-tool) | `/v1/messages` (mit `web_search`\-Tool) | Ja1 | Echtzeit-Websuchergebnisse, die in der API-Antwort zurückgegeben werden. | | [Web-Abruf](https://platform.claude.com/docs/de/agents-and-tools/tool-use/web-fetch-tool) | `/v1/messages` (mit `web_fetch`\-Tool) | Ja1 2 | Abgerufene Webinhalte, die in der API-Antwort zurückgegeben werden. | | [Memory-Tool](https://platform.claude.com/docs/de/agents-and-tools/tool-use/memory-tool) | `/v1/messages` (mit `memory`\-Tool) | Ja | Clientseitige Speicherung, bei der Sie die Datenspeicherung kontrollieren. | | [Kontextverwaltung (Komprimierung)](https://platform.claude.com/docs/de/build-with-claude/compaction) | `/v1/messages` (mit `context_management`) | Ja | Serverseitige Komprimierungsergebnisse werden zustandslos über die API-Antwort zurückgegeben/weitergeleitet. | | [Kontextbearbeitung](https://platform.claude.com/docs/de/build-with-claude/context-editing) | `/v1/messages` (mit `context_management`) | Ja | Kontextbearbeitungen (Tool-Use-Clearing + Thinking-Clearing) werden in Echtzeit angewendet. | | [Schnellmodus](https://platform.claude.com/docs/de/build-with-claude/fast-mode) | `/v1/messages` (mit `speed: "fast"`) | Ja | Gleicher Messages-API-Endpunkt mit schnellerer Inferenz. ZDR gilt unabhängig von der Geschwindigkeitseinstellung. | | [1M-Token-Kontextfenster](https://platform.claude.com/docs/de/build-with-claude/context-windows) | `/v1/messages` | Ja | Die erweiterte Kontextverarbeitung verwendet die Standard-Messages-API. | | [Adaptives Denken](https://platform.claude.com/docs/de/build-with-claude/adaptive-thinking) | `/v1/messages` | Ja | Dynamische Denktiefe verwendet die Standard-Messages-API. | | [Zitierungen](https://platform.claude.com/docs/de/build-with-claude/citations) | `/v1/messages` | Ja | Quellenzuordnung verwendet die Standard-Messages-API. | | [Datenresidenz](https://platform.claude.com/docs/de/build-with-claude/data-residency) | `/v1/messages` (mit `inference_geo`) | Ja | Geografisches Routing verwendet die Standard-Messages-API. | | [Aufwand](https://platform.claude.com/docs/de/build-with-claude/effort) | `/v1/messages` (mit `effort`) | Ja | Token-Effizienzsteuerung verwendet die Standard-Messages-API. | | [Erweitertes Denken](https://platform.claude.com/docs/de/build-with-claude/extended-thinking) | `/v1/messages` (mit `thinking`) | Ja | Schrittweises Denken verwendet die Standard-Messages-API. | | [PDF-Unterstützung](https://platform.claude.com/docs/de/build-with-claude/pdf-support) | `/v1/messages` | Ja | PDF-Dokumentenverarbeitung verwendet die Standard-Messages-API. | | [Suchergebnisse](https://platform.claude.com/docs/de/build-with-claude/search-results) | `/v1/messages` (mit `search_results`\-Quelle) | Ja | RAG-Zitierungsunterstützung verwendet die Standard-Messages-API. | | [Bash-Tool](https://platform.claude.com/docs/de/agents-and-tools/tool-use/bash-tool) | `/v1/messages` (mit `bash`\-Tool) | Ja | Clientseitiges Tool, das in Ihrer Umgebung ausgeführt wird. | | [Texteditor-Tool](https://platform.claude.com/docs/de/agents-and-tools/tool-use/text-editor-tool) | `/v1/messages` (mit `text_editor`\-Tool) | Ja | Clientseitiges Tool, das in Ihrer Umgebung ausgeführt wird. | | [Computer-Nutzung](https://platform.claude.com/docs/de/agents-and-tools/tool-use/computer-use-tool) | `/v1/messages` (mit `computer`\-Tool) | Ja | Clientseitiges Tool, bei dem Screenshots und Dateien in Ihrer Umgebung erfasst und gespeichert werden, nicht von Anthropic. Siehe [Computer-Nutzung](https://platform.claude.com/docs/de/agents-and-tools/tool-use/computer-use-tool#data-retention)
. | | [Feinkörniges Tool-Streaming](https://platform.claude.com/docs/de/agents-and-tools/tool-use/fine-grained-tool-streaming) | `/v1/messages` | Ja | Streaming-Tool-Parameter verwenden die Standard-Messages-API. | | [Prompt-Caching](https://platform.claude.com/docs/de/build-with-claude/prompt-caching) | `/v1/messages` | Ja | Ihre Eingaben und Claudes Ausgaben werden nicht gespeichert. KV-Cache-Darstellungen und kryptografische Hashes werden für die Cache-TTL im Speicher gehalten und nach Ablauf umgehend gelöscht. Siehe [Prompt-Caching](https://platform.claude.com/docs/de/build-with-claude/prompt-caching#data-retention)
. | | [Strukturierte Ausgaben](https://platform.claude.com/docs/de/build-with-claude/structured-outputs) | `/v1/messages` | Ja (qualifiziert) | Ihre Eingaben und Claudes Ausgaben werden nicht gespeichert. Nur das JSON-Schema wird bis zu 24 Stunden nach der letzten Verwendung zwischengespeichert. Siehe [Strukturierte Ausgaben](https://platform.claude.com/docs/de/build-with-claude/structured-outputs#data-retention)
. | | [Tool-Suche](https://platform.claude.com/docs/de/agents-and-tools/tool-use/tool-search-tool) | `/v1/messages` (mit `tool_search`\-Tool) | Ja (qualifiziert) | Nur Tool-Katalogdaten (Namen, Beschreibungen, Argumentmetadaten) werden serverseitig gespeichert. Siehe [Tool-Suche](https://platform.claude.com/docs/de/agents-and-tools/tool-use/tool-search-tool#data-retention)
. | | [Stapelverarbeitung](https://platform.claude.com/docs/de/build-with-claude/batch-processing) | `/v1/messages/batches` | Nein | 29-tägige Aufbewahrung; asynchrone Speicherung erforderlich. Siehe [Stapelverarbeitung](https://platform.claude.com/docs/de/build-with-claude/batch-processing#data-retention)
. | | [Code-Ausführung](https://platform.claude.com/docs/de/agents-and-tools/tool-use/code-execution-tool) | `/v1/messages` (mit `code_execution`\-Tool) | Nein | Container-Daten werden bis zu 30 Tage aufbewahrt. Siehe [Code-Ausführung](https://platform.claude.com/docs/de/agents-and-tools/tool-use/code-execution-tool#data-retention)
. | | [Programmatischer Tool-Aufruf](https://platform.claude.com/docs/de/agents-and-tools/tool-use/programmatic-tool-calling) | `/v1/messages` (mit `code_execution`\-Tool) | Nein | Basiert auf Code-Ausführungs-Containern; Daten werden bis zu 30 Tage aufbewahrt. Siehe [Programmatischer Tool-Aufruf](https://platform.claude.com/docs/de/agents-and-tools/tool-use/programmatic-tool-calling#data-retention)
. | | [Files API](https://platform.claude.com/docs/de/build-with-claude/files) | `/v1/files` | Nein | Dateien werden bis zur expliziten Löschung aufbewahrt. Siehe [Files API](https://platform.claude.com/docs/de/build-with-claude/files#data-retention)
. | | [Agent-Fähigkeiten](https://platform.claude.com/docs/de/agents-and-tools/agent-skills/overview) | `/v1/messages` (mit `skills`) / `/v1/skills` | Nein | Fähigkeitsdaten werden gemäß Standardrichtlinie aufbewahrt. Siehe [Agent-Fähigkeiten](https://platform.claude.com/docs/de/agents-and-tools/agent-skills/overview#data-retention)
. | | [MCP-Connector](https://platform.claude.com/docs/de/agents-and-tools/mcp-connector) | `/v1/messages` (mit `mcp_servers`) | Nein | Daten werden gemäß Standardrichtlinie aufbewahrt. Siehe [MCP-Connector](https://platform.claude.com/docs/de/agents-and-tools/mcp-connector#data-retention)
. | 1 [Dynamische Filterung](https://platform.claude.com/docs/de/agents-and-tools/tool-use/web-search-tool#dynamic-filtering-with-opus-4-6-and-sonnet-4-6) ist nicht ZDR-berechtigt. 2 Obwohl der Web-Abruf ZDR-berechtigt ist, können Website-Betreiber Anfragedaten (wie abgerufene URLs und Anfragemetadaten) gemäß ihren eigenen Richtlinien speichern. Einschränkungen und Ausschlüsse ------------------------------------- ### CORS wird nicht unterstützt **Cross-Origin Resource Sharing (CORS)** wird für Organisationen mit ZDR-Vereinbarungen nicht unterstützt. Wenn Sie API-Aufrufe aus browserbasierten Anwendungen durchführen müssen, müssen Sie: * Einen Backend-Proxy-Server verwenden, um API-Aufrufe im Namen Ihres Frontends durchzuführen * Ihre eigene CORS-Verarbeitung auf dem Proxy-Server implementieren * API-Schlüssel niemals direkt in Browser-JavaScript offenlegen ### Datenspeicherung bei Richtlinienverstößen und gesetzlichen Anforderungen Selbst bei bestehenden ZDR-Vereinbarungen kann Anthropic Daten speichern, wenn dies gesetzlich vorgeschrieben ist oder zur Bekämpfung von Verstößen gegen die Nutzungsrichtlinien und böswilliger Nutzung der Anthropic-Plattform erforderlich ist. Wenn ein Chat oder eine Sitzung wegen eines solchen Verstoßes markiert wird, kann Anthropic Eingaben und Ausgaben bis zu 2 Jahre lang aufbewahren. Häufig gestellte Fragen ----------------------------- ### Woher weiß ich, ob meine Organisation ZDR-Vereinbarungen hat? ### Kann ich ZDR-berechtigte (qualifizierte) Funktionen im Rahmen meiner ZDR-Vereinbarung nutzen? ### Was passiert, wenn ich eine mit „Nein" markierte Funktion verwende? ### Kann ich die Löschung von Daten aus Funktionen beantragen, die nicht ZDR-berechtigt sind? ### Gilt dies für Claude auf AWS Bedrock oder Vertex AI? ### Ist Claude Code für ZDR berechtigt? ### Unterstützt Claude für Excel ZDR? ### Wie beantrage ich ZDR? Verwandte Ressourcen -------------------------- * [Datenschutzrichtlinie](https://www.anthropic.com/legal/privacy) * [Stapelverarbeitung](https://platform.claude.com/docs/de/build-with-claude/batch-processing) * [Files API](https://platform.claude.com/docs/de/api/files-create) * [Agent SDK Sessions](https://platform.claude.com/docs/de/agent-sdk/sessions) * [Prompt-Caching](https://platform.claude.com/docs/de/build-with-claude/prompt-caching) Was this page helpful? --- # Usage and Cost API - Claude API Docs Loading... Verwaltung und Überwachung Usage and Cost API Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Was this page helpful? **The Admin API is unavailable for individual accounts.** To collaborate with teammates and add members, set up your organization in **Console → Settings → Organization**. Die Usage & Cost Admin API bietet programmatischen und granularen Zugriff auf historische API-Nutzungs- und Kostendaten für Ihre Organisation. Diese Daten ähneln den Informationen, die auf den Seiten [Usage](https://platform.claude.com/usage) und [Cost](https://platform.claude.com/cost) der Claude Console verfügbar sind. Diese API ermöglicht es Ihnen, Ihre Claude-Implementierungen besser zu überwachen, zu analysieren und zu optimieren: * **Genaue Nutzungsverfolgung:** Erhalten Sie präzise Token-Zählungen und Nutzungsmuster, anstatt sich nur auf die Zählung von Response-Tokens zu verlassen * **Kostenabstimmung:** Gleichen Sie interne Aufzeichnungen mit der Anthropic-Abrechnung für Finanz- und Buchhaltungsteams ab * **Produktleistung und Verbesserung:** Überwachen Sie die Produktleistung und messen Sie, ob Änderungen am System sie verbessert haben, oder richten Sie Benachrichtigungen ein * **[Rate Limit](https://platform.claude.com/docs/de/api/rate-limits) und [Priority Tier](https://platform.claude.com/docs/de/api/service-tiers#get-started-with-priority-tier) Optimierung:** Optimieren Sie Funktionen wie [Prompt Caching](https://platform.claude.com/docs/de/build-with-claude/prompt-caching) oder spezifische Prompts, um das Beste aus Ihrer zugewiesenen Kapazität herauszuholen, oder kaufen Sie dedizierte Kapazität. * **Erweiterte Analyse:** Führen Sie tiefere Datenanalysen durch als in der Console verfügbar **Admin API-Schlüssel erforderlich** Diese API ist Teil der [Admin API](https://platform.claude.com/docs/de/build-with-claude/administration-api) . Diese Endpunkte erfordern einen Admin API-Schlüssel (beginnend mit `sk-ant-admin...`), der sich von Standard-API-Schlüsseln unterscheidet. Nur Organisationsmitglieder mit der Admin-Rolle können Admin API-Schlüssel über die [Claude Console](https://platform.claude.com/settings/admin-keys) bereitstellen. Partner-Lösungen ---------------------- Führende Observability-Plattformen bieten einsatzbereite Integrationen zur Überwachung Ihrer Claude API-Nutzung und Kosten, ohne benutzerdefinierten Code zu schreiben. Diese Integrationen bieten Dashboards, Benachrichtigungen und Analysen, um Ihre API-Nutzung effektiv zu verwalten. [CloudZero\ \ Cloud-Intelligenzplattform zur Verfolgung und Prognose von Kosten](https://docs.cloudzero.com/docs/connections-anthropic) [](https://docs.datadoghq.com/integrations/anthropic/) Schnellstart ------------------ Rufen Sie die tägliche Nutzung Ihrer Organisation für die letzten 7 Tage ab: curl "https://api.anthropic.com/v1/organizations/usage_report/messages?\ starting_at=2025-01-08T00:00:00Z&\ ending_at=2025-01-15T00:00:00Z&\ bucket_width=1d" \ --header "anthropic-version: 2023-06-01" \ --header "x-api-key: $ADMIN_API_KEY" **Setzen Sie einen User-Agent-Header für Integrationen** Wenn Sie eine Integration erstellen, setzen Sie Ihren User-Agent-Header, um uns zu helfen, Nutzungsmuster zu verstehen: User-Agent: YourApp/1.0.0 (https://yourapp.com) Usage API --------------- Verfolgen Sie den Token-Verbrauch in Ihrer Organisation mit detaillierten Aufschlüsselungen nach Modell, Workspace und Service Tier mit dem Endpunkt `/v1/organizations/usage_report/messages`. ### Wichtige Konzepte * **Zeitbuckets**: Aggregieren Sie Nutzungsdaten in festen Intervallen (`1m`, `1h` oder `1d`) * **Token-Verfolgung**: Messen Sie unkachedierte Eingabe, gecachte Eingabe, Cache-Erstellung und Output-Tokens * **Filterung & Gruppierung**: Filtern Sie nach API-Schlüssel, Workspace, Modell, Service Tier, Kontextfenster oder [Datenspeicherort](https://platform.claude.com/docs/de/build-with-claude/data-residency) , und gruppieren Sie Ergebnisse nach diesen Dimensionen * **Server-Tool-Nutzung**: Verfolgen Sie die Nutzung von serverseitigen Tools wie Web-Suche Für vollständige Parameterdetails und Response-Schemas siehe die [Usage API-Referenz](https://platform.claude.com/docs/de/api/admin-api/usage-cost/get-messages-usage-report) . ### Grundlegende Beispiele #### Tägliche Nutzung nach Modell curl "https://api.anthropic.com/v1/organizations/usage_report/messages?\ starting_at=2025-01-01T00:00:00Z&\ ending_at=2025-01-08T00:00:00Z&\ group_by[]=model&\ bucket_width=1d" \ --header "anthropic-version: 2023-06-01" \ --header "x-api-key: $ADMIN_API_KEY" #### Stündliche Nutzung mit Filterung curl "https://api.anthropic.com/v1/organizations/usage_report/messages?\ starting_at=2025-01-15T00:00:00Z&\ ending_at=2025-01-15T23:59:59Z&\ models[]=claude-opus-4-6&\ service_tiers[]=batch&\ context_window[]=0-200k&\ bucket_width=1h" \ --header "anthropic-version: 2023-06-01" \ --header "x-api-key: $ADMIN_API_KEY" #### Nutzung nach API-Schlüsseln und Workspaces filtern curl "https://api.anthropic.com/v1/organizations/usage_report/messages?\ starting_at=2025-01-01T00:00:00Z&\ ending_at=2025-01-08T00:00:00Z&\ api_key_ids[]=apikey_01Rj2N8SVvo6BePZj99NhmiT&\ api_key_ids[]=apikey_01ABC123DEF456GHI789JKL&\ workspace_ids[]=wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ&\ workspace_ids[]=wrkspc_01XYZ789ABC123DEF456MNO&\ bucket_width=1d" \ --header "anthropic-version: 2023-06-01" \ --header "x-api-key: $ADMIN_API_KEY" Um die API-Schlüssel-IDs Ihrer Organisation abzurufen, verwenden Sie den Endpunkt [List API Keys](https://platform.claude.com/docs/de/api/admin-api/apikeys/list-api-keys) . Um die Workspace-IDs Ihrer Organisation abzurufen, verwenden Sie den Endpunkt [List Workspaces](https://platform.claude.com/docs/de/api/admin-api/workspaces/list-workspaces) , oder finden Sie die Workspace-IDs Ihrer Organisation in der Anthropic Console. #### Datenspeicherort Verfolgen Sie Ihre [Datenspeicherort-Kontrollen](https://platform.claude.com/docs/de/build-with-claude/data-residency) , indem Sie die Nutzung mit der Dimension `inference_geo` gruppieren und filtern. Dies ist nützlich, um die geografische Weiterleitung in Ihrer Organisation zu überprüfen. curl "https://api.anthropic.com/v1/organizations/usage_report/messages?\ starting_at=2026-02-01T00:00:00Z&\ ending_at=2026-02-08T00:00:00Z&\ group_by[]=inference_geo&\ group_by[]=model&\ bucket_width=1d" \ --header "anthropic-version: 2023-06-01" \ --header "x-api-key: $ADMIN_API_KEY" Sie können auch auf ein bestimmtes Geo filtern. Gültige Werte sind `global`, `us` und `not_available`: curl "https://api.anthropic.com/v1/organizations/usage_report/messages?\ starting_at=2026-02-01T00:00:00Z&\ ending_at=2026-02-08T00:00:00Z&\ inference_geos[]=us&\ group_by[]=model&\ bucket_width=1d" \ --header "anthropic-version: 2023-06-01" \ --header "x-api-key: $ADMIN_API_KEY" Modelle, die vor Februar 2026 veröffentlicht wurden (vor Claude Opus 4.6), unterstützen den Request-Parameter `inference_geo` nicht, daher geben ihre Nutzungsberichte `"not_available"` für diese Dimension zurück. Sie können `not_available` als Filterwert in `inference_geos[]` verwenden, um diese Modelle anzusteuern. ### Zeitgranularitätsgrenzen | Granularität | Standardlimit | Maximales Limit | Anwendungsfall | | --- | --- | --- | --- | | `1m` | 60 Buckets | 1440 Buckets | Echtzeit-Überwachung | | `1h` | 24 Buckets | 168 Buckets | Tägliche Muster | | `1d` | 7 Buckets | 31 Buckets | Wöchentliche/monatliche Berichte | Cost API -------------- Rufen Sie Service-Level-Kostenaufschlüsselungen in USD mit dem Endpunkt `/v1/organizations/cost_report` ab. ### Wichtige Konzepte * **Währung**: Alle Kosten in USD, angegeben als Dezimalzeichenketten in kleinsten Einheiten (Cent) * **Kostentypen**: Verfolgen Sie Token-Nutzung, Web-Suche und Code-Ausführungskosten * **Gruppierung**: Gruppieren Sie Kosten nach Workspace oder Beschreibung für detaillierte Aufschlüsselungen. Bei Gruppierung nach `description` enthalten Responses analysierte Felder wie `model` und `inference_geo` * **Zeitbuckets**: Nur tägliche Granularität (`1d`) Für vollständige Parameterdetails und Response-Schemas siehe die [Cost API-Referenz](https://platform.claude.com/docs/de/api/admin-api/usage-cost/get-cost-report) . Priority Tier-Kosten verwenden ein anderes Abrechnungsmodell und sind nicht im Cost-Endpunkt enthalten. Verfolgen Sie die Priority Tier-Nutzung stattdessen über den Usage-Endpunkt. ### Grundlegendes Beispiel curl "https://api.anthropic.com/v1/organizations/cost_report?\ starting_at=2025-01-01T00:00:00Z&\ ending_at=2025-01-31T00:00:00Z&\ group_by[]=workspace_id&\ group_by[]=description" \ --header "anthropic-version: 2023-06-01" \ --header "x-api-key: $ADMIN_API_KEY" Pagination ---------------- Beide Endpunkte unterstützen Pagination für große Datensätze: 1. Stellen Sie Ihre erste Anfrage 2. Wenn `has_more` `true` ist, verwenden Sie den Wert `next_page` in Ihrer nächsten Anfrage 3. Fahren Sie fort, bis `has_more` `false` ist # Erste Anfrage curl "https://api.anthropic.com/v1/organizations/usage_report/messages?\ starting_at=2025-01-01T00:00:00Z&\ ending_at=2025-01-31T00:00:00Z&\ limit=7" \ --header "anthropic-version: 2023-06-01" \ --header "x-api-key: $ADMIN_API_KEY" # Response enthält: "has_more": true, "next_page": "page_xyz..." # Nächste Anfrage mit Pagination curl "https://api.anthropic.com/v1/organizations/usage_report/messages?\ starting_at=2025-01-01T00:00:00Z&\ ending_at=2025-01-31T00:00:00Z&\ limit=7&\ page=page_xyz..." \ --header "anthropic-version: 2023-06-01" \ --header "x-api-key: $ADMIN_API_KEY" Häufige Anwendungsfälle ----------------------------- Erkunden Sie detaillierte Implementierungen im [Claude Cookbook](https://platform.claude.com/cookbooks) : * **Tägliche Nutzungsberichte**: Verfolgen Sie Token-Verbrauchstrends * **Kostenzuordnung**: Ordnen Sie Ausgaben nach Workspace für Rückbelastungen zu * **Cache-Effizienz**: Messen und optimieren Sie Prompt Caching * **Budget-Überwachung**: Richten Sie Benachrichtigungen für Ausgabenschwellen ein * **CSV-Export**: Generieren Sie Berichte für Finanzbuchhaltungsteams Häufig gestellte Fragen ----------------------------- ### Wie aktuell sind die Daten? Nutzungs- und Kostendaten erscheinen normalerweise innerhalb von 5 Minuten nach Abschluss der API-Anfrage, obwohl Verzögerungen gelegentlich länger sein können. ### Wie oft sollte ich abfragen? Die API unterstützt Abfragen einmal pro Minute für kontinuierliche Nutzung. Für kurze Bursts (z. B. das Herunterladen paginierter Daten) ist häufigeres Abfragen akzeptabel. Cachen Sie Ergebnisse für Dashboards, die häufige Updates benötigen. ### Wie verfolge ich die Code-Ausführungsnutzung? Code-Ausführungskosten erscheinen im Cost-Endpunkt, gruppiert unter `Code Execution Usage` im Beschreibungsfeld. Code-Ausführung ist nicht im Usage-Endpunkt enthalten. ### Wie verfolge ich die Priority Tier-Nutzung? Filtern oder gruppieren Sie nach `service_tier` im Usage-Endpunkt und suchen Sie nach dem Wert `priority`. Priority Tier-Kosten sind nicht im Cost-Endpunkt verfügbar. ### Was passiert mit der Workbench-Nutzung? API-Nutzung aus der Workbench ist nicht mit einem API-Schlüssel verknüpft, daher ist `api_key_id` `null`, auch wenn Sie nach dieser Dimension gruppieren. ### Wie wird der Standard-Workspace dargestellt? Nutzung und Kosten, die dem Standard-Workspace zugeordnet sind, haben einen `null`\-Wert für `workspace_id`. ### Wie erhalte ich Kostenaufschlüsselungen pro Benutzer für Claude Code? Verwenden Sie die [Claude Code Analytics API](https://platform.claude.com/docs/de/build-with-claude/claude-code-analytics-api) , die geschätzte Kosten pro Benutzer und Produktivitätsmetriken ohne die Leistungsbeschränkungen der Kostenaufschlüsselung nach vielen API-Schlüsseln bietet. Für allgemeine API-Nutzung mit vielen Schlüsseln verwenden Sie die [Usage API](https://platform.claude.com/docs/de/build-with-claude/usage-cost-api#usage-api) , um Token-Verbrauch als Kosten-Proxy zu verfolgen. Siehe auch ---------------- Die Usage und Cost APIs können verwendet werden, um eine bessere Erfahrung für Ihre Benutzer zu bieten, Ihnen bei der Verwaltung von Kosten zu helfen und Ihr Rate Limit zu bewahren. Erfahren Sie mehr über einige dieser anderen Funktionen: * [Admin API-Übersicht](https://platform.claude.com/docs/de/build-with-claude/administration-api) * [Admin API-Referenz](https://platform.claude.com/docs/de/api/admin) * [Preisgestaltung](https://platform.claude.com/docs/de/about-claude/pricing) * [Prompt Caching](https://platform.claude.com/docs/de/build-with-claude/prompt-caching) - Optimieren Sie Kosten mit Caching * [Batch-Verarbeitung](https://platform.claude.com/docs/de/build-with-claude/batch-processing) - 50% Rabatt auf Batch-Anfragen * [Rate Limits](https://platform.claude.com/docs/de/api/rate-limits) - Verstehen Sie Nutzungsstufen * [Datenspeicherort](https://platform.claude.com/docs/de/build-with-claude/data-residency) - Kontrollieren Sie die Inferenz-Geografie Datadog LLM-Observability mit automatischer Verfolgung und Überwachung [Grafana Cloud\ \ Agentlose Integration für einfache LLM-Observability mit vorkonfigurierten Dashboards und Benachrichtigungen](https://grafana.com/docs/grafana-cloud/monitor-infrastructure/integrations/integration-reference/integration-anthropic/) [Honeycomb\ \ Erweiterte Abfragen und Visualisierung durch OpenTelemetry](https://docs.honeycomb.io/integrations/anthropic-usage-monitoring/) [Vantage\ \ FinOps-Plattform für LLM-Kosten- und Nutzungsobservability](https://docs.vantage.sh/connecting_anthropic) --- # Claude Code Analytics API - Claude API Docs Loading... Verwaltung und Überwachung Claude Code Analytics API Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Was this page helpful? **The Admin API is unavailable for individual accounts.** To collaborate with teammates and add members, set up your organization in **Console → Settings → Organization**. Die Claude Code Analytics Admin API bietet programmgesteuerten Zugriff auf täglich aggregierte Nutzungsmetriken für Claude Code-Benutzer und ermöglicht es Organisationen, die Entwicklerproduktivität zu analysieren und benutzerdefinierte Dashboards zu erstellen. Diese API überbrückt die Lücke zwischen unserem grundlegenden [Analytics-Dashboard](https://platform.claude.com/claude-code) und der komplexen OpenTelemetry-Integration. Diese API ermöglicht es Ihnen, Ihre Claude Code-Einführung besser zu überwachen, zu analysieren und zu optimieren: * **Analyse der Entwicklerproduktivität:** Verfolgen Sie Sitzungen, hinzugefügte/entfernte Codezeilen, Commits und Pull Requests, die mit Claude Code erstellt wurden * **Tool-Nutzungsmetriken:** Überwachen Sie Akzeptanz- und Ablehnungsraten für verschiedene Claude Code-Tools (Edit, Write, NotebookEdit) * **Kostenanalyse:** Zeigen Sie geschätzte Kosten und Token-Nutzung aufgeschlüsselt nach Claude-Modell an * **Benutzerdefinierte Berichte:** Exportieren Sie Daten, um Executive Dashboards und Berichte für Managementteams zu erstellen * **Nutzungsbegründung:** Stellen Sie Metriken bereit, um die Claude Code-Einführung intern zu rechtfertigen und zu erweitern **Admin API-Schlüssel erforderlich** Diese API ist Teil der [Admin API](https://platform.claude.com/docs/de/build-with-claude/administration-api) . Diese Endpunkte erfordern einen Admin API-Schlüssel (beginnend mit `sk-ant-admin...`), der sich von Standard-API-Schlüsseln unterscheidet. Nur Organisationsmitglieder mit der Admin-Rolle können Admin API-Schlüssel über die [Claude Console](https://platform.claude.com/settings/admin-keys) bereitstellen. Schnellstart ------------------ Rufen Sie die Claude Code-Analysen Ihrer Organisation für einen bestimmten Tag ab: curl "https://api.anthropic.com/v1/organizations/usage_report/claude_code?\ starting_at=2025-09-08&\ limit=20" \ --header "anthropic-version: 2023-06-01" \ --header "x-api-key: $ADMIN_API_KEY" **Setzen Sie einen User-Agent-Header für Integrationen** Wenn Sie eine Integration erstellen, setzen Sie Ihren User-Agent-Header, um uns zu helfen, Nutzungsmuster zu verstehen: User-Agent: YourApp/1.0.0 (https://yourapp.com) Claude Code Analytics API ------------------------------- Verfolgen Sie die Claude Code-Nutzung, Produktivitätsmetriken und Entwickleraktivitäten in Ihrer Organisation mit dem Endpunkt `/v1/organizations/usage_report/claude_code`. ### Wichtige Konzepte * **Tägliche Aggregation**: Gibt Metriken für einen einzelnen Tag zurück, der durch den Parameter `starting_at` angegeben wird * **Daten auf Benutzerebene**: Jeder Datensatz stellt die Aktivität eines Benutzers für den angegebenen Tag dar * **Produktivitätsmetriken**: Verfolgen Sie Sitzungen, Codezeilen, Commits, Pull Requests und Tool-Nutzung * **Token- und Kostendaten**: Überwachen Sie die Nutzung und geschätzten Kosten aufgeschlüsselt nach Claude-Modell * **Cursor-basierte Paginierung**: Verwalten Sie große Datenmengen mit stabiler Paginierung mithilfe undurchsichtiger Cursor * **Datenfrisc**: Metriken sind mit bis zu 1 Stunde Verzögerung für Konsistenz verfügbar Für vollständige Parameterdetails und Response-Schemas siehe die [Claude Code Analytics API-Referenz](https://platform.claude.com/docs/de/api/admin-api/claude-code/get-claude-code-usage-report) . ### Grundlegende Beispiele #### Analysen für einen bestimmten Tag abrufen curl "https://api.anthropic.com/v1/organizations/usage_report/claude_code?\ starting_at=2025-09-08" \ --header "anthropic-version: 2023-06-01" \ --header "x-api-key: $ADMIN_API_KEY" #### Analysen mit Paginierung abrufen # Erste Anfrage curl "https://api.anthropic.com/v1/organizations/usage_report/claude_code?\ starting_at=2025-09-08&\ limit=20" \ --header "anthropic-version: 2023-06-01" \ --header "x-api-key: $ADMIN_API_KEY" # Nachfolgende Anfrage mit Cursor aus der Antwort curl "https://api.anthropic.com/v1/organizations/usage_report/claude_code?\ starting_at=2025-09-08&\ page=page_MjAyNS0wNS0xNFQwMDowMDowMFo=" \ --header "anthropic-version: 2023-06-01" \ --header "x-api-key: $ADMIN_API_KEY" ### Anfrageparameter | Parameter | Typ | Erforderlich | Beschreibung | | --- | --- | --- | --- | | `starting_at` | string | Ja | UTC-Datum im Format YYYY-MM-DD. Gibt Metriken nur für diesen einzelnen Tag zurück | | `limit` | integer | Nein | Anzahl der Datensätze pro Seite (Standard: 20, Maximum: 1000) | | `page` | string | Nein | Undurchsichtiges Cursor-Token aus dem Feld `next_page` der vorherigen Antwort | ### Verfügbare Metriken Jeder Response-Datensatz enthält die folgenden Metriken für einen einzelnen Benutzer an einem einzelnen Tag: #### Dimensionen * **date**: Datum im RFC 3339-Format (UTC-Zeitstempel) * **actor**: Der Benutzer oder API-Schlüssel, der die Claude Code-Aktionen ausgeführt hat (entweder `user_actor` mit `email_address` oder `api_actor` mit `api_key_name`) * **organization\_id**: Organisation UUID * **customer\_type**: Typ des Kundenkontos (`api` für API-Kunden, `subscription` für Pro/Team-Kunden) * **terminal\_type**: Typ des Terminals oder der Umgebung, in der Claude Code verwendet wurde (z. B. `vscode`, `iTerm.app`, `tmux`) #### Kernmetriken * **num\_sessions**: Anzahl der unterschiedlichen Claude Code-Sitzungen, die von diesem Actor initiiert wurden * **lines\_of\_code.added**: Gesamtzahl der Codezeilen, die von Claude Code über alle Dateien hinweg hinzugefügt wurden * **lines\_of\_code.removed**: Gesamtzahl der Codezeilen, die von Claude Code über alle Dateien hinweg entfernt wurden * **commits\_by\_claude\_code**: Anzahl der Git-Commits, die durch die Commit-Funktionalität von Claude Code erstellt wurden * **pull\_requests\_by\_claude\_code**: Anzahl der Pull Requests, die durch die PR-Funktionalität von Claude Code erstellt wurden #### Tool-Aktionsmetriken Aufschlüsselung der Akzeptanz- und Ablehnungsraten für Tool-Aktionen nach Tool-Typ: * **edit\_tool.accepted/rejected**: Anzahl der Edit Tool-Vorschläge, die der Benutzer akzeptiert/abgelehnt hat * **write\_tool.accepted/rejected**: Anzahl der Write Tool-Vorschläge, die der Benutzer akzeptiert/abgelehnt hat * **notebook\_edit\_tool.accepted/rejected**: Anzahl der NotebookEdit Tool-Vorschläge, die der Benutzer akzeptiert/abgelehnt hat #### Modellaufschlüsselung Für jedes verwendete Claude-Modell: * **model**: Claude-Modellkennung (z. B. `claude-opus-4-6`) * **tokens.input/output**: Input- und Output-Token-Zählungen für dieses Modell * **tokens.cache\_read/cache\_creation**: Cache-bezogene Token-Nutzung für dieses Modell * **estimated\_cost.amount**: Geschätzte Kosten in Cent USD für dieses Modell * **estimated\_cost.currency**: Währungscode für den Kostenbetrag (derzeit immer `USD`) ### Response-Struktur Die API gibt Daten im folgenden Format zurück: { "data": [\ {\ "date": "2025-09-01T00:00:00Z",\ "actor": {\ "type": "user_actor",\ "email_address": "[email protected]"\ },\ "organization_id": "dc9f6c26-b22c-4831-8d01-0446bada88f1",\ "customer_type": "api",\ "terminal_type": "vscode",\ "core_metrics": {\ "num_sessions": 5,\ "lines_of_code": {\ "added": 1543,\ "removed": 892\ },\ "commits_by_claude_code": 12,\ "pull_requests_by_claude_code": 2\ },\ "tool_actions": {\ "edit_tool": {\ "accepted": 45,\ "rejected": 5\ },\ "multi_edit_tool": {\ "accepted": 12,\ "rejected": 2\ },\ "write_tool": {\ "accepted": 8,\ "rejected": 1\ },\ "notebook_edit_tool": {\ "accepted": 3,\ "rejected": 0\ }\ },\ "model_breakdown": [\ {\ "model": "claude-opus-4-6",\ "tokens": {\ "input": 100000,\ "output": 35000,\ "cache_read": 10000,\ "cache_creation": 5000\ },\ "estimated_cost": {\ "currency": "USD",\ "amount": 1025\ }\ }\ ]\ }\ ], "has_more": false, "next_page": null } Paginierung ----------------- Die API unterstützt cursor-basierte Paginierung für Organisationen mit großen Benutzermengen: 1. Stellen Sie Ihre erste Anfrage mit optionalem Parameter `limit` 2. Wenn `has_more` in der Antwort `true` ist, verwenden Sie den Wert `next_page` in Ihrer nächsten Anfrage 3. Fahren Sie fort, bis `has_more` `false` ist Der Cursor codiert die Position des letzten Datensatzes und gewährleistet stabile Paginierung, auch wenn neue Daten eintreffen. Jede Paginierungssitzung behält eine konsistente Datengrenze bei, um sicherzustellen, dass Sie keine Datensätze übersehen oder duplizieren. Häufige Anwendungsfälle ----------------------------- * **Executive Dashboards**: Erstellen Sie hochrangige Berichte, die die Auswirkungen von Claude Code auf die Entwicklungsgeschwindigkeit zeigen * **Vergleich von KI-Tools**: Exportieren Sie Metriken, um Claude Code mit anderen KI-Codierungstools wie Copilot und Cursor zu vergleichen * **Analyse der Entwicklerproduktivität**: Verfolgen Sie Produktivitätsmetriken einzelner Entwickler und Teams im Laufe der Zeit * **Kostenverfolgung und -zuordnung**: Überwachen Sie Ausgabenmuster und ordnen Sie Kosten nach Team oder Projekt zu * **Überwachung der Einführung**: Identifizieren Sie, welche Teams und Benutzer den meisten Nutzen aus Claude Code ziehen * **ROI-Begründung**: Stellen Sie konkrete Metriken bereit, um die Claude Code-Einführung intern zu rechtfertigen und zu erweitern Häufig gestellte Fragen ----------------------------- ### Wie aktuell sind die Analysedaten? Claude Code-Analysedaten erscheinen normalerweise innerhalb von 1 Stunde nach Abschluss der Benutzeraktivität. Um konsistente Paginierungsergebnisse zu gewährleisten, sind nur Daten älter als 1 Stunde in Antworten enthalten. ### Kann ich Echtzeit-Metriken abrufen? Nein, diese API bietet nur täglich aggregierte Metriken. Für Echtzeit-Überwachung sollten Sie die [OpenTelemetry-Integration](https://code.claude.com/docs/en/monitoring-usage) in Betracht ziehen. ### Wie werden Benutzer in den Daten identifiziert? Benutzer werden durch das Feld `actor` auf zwei Arten identifiziert: * **`user_actor`**: Enthält `email_address` für Benutzer, die sich über OAuth authentifizieren (am häufigsten) * **`api_actor`**: Enthält `api_key_name` für Benutzer, die sich über API-Schlüssel authentifizieren Das Feld `customer_type` gibt an, ob die Nutzung von `api`\-Kunden (API PAYG) oder `subscription`\-Kunden (Pro/Team-Pläne) stammt. ### Wie lange werden Daten aufbewahrt? Historische Claude Code-Analysedaten werden aufbewahrt und sind über die API zugänglich. Es gibt keinen festgelegten Löschzeitraum für diese Daten. ### Welche Claude Code-Bereitstellungen werden unterstützt? Diese API verfolgt nur die Claude Code-Nutzung auf der Claude API (1st Party). Die Nutzung auf Amazon Bedrock, Google Vertex AI oder anderen Drittanbieter-Plattformen ist nicht enthalten. ### Was kostet die Nutzung dieser API? Die Claude Code Analytics API ist kostenlos für alle Organisationen mit Zugriff auf die Admin API. ### Wie berechne ich Tool-Akzeptanzraten? Tool-Akzeptanzrate = `accepted / (accepted + rejected)` für jeden Tool-Typ. Wenn das Edit Tool beispielsweise 45 akzeptiert und 5 abgelehnt zeigt, beträgt die Akzeptanzrate 90%. ### Welche Zeitzone wird für den Date-Parameter verwendet? Alle Daten sind in UTC. Der Parameter `starting_at` sollte im Format YYYY-MM-DD vorliegen und stellt UTC-Mitternacht für diesen Tag dar. Siehe auch ---------------- Die Claude Code Analytics API hilft Ihnen, den Entwicklungs-Workflow Ihres Teams zu verstehen und zu optimieren. Erfahren Sie mehr über verwandte Funktionen: * [Admin API-Übersicht](https://platform.claude.com/docs/de/build-with-claude/administration-api) * [Admin API-Referenz](https://platform.claude.com/docs/de/api/admin) * [Claude Code Analytics Dashboard](https://platform.claude.com/claude-code) * [Usage and Cost API](https://platform.claude.com/docs/de/build-with-claude/usage-cost-api) - Verfolgen Sie die API-Nutzung über alle Anthropic-Services * [Identity and Access Management](https://code.claude.com/docs/en/iam) * [Überwachung der Nutzung mit OpenTelemetry](https://code.claude.com/docs/en/monitoring-usage) für benutzerdefinierte Metriken und Warnungen --- # System-Prompts - Claude API Docs Loading... Ressourcen System Prompts Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Was this page helpful? Claudes Web-Oberfläche ([Claude.ai](https://www.claude.ai/) ) und mobile Apps verwenden einen System-Prompt, um Claude zu Beginn jedes Gesprächs aktuelle Informationen wie das aktuelle Datum bereitzustellen. Wir verwenden den System-Prompt auch, um bestimmte Verhaltensweisen zu fördern, wie z. B. das Bereitstellen von Code-Snippets in Markdown. Wir aktualisieren diesen Prompt regelmäßig, während wir Claudes Antworten weiter verbessern. Diese System-Prompt-Updates gelten nicht für die Anthropic API. Updates zwischen Versionen sind fettgedruckt. Claude Sonnet 4.6 ----------------------- ### 17\. Februar 2026 Claude Opus 4.6 --------------------- ### 5\. Februar 2026 Claude Opus 4.5 --------------------- ### 18\. Januar 2026 Claude Haiku 4.5 ---------------------- ### 18\. Januar 2026 Claude Sonnet 4.5 ----------------------- ### 18\. Januar 2026 Claude Opus 4.1 --------------------- ### 5\. August 2025 Claude Opus 4 ------------------- ### 5\. August 2025 Claude Sonnet 4 --------------------- ### 5\. August 2025 Claude Sonnet 3.7 ----------------------- ### 24\. Februar 2025 Claude Sonnet 3.5 ----------------------- ### 22\. Nov. 2024 Claude Haiku 3.5 ---------------------- ### 22\. Oktober 2024 Claude Opus 3 ------------------- ### 12\. Juli 2024 Claude Haiku 3 -------------------- ### 12\. Juli 2024 ### 24\. November 2025 ### 19\. November 2025 ### 15\. Oktober 2025 ### 19\. November 2025 ### 29\. September 2025 ### 31\. Juli 2025 ### 22\. Mai 2025 ### 31\. Juli 2025 ### 22\. Mai 2025 ### 22\. Okt. 2024 ### 9\. Sept. 2024 ### 12\. Juli 2024 --- # Unknown \# API-Nutzungsleitfaden für Claude Dieser Leitfaden soll Claude die Grundlagen der Verwendung der Claude API vermitteln. Er bietet Erklärungen und Beispiele für Modell-IDs/die grundlegende Messages API, Tool-Nutzung, Streaming, erweitertes Denken und nichts anderes. --- # API-Nutzungsleitfaden für Claude > Dieser Leitfaden soll Claude die Grundlagen der Verwendung der Claude API vermitteln. Er bietet Erklärungen und Beispiele für Modell-IDs/die grundlegende Messages API, Tool-Nutzung, Streaming, erweitertes Denken und nichts anderes. ## Modelle \`\`\`text Intelligentestes Modell: Claude Opus 4.6: claude-opus-4-6 Intelligentes Modell: Claude Sonnet 4.6: claude-sonnet-4-6 Für schnelle, kostengünstige Aufgaben: Claude Haiku 4.5: claude-haiku-4-5-20251001 \`\`\` ## API aufrufen ### Grundlegende Anfrage und Antwort \`\`\`python import anthropic import os message = anthropic.Anthropic( api\_key=os.environ.get("ANTHROPIC\_API\_KEY") ).messages.create( model="claude-opus-4-6", max\_tokens=1024, messages=\[{"role": "user", "content": "Hello, Claude"}\], ) print(message) \`\`\` \`\`\`json { "id": "msg\_01XFDUDYJgAACzvnptvVoYEL", "type": "message", "role": "assistant", "content": \[ { "type": "text", "text": "Hello!" } \], "model": "claude-opus-4-6", "stop\_reason": "end\_turn", "stop\_sequence": null, "usage": { "input\_tokens": 12, "output\_tokens": 6 } } \`\`\` ### Mehrere Gesprächsrunden Die Messages API ist zustandslos, was bedeutet, dass Sie immer die vollständige Gesprächshistorie an die API senden. Sie können dieses Muster verwenden, um ein Gespräch im Laufe der Zeit aufzubauen. Frühere Gesprächsrunden müssen nicht unbedingt tatsächlich von Claude stammen – Sie können synthetische \`assistant\`-Nachrichten verwenden. \`\`\`python import anthropic message = anthropic.Anthropic().messages.create( model="claude-opus-4-6", max\_tokens=1024, messages=\[ {"role": "user", "content": "Hello, Claude"}, {"role": "assistant", "content": "Hello!"}, {"role": "user", "content": "Can you describe LLMs to me?"}, \], ) print(message) \`\`\` ### Claudia Worte in den Mund legen Sie können einen Teil von Claudes Antwort an der letzten Position der Eingabenachrichtenliste vorausfüllen. Dies kann verwendet werden, um Claudes Antwort zu beeinflussen. Das folgende Beispiel verwendet \`"max\_tokens": 1\`, um eine einzelne Multiple-Choice-Antwort von Claude zu erhalten. \`\`\`python message = anthropic.Anthropic().messages.create( model="claude-opus-4-6", max\_tokens=1, messages=\[ { "role": "user", "content": "What is latin for Ant? (A) Apoidea, (B) Rhopalocera, (C) Formicidae", }, {"role": "assistant", "content": "The answer is ("}, \], ) \`\`\` ### Vision Claude kann sowohl Text als auch Bilder in Anfragen lesen. Wir unterstützen sowohl \`base64\`- als auch \`url\`-Quellentypen für Bilder sowie die Medientypen \`image/jpeg\`, \`image/png\`, \`image/gif\` und \`image/webp\`. \`\`\`python import anthropic import base64 import httpx # Option 1: Base64-codiertes Bild image\_url = "https://upload.wikimedia.org/wikipedia/commons/a/a7/Camponotus\_flavomarginatus\_ant.jpg" image\_media\_type = "image/jpeg" image\_data = base64.standard\_b64encode(httpx.get(image\_url).content).decode("utf-8") message = anthropic.Anthropic().messages.create( model="claude-opus-4-6", max\_tokens=1024, messages=\[ { "role": "user", "content": \[ { "type": "image", "source": { "type": "base64", "media\_type": image\_media\_type, "data": image\_data, }, }, {"type": "text", "text": "What is in the above image?"}, \], } \], ) # Option 2: URL-referenziertes Bild message\_from\_url = anthropic.Anthropic().messages.create( model="claude-opus-4-6", max\_tokens=1024, messages=\[ { "role": "user", "content": \[ { "type": "image", "source": { "type": "url", "url": "https://upload.wikimedia.org/wikipedia/commons/a/a7/Camponotus\_flavomarginatus\_ant.jpg", }, }, {"type": "text", "text": "What is in the above image?"}, \], } \], ) \`\`\` ## Erweitertes Denken Erweitertes Denken kann Claude manchmal bei sehr schwierigen Aufgaben helfen. Wenn es aktiviert ist, muss die Temperatur auf 1 eingestellt werden. Erweitertes Denken wird in den folgenden Modellen unterstützt: - Claude Opus 4.1 (\`claude-opus-4-1-20250805\`) - Claude Opus 4 (\`claude-opus-4-20250514\`) - Claude Sonnet 4.6 (\`claude-sonnet-4-6\`) - Claude Sonnet 4.5 (\`claude-sonnet-4-5-20250929\`) ### Wie erweitertes Denken funktioniert Wenn erweitertes Denken aktiviert ist, erstellt Claude \`thinking\`-Inhaltsblöcke, in denen es sein internes Denken ausgibt. Die API-Antwort enthält \`thinking\`-Inhaltsblöcke, gefolgt von \`text\`-Inhaltsblöcken. \`\`\`python import anthropic client = anthropic.Anthropic() response = client.messages.create( model="claude-opus-4-6", max\_tokens=16000, thinking={"type": "enabled", "budget\_tokens": 10000}, messages=\[ { "role": "user", "content": "Are there an infinite number of prime numbers such that n mod 4 == 3?", } \], ) # Die Antwort enthält zusammengefasste Denkblöcke und Textblöcke for block in response.content: if block.type == "thinking": print(f"\\nThinking summary: {block.thinking}") elif block.type == "text": print(f"\\nResponse: {block.text}") \`\`\` Der Parameter \`budget\_tokens\` bestimmt die maximale Anzahl von Token, die Claude für seinen internen Denkprozess verwenden darf. Bei Claude 4-Modellen gilt diese Grenze für vollständige Denktoken und nicht für die zusammengefasste Ausgabe. Größere Budgets können die Antwortqualität verbessern, indem sie eine gründlichere Analyse für komplexe Probleme ermöglichen. Eine Regel: Der Wert von max\_tokens muss streng größer sein als der Wert von budget\_tokens, damit Claude Platz hat, seine Antwort zu schreiben, nachdem das Denken abgeschlossen ist. ## Erweitertes Denken mit Tool-Nutzung Erweitertes Denken kann zusammen mit Tool-Nutzung verwendet werden, was Claude ermöglicht, die Auswahl von Tools und die Verarbeitung von Ergebnissen zu durchdenken. Wichtige Einschränkungen: 1. \*\*Tool-Choice-Einschränkung\*\*: Unterstützt nur \`tool\_choice: {"type": "auto"}\` (Standard) oder \`tool\_choice: {"type": "none"}\`. 2. \*\*Bewahrung von Denkblöcken\*\*: Während der Tool-Nutzung müssen Sie \`thinking\`-Blöcke für die letzte Assistenten-Nachricht an die API zurückgeben. ### Bewahrung von Denkblöcken \`\`\`python # Erste Anfrage - Claude antwortet mit Denken und Tool-Anfrage response = client.messages.create( model="claude-opus-4-6", max\_tokens=16000, thinking={"type": "enabled", "budget\_tokens": 10000}, tools=\[weather\_tool\], messages=\[{"role": "user", "content": "What's the weather in Paris?"}\], ) # Extrahieren Sie den Denkblock und den Tool-Use-Block thinking\_block = next( (block for block in response.content if block.type == "thinking"), None ) tool\_use\_block = next( (block for block in response.content if block.type == "tool\_use"), None ) # Zweite Anfrage - Denkblock und Tool-Ergebnis einschließen continuation = client.messages.create( model="claude-opus-4-6", max\_tokens=16000, thinking={"type": "enabled", "budget\_tokens": 10000}, tools=\[weather\_tool\], messages=\[ {"role": "user", "content": "What's the weather in Paris?"}, # Beachten Sie, dass der thinking\_block zusammen mit dem tool\_use\_block übergeben wird {"role": "assistant", "content": \[thinking\_block, tool\_use\_block\]}, { "role": "user", "content": \[ { "type": "tool\_result", "tool\_use\_id": tool\_use\_block.id, "content": f"Current temperature: {weather\_data\['temperature'\]}°F", } \], }, \], ) \`\`\` ### Verschachteltes Denken Erweitertes Denken mit Tool-Nutzung in Claude 4-Modellen unterstützt verschachteltes Denken, das Claude ermöglicht, zwischen Tool-Aufrufen zu denken. Um es auf Claude 4, 4.5 und Sonnet 4.6-Modellen zu aktivieren, fügen Sie den Beta-Header \`interleaved-thinking-2025-05-14\` zu Ihrer API-Anfrage hinzu. \`\`\`python response = client.beta.messages.create( model="claude-sonnet-4-6", max\_tokens=16000, thinking={"type": "enabled", "budget\_tokens": 10000}, tools=\[calculator\_tool, database\_tool\], messages=\[ { "role": "user", "content": "What's the total revenue if we sold 150 units of product A at $50 each?", } \], betas=\["interleaved-thinking-2025-05-14"\], ) \`\`\` Mit verschachteltem Denken und NUR mit verschachteltem Denken (nicht mit regulärem erweitertem Denken) kann \`budget\_tokens\` den Parameter \`max\_tokens\` überschreiten, da \`budget\_tokens\` in diesem Fall das Gesamtbudget über alle Denkblöcke innerhalb einer Assistenten-Runde darstellt. Für Claude Opus 4.6 ist verschachteltes Denken automatisch aktiviert, wenn Sie \[adaptives Denken\](/docs/de/build-with-claude/adaptive-thinking) (\`thinking: {type: "adaptive"}\`) verwenden. Kein Beta-Header ist erforderlich. Sonnet 4.6 unterstützt sowohl den Beta-Header \`interleaved-thinking-2025-05-14\` mit manuellem erweitertem Denken als auch adaptives Denken. \## Tool-Nutzung ### Angeben von Client-Tools Client-Tools werden im Parameter \`tools\` auf oberster Ebene der API-Anfrage angegeben. Jede Tool-Definition enthält: | Parameter | Beschreibung | | :------------- | :-------------------------------------------------------------------------------------------------- | | \`name\` | Der Name des Tools. Muss dem Regex \`^\[a-zA-Z0-9\_-\]{1,64}$\` entsprechen. | | \`description\` | Eine detaillierte Klartextbeschreibung, was das Tool tut, wann es verwendet werden sollte und wie es sich verhält. | | \`input\_schema\` | Ein \[JSON Schema\](https://json-schema.org/)-Objekt, das die erwarteten Parameter für das Tool definiert. | \`\`\`json { "name": "get\_weather", "description": "Get the current weather in a given location", "input\_schema": { "type": "object", "properties": { "location": { "type": "string", "description": "The city and state, e.g. San Francisco, CA" }, "unit": { "type": "string", "enum": \["celsius", "fahrenheit"\], "description": "The unit of temperature, either 'celsius' or 'fahrenheit'" } }, "required": \["location"\] } } \`\`\` ### Best Practices für Tool-Definitionen \*\*Geben Sie äußerst detaillierte Beschreibungen an.\*\* Dies ist bei weitem der wichtigste Faktor für die Tool-Leistung. Ihre Beschreibungen sollten jedes Detail über das Tool erklären, einschließlich: - Was das Tool tut - Wann es verwendet werden sollte (und wann nicht) - Was jeder Parameter bedeutet und wie er das Verhalten des Tools beeinflusst - Alle wichtigen Vorbehalte oder Einschränkungen \*\*Erwägen Sie die Verwendung von \`input\_examples\` für komplexe Tools.\*\* Für Tools mit verschachtelten Objekten, optionalen Parametern oder formatempfindlichen Eingaben können Sie konkrete Beispiele mit dem Feld \`input\_examples\` (Beta) bereitstellen. Dies hilft Claude, erwartete Eingabemuster zu verstehen. Siehe \[Bereitstellung von Tool-Use-Beispielen\](/docs/de/agents-and-tools/tool-use/implement-tool-use#providing-tool-use-examples) für Details. Beispiel einer guten Tool-Beschreibung: \`\`\`json { "name": "get\_stock\_price", "description": "Retrieves the current stock price for a given ticker symbol. The ticker symbol must be a valid symbol for a publicly traded company on a major US stock exchange like NYSE or NASDAQ. The tool will return the latest trade price in USD. It should be used when the user asks about the current or most recent price of a specific stock. It will not provide any other information about the stock or company.", "input\_schema": { "type": "object", "properties": { "ticker": { "type": "string", "description": "The stock ticker symbol, e.g. AAPL for Apple Inc." } }, "required": \["ticker"\] } } \`\`\` ## Claudias Ausgabe steuern ### Erzwungene Tool-Nutzung Sie können Claude zwingen, ein bestimmtes Tool zu verwenden, indem Sie das Tool im Feld \`tool\_choice\` angeben: \`\`\`python tool\_choice = {"type": "tool", "name": "get\_weather"} \`\`\` Bei der Arbeit mit dem Parameter tool\_choice haben wir vier mögliche Optionen: - \`auto\` ermöglicht Claude zu entscheiden, ob bereitgestellte Tools aufgerufen werden sollen oder nicht (Standard). - \`any\` teilt Claude mit, dass es eines der bereitgestellten Tools verwenden muss. - \`tool\` ermöglicht es uns, Claude zu zwingen, immer ein bestimmtes Tool zu verwenden. - \`none\` verhindert, dass Claude Tools verwendet. ### JSON-Ausgabe Tools müssen nicht unbedingt Client-Funktionen sein – Sie können Tools jederzeit verwenden, wenn Sie möchten, dass das Modell JSON-Ausgabe zurückgibt, die einem bereitgestellten Schema entspricht. ### Gedankenkette Bei der Verwendung von Tools zeigt Claude oft seine "Gedankenkette", d. h. das schrittweise Denken, das es verwendet, um das Problem zu zerlegen und zu entscheiden, welche Tools verwendet werden sollen. \`\`\`json { "role": "assistant", "content": \[ { "type": "text", "text": "To answer this question, I will: 1. Use the get\_weather tool to get the current weather in San Francisco. 2. Use the get\_time tool to get the current time in the America/Los\_Angeles timezone, which covers San Francisco, CA." }, { "type": "tool\_use", "id": "toolu\_01A09q90qw90lq917835lq9", "name": "get\_weather", "input": { "location": "San Francisco, CA" } } \] } \`\`\` ### Parallele Tool-Nutzung Standardmäßig kann Claude mehrere Tools verwenden, um eine Benutzerabfrage zu beantworten. Sie können dieses Verhalten deaktivieren, indem Sie \`disable\_parallel\_tool\_use=true\` setzen. ## Umgang mit Tool-Nutzung und Tool-Ergebnis-Inhaltsblöcken ### Umgang mit Ergebnissen von Client-Tools Die Antwort hat einen \`stop\_reason\` von \`tool\_use\` und einen oder mehrere \`tool\_use\`-Inhaltsblöcke, die Folgendes enthalten: - \`id\`: Ein eindeutiger Bezeichner für diesen bestimmten Tool-Use-Block. - \`name\`: Der Name des verwendeten Tools. - \`input\`: Ein Objekt, das die an das Tool übergebene Eingabe enthält. Wenn Sie eine Tool-Use-Antwort erhalten, sollten Sie: 1. Extrahieren Sie \`name\`, \`id\` und \`input\` aus dem \`tool\_use\`-Block. 2. Führen Sie das tatsächliche Tool in Ihrer Codebasis aus, das diesem Tool-Namen entspricht. 3. Setzen Sie das Gespräch fort, indem Sie eine neue Nachricht mit einem \`tool\_result\` senden: \`\`\`json { "role": "user", "content": \[ { "type": "tool\_result", "tool\_use\_id": "toolu\_01A09q90qw90lq917835lq9", "content": "15 degrees" } \] } \`\`\` ### Umgang mit dem \`max\_tokens\`-Stop-Grund Wenn Claudes Antwort aufgrund des Erreichens des \`max\_tokens\`-Limits während der Tool-Nutzung unterbrochen wird, wiederholen Sie die Anfrage mit einem höheren \`max\_tokens\`-Wert. ### Umgang mit dem \`pause\_turn\`-Stop-Grund Bei Verwendung von Server-Tools wie Web-Suche kann die API einen \`pause\_turn\`-Stop-Grund zurückgeben. Setzen Sie das Gespräch fort, indem Sie die unterbrochene Antwort in einer nachfolgenden Anfrage unverändert zurückgeben. ## Fehlerbehebung ### Tool-Ausführungsfehler Wenn das Tool selbst während der Ausführung einen Fehler wirft, geben Sie die Fehlermeldung mit \`"is\_error": true\` zurück: \`\`\`json { "role": "user", "content": \[ { "type": "tool\_result", "tool\_use\_id": "toolu\_01A09q90qw90lq917835lq9", "content": "ConnectionError: the weather service API is not available (HTTP 500)", "is\_error": true } \] } \`\`\` ### Ungültiger Tool-Name Wenn Claudes versuchte Verwendung eines Tools ungültig ist (z. B. fehlende erforderliche Parameter), versuchen Sie die Anfrage erneut mit detaillierteren \`description\`-Werten in Ihren Tool-Definitionen. ## Streaming-Nachrichten Beim Erstellen einer Nachricht können Sie \`"stream": true\` setzen, um die Antwort inkrementell mit Server-Sent Events (SSE) zu streamen. ### Streaming mit SDKs \`\`\`python import anthropic client = anthropic.Anthropic() with client.messages.stream( max\_tokens=1024, messages=\[{"role": "user", "content": "Hello"}\], model="claude-opus-4-6", ) as stream: for text in stream.text\_stream: print(text, end="", flush=True) \`\`\` ### Ereignistypen Jedes Server-Sent Event enthält einen benannten Ereignistyp und zugehörige JSON-Daten. Jeder Stream verwendet den folgenden Ereignisfluss: 1. \`message\_start\`: enthält ein \`Message\`-Objekt mit leerem \`content\`. 2. Eine Reihe von Inhaltsblöcken, jeweils mit \`content\_block\_start\`, einem oder mehreren \`content\_block\_delta\`-Ereignissen und \`content\_block\_stop\`. 3. Ein oder mehrere \`message\_delta\`-Ereignisse, die Änderungen auf oberster Ebene am endgültigen \`Message\`-Objekt anzeigen. 4. Ein finales \`message\_stop\`-Ereignis. \*\*Warnung\*\*: Die im Feld \`usage\` des Ereignisses \`message\_delta\` angezeigten Token-Zählungen sind \_kumulativ\_. ### Content-Block-Delta-Typen #### Text-Delta \`\`\`json { "type": "content\_block\_delta", "index": 0, "delta": { "type": "text\_delta", "text": "Hello frien" } } \`\`\` #### Input-JSON-Delta Für \`tool\_use\`-Inhaltsblöcke sind Deltas \_partielle JSON-Strings\_: \`\`\`json {"type": "content\_block\_delta","index": 1,"delta": {"type": "input\_json\_delta","partial\_json": "{\\"location\\": \\"San Fra"}} \`\`\` #### Thinking-Delta Bei Verwendung von erweitertem Denken mit Streaming: \`\`\`json { "type": "content\_block\_delta", "index": 0, "delta": { "type": "thinking\_delta", "thinking": "Let me solve this step by step..." } } \`\`\` ### Beispiel einer grundlegenden Streaming-Anfrage \`\`\`json event: message\_start data: {"type": "message\_start", "message": {"id": "msg\_1nZdL29xx5MUA1yADyHTEsnR8uuvGzszyY", "type": "message", "role": "assistant", "content": \[\], "model": "claude-opus-4-6", "stop\_reason": null, "stop\_sequence": null, "usage": {"input\_tokens": 25, "output\_tokens": 1}}} event: content\_block\_start data: {"type": "content\_block\_start", "index": 0, "content\_block": {"type": "text", "text": ""}} event: content\_block\_delta data: {"type": "content\_block\_delta", "index": 0, "delta": {"type": "text\_delta", "text": "Hello"}} event: content\_block\_delta data: {"type": "content\_block\_delta", "index": 0, "delta": {"type": "text\_delta", "text": "!"}} event: content\_block\_stop data: {"type": "content\_block\_stop", "index": 0} event: message\_delta data: {"type": "message\_delta", "delta": {"stop\_reason": "end\_turn", "stop\_sequence":null}, "usage": {"output\_tokens": 15}} event: message\_stop data: {"type": "message\_stop"} \`\`\` --- # Ticket-Routing - Claude API Docs Loading... Anwendungsfälle Ticket-Routing Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Was this page helpful? Entscheiden Sie, ob Claude für Ticket-Routing verwendet werden soll ------------------------------------------------------------------------- Hier sind einige Schlüsselindikatoren, die darauf hindeuten, dass Sie ein LLM wie Claude anstelle traditioneller ML-Ansätze für Ihre Klassifizierungsaufgabe verwenden sollten: ### Sie haben begrenzte gekennzeichnete Trainingsdaten verfügbar ### Ihre Klassifizierungskategorien werden sich wahrscheinlich im Laufe der Zeit ändern oder weiterentwickeln ### Sie müssen komplexe, unstrukturierte Texteingaben verarbeiten ### Ihre Klassifizierungsregeln basieren auf semantischem Verständnis ### Sie benötigen interpretierbare Begründung für Klassifizierungsentscheidungen ### Sie möchten Grenzfälle und mehrdeutige Tickets effektiver handhaben ### Sie benötigen mehrsprachige Unterstützung ohne separate Modelle zu verwalten * * * Erstellen und implementieren Sie Ihren LLM-Support-Workflow ----------------------------------------------------------------- ### Verstehen Sie Ihren aktuellen Support-Ansatz Bevor Sie sich in die Automatisierung stürzen, ist es entscheidend, Ihr bestehendes Ticketing-System zu verstehen. Beginnen Sie damit, zu untersuchen, wie Ihr Support-Team derzeit Ticket-Routing handhabt. Berücksichtigen Sie Fragen wie: * Welche Kriterien werden verwendet, um zu bestimmen, welche SLA/welches Service-Angebot angewendet wird? * Wird Ticket-Routing verwendet, um zu bestimmen, welche Support-Ebene oder welcher Produktspezialist ein Ticket erhält? * Gibt es bereits automatisierte Regeln oder Workflows? In welchen Fällen schlagen sie fehl? * Wie werden Grenzfälle oder mehrdeutige Tickets behandelt? * Wie priorisiert das Team Tickets? Je mehr Sie darüber wissen, wie Menschen bestimmte Fälle handhaben, desto besser können Sie mit Claude zusammenarbeiten, um die Aufgabe zu erfüllen. ### Definieren Sie Kategorien der Benutzerabsicht Eine gut definierte Liste von Benutzerabsicht-Kategorien ist entscheidend für eine genaue Support-Ticket-Klassifizierung mit Claude. Claudes Fähigkeit, Tickets effektiv in Ihrem System zu leiten, ist direkt proportional zu der Qualität der Definition Ihrer Systemkategorien. Hier sind einige Beispiele für Benutzerabsicht-Kategorien und Unterkategorien. ### Technisches Problem ### Kontoverwaltung ### Produktinformationen Zusätzlich zur Absicht kann Ticket-Routing und Priorisierung auch durch andere Faktoren wie Dringlichkeit, Kundentyp, SLAs oder Sprache beeinflusst werden. Berücksichtigen Sie unbedingt andere Routing-Kriterien beim Aufbau Ihres automatisierten Routing-Systems. ### Etablieren Sie Erfolgskriterien Arbeiten Sie mit Ihrem Support-Team zusammen, um [klare Erfolgskriterien zu definieren](https://platform.claude.com/docs/de/test-and-evaluate/define-success) mit messbaren Benchmarks, Schwellwerten und Zielen. Hier sind einige Standard-Kriterien und Benchmarks bei der Verwendung von LLMs für Support-Ticket-Routing: ### Klassifizierungskonsistenz ### Anpassungsgeschwindigkeit ### Mehrsprachige Handhabung ### Handhabung von Grenzfällen ### Bias-Minderung ### Prompt-Effizienz ### Erklärbarkeits-Score Hier sind einige allgemeine Erfolgskriterien, die unabhängig davon nützlich sein können, ob ein LLM verwendet wird: ### Routing-Genauigkeit ### Zeit bis zur Zuweisung ### Umleitungsrate ### First-Contact-Resolution-Rate ### Durchschnittliche Bearbeitungszeit ### Kundenzufriedenheitswerte ### Eskalationsrate ### Agent-Produktivität ### Wählen Sie das richtige Claude-Modell Die Wahl des Modells hängt von den Kompromissen zwischen Kosten, Genauigkeit und Antwortzeit ab. Viele Kunden haben `claude-haiku-4-5-20251001` als ideales Modell für Ticket-Routing befunden, da es das schnellste und kostengünstigste Modell in der Claude 4-Familie ist und dennoch hervorragende Ergebnisse liefert. Wenn Ihr Klassifizierungsproblem tiefes Fachwissen oder eine große Anzahl von Absicht-Kategorien mit komplexem Reasoning erfordert, können Sie sich für das [größere Sonnet-Modell](https://platform.claude.com/docs/de/about-claude/models) entscheiden. ### Erstellen Sie einen starken Prompt Ticket-Routing ist eine Art Klassifizierungsaufgabe. Claude analysiert den Inhalt eines Support-Tickets und klassifiziert es in vordefinierte Kategorien basierend auf dem Problemtyp, der Dringlichkeit, erforderlichem Fachwissen oder anderen relevanten Faktoren. Schreiben wir einen Ticket-Klassifizierungs-Prompt. Unser anfänglicher Prompt sollte den Inhalt der Benutzeranfrage enthalten und sowohl die Begründung als auch die Absicht zurückgeben. Versuchen Sie den [Prompt-Generator](https://platform.claude.com/docs/de/prompt-generator) auf der [Claude Console](https://platform.claude.com/login) , um Claude einen ersten Entwurf schreiben zu lassen. Hier ist ein Beispiel für einen Ticket-Routing-Klassifizierungs-Prompt: def classify_support_request(ticket_contents): # Define the prompt for the classification task classification_prompt = f"""You will be acting as a customer support ticket classification system. Your task is to analyze customer support requests and output the appropriate classification intent for each request, along with your reasoning. Here is the customer support request you need to classify: {ticket_contents} Please carefully analyze the above request to determine the customer's core intent and needs. Consider what the customer is asking for has concerns about. First, write out your reasoning and analysis of how to classify this request inside tags. Then, output the appropriate classification label for the request inside a tag. The valid intents are: Support, Feedback, Complaint Order Tracking Refund/Exchange A request may have ONLY ONE applicable intent. Only include the intent that is most applicable to the request. As an example, consider the following request: Hello! I had high-speed fiber internet installed on Saturday and my installer, Kevin, was absolutely fantastic! Where can I send my positive review? Thanks for your help! Here is an example of how your output should be formatted (for the above example request): The user seeks information in order to leave positive feedback. Support, Feedback, Complaint Here are a few more examples: Example 2 Input: I wanted to write and personally thank you for the compassion you showed towards my family during my father's funeral this past weekend. Your staff was so considerate and helpful throughout this whole process; it really took a load off our shoulders. The visitation brochures were beautiful. We'll never forget the kindness you showed us and we are so appreciative of how smoothly the proceedings went. Thank you, again, Amarantha Hill on behalf of the Hill Family. Example 2 Output: User leaves a positive review of their experience. Support, Feedback, Complaint ... Example 9 Input: Your website keeps sending ad-popups that block the entire screen. It took me twenty minutes just to finally find the phone number to call and complain. How can I possibly access my account information with all of these popups? Can you access my account for me, since your website is broken? I need to know what the address is on file. Example 9 Output: The user requests help accessing their web account information. Support, Feedback, Complaint Remember to always include your classification reasoning before your actual intent output. The reasoning should be enclosed in tags and the intent in tags. Return only the reasoning and the intent. """ Lassen Sie uns die Schlüsselkomponenten dieses Prompts aufschlüsseln: * Wir verwenden Python f-Strings, um die Prompt-Vorlage zu erstellen, was ermöglicht, dass `ticket_contents` in die ``\-Tags eingefügt wird. * Wir geben Claude eine klar definierte Rolle als Klassifizierungssystem, das den Ticket-Inhalt sorgfältig analysiert, um die Kernabsicht und Bedürfnisse des Kunden zu bestimmen. * Wir instruieren Claude zur korrekten Ausgabeformatierung, in diesem Fall seine Begründung und Analyse in ``\-Tags bereitzustellen, gefolgt von dem entsprechenden Klassifizierungslabel in ``\-Tags. * Wir spezifizieren die gültigen Absicht-Kategorien: "Support, Feedback, Complaint", "Order Tracking" und "Refund/Exchange". * Wir fügen einige Beispiele (auch bekannt als Few-Shot-Prompting) ein, um zu veranschaulichen, wie die Ausgabe formatiert werden sollte, was Genauigkeit und Konsistenz verbessert. Der Grund, warum wir möchten, dass Claude seine Antwort in verschiedene XML-Tag-Abschnitte aufteilt, ist, dass wir reguläre Ausdrücke verwenden können, um die Begründung und Absicht separat aus der Ausgabe zu extrahieren. Dies ermöglicht es uns, gezielte nächste Schritte im Ticket-Routing-Workflow zu erstellen, wie z. B. nur die Absicht zu verwenden, um zu entscheiden, an wen das Ticket weitergeleitet werden soll. ### Implementieren Sie Ihren Prompt Es ist schwierig zu wissen, wie gut Ihr Prompt funktioniert, ohne ihn in einer Test-Produktionsumgebung bereitzustellen und [Evaluierungen durchzuführen](https://platform.claude.com/docs/de/test-and-evaluate/develop-tests) . Lassen Sie uns die Bereitstellungsstruktur aufbauen. Beginnen Sie damit, die Methodensignatur für den Wrapper unseres Aufrufs an Claude zu definieren. Wir werden die Methode, die wir bereits begonnen haben zu schreiben, nehmen, die `ticket_contents` als Eingabe hat, und nun ein Tupel von `reasoning` und `intent` als Ausgabe zurückgeben. Wenn Sie eine bestehende Automatisierung mit traditionellem ML haben, sollten Sie stattdessen dieser Methodensignatur folgen. import anthropic import re # Create an instance of the Claude API client client = anthropic.Anthropic() # Set the default model DEFAULT_MODEL="claude-haiku-4-5-20251001" def classify_support_request(ticket_contents): # Define the prompt for the classification task classification_prompt = f"""You will be acting as a customer support ticket classification system. ... ... The reasoning should be enclosed in tags and the intent in tags. Return only the reasoning and the intent. """ # Send the prompt to the API to classify the support request. message = client.messages.create( model=DEFAULT_MODEL, max_tokens=500, temperature=0, messages=[{"role": "user", "content": classification_prompt}], stream=False, ) reasoning_and_intent = message.content[0].text # Use Python's regular expressions library to extract `reasoning`. reasoning_match = re.search( r"(.*?)", reasoning_and_intent, re.DOTALL ) reasoning = reasoning_match.group(1).strip() if reasoning_match else "" # Similarly, also extract the `intent`. intent_match = re.search(r"(.*?)", reasoning_and_intent, re.DOTALL) intent = intent_match.group(1).strip() if intent_match else "" return reasoning, intent Dieser Code: * Importiert die Anthropic-Bibliothek und erstellt eine Client-Instanz mit Ihrem API-Schlüssel. * Definiert eine `classify_support_request`\-Funktion, die einen `ticket_contents`\-String annimmt. * Sendet `ticket_contents` an Claude zur Klassifizierung mit dem `classification_prompt` * Gibt das `reasoning` und `intent` des Modells zurück, das aus der Antwort extrahiert wurde. Da wir warten müssen, bis der gesamte Reasoning- und Intent-Text generiert wurde, bevor wir ihn analysieren, setzen wir `stream=False` (die Standardeinstellung). * * * Evaluieren Sie Ihren Prompt --------------------------------- Prompting erfordert oft Tests und Optimierung, um produktionsreif zu sein. Um die Bereitschaft Ihrer Lösung zu bestimmen, evaluieren Sie die Leistung basierend auf den Erfolgskriterien und Schwellwerten, die Sie zuvor etabliert haben. Um Ihre Evaluierung durchzuführen, benötigen Sie Testfälle, um sie auszuführen. Der Rest dieser Anleitung geht davon aus, dass Sie bereits [Ihre Testfälle entwickelt haben](https://platform.claude.com/docs/de/test-and-evaluate/develop-tests) . ### Erstellen Sie eine Evaluierungsfunktion Unsere Beispielevaluierung für diese Anleitung misst Claudes Leistung entlang von drei Schlüsselmetriken: * Genauigkeit * Kosten pro Klassifizierung Sie müssen Claude möglicherweise auf anderen Achsen bewerten, je nachdem, welche Faktoren für Sie wichtig sind. Um dies zu bewerten, müssen wir zunächst das Skript, das wir geschrieben haben, ändern und eine Funktion hinzufügen, um die vorhergesagte Absicht mit der tatsächlichen Absicht zu vergleichen und den Prozentsatz der korrekten Vorhersagen zu berechnen. Wir müssen auch Kostenberechnungs- und Zeitmessfunktionalität hinzufügen. import anthropic import re # Create an instance of the Claude API client client = anthropic.Anthropic() # Set the default model DEFAULT_MODEL="claude-haiku-4-5-20251001" def classify_support_request(request, actual_intent): # Define the prompt for the classification task classification_prompt = f"""You will be acting as a customer support ticket classification system. ... ...The reasoning should be enclosed in tags and the intent in tags. Return only the reasoning and the intent. """ message = client.messages.create( model=DEFAULT_MODEL, max_tokens=500, temperature=0, messages=[{"role": "user", "content": classification_prompt}], ) usage = message.usage # Get the usage statistics for the API call for how many input and output tokens were used. reasoning_and_intent = message.content[0].text # Use Python's regular expressions library to extract `reasoning`. reasoning_match = re.search( r"(.*?)", reasoning_and_intent, re.DOTALL ) reasoning = reasoning_match.group(1).strip() if reasoning_match else "" # Similarly, also extract the `intent`. intent_match = re.search(r"(.*?)", reasoning_and_intent, re.DOTALL) intent = intent_match.group(1).strip() if intent_match else "" # Check if the model's prediction is correct. correct = actual_intent.strip() == intent.strip() # Return the reasoning, intent, correct, and usage. return reasoning, intent, correct, usage Lassen Sie uns die Änderungen aufschlüsseln, die wir vorgenommen haben: * Wir haben die `actual_intent` aus unseren Testfällen in die `classify_support_request`\-Methode hinzugefügt und einen Vergleich eingerichtet, um zu bewerten, ob Claudes Intent-Klassifizierung unserer Golden-Intent-Klassifizierung entspricht. * Wir haben Nutzungsstatistiken für den API-Aufruf extrahiert, um Kosten basierend auf verwendeten Input- und Output-Tokens zu berechnen ### Führen Sie Ihre Evaluierung durch Eine ordnungsgemäße Evaluierung erfordert klare Schwellwerte und Benchmarks, um zu bestimmen, was ein gutes Ergebnis ist. Das obige Skript gibt uns die Laufzeitwerte für Genauigkeit, Antwortzeit und Kosten pro Klassifizierung, aber wir würden immer noch klar etablierte Schwellwerte benötigen. Zum Beispiel: * **Genauigkeit:** 95% (von 100 Tests) * **Kosten pro Klassifizierung:** 50% Reduktion im Durchschnitt (über 100 Tests) von der aktuellen Routing-Methode Mit diesen Schwellwerten können Sie schnell und einfach in großem Maßstab und mit unparteiischem Empirismus feststellen, welche Methode für Sie am besten ist und welche Änderungen möglicherweise vorgenommen werden müssen, um Ihre Anforderungen besser zu erfüllen. * * * Verbessern Sie die Leistung --------------------------------- In komplexen Szenarien kann es hilfreich sein, zusätzliche Strategien in Betracht zu ziehen, um die Leistung über Standard-[Prompt-Engineering-Techniken](https://platform.claude.com/docs/de/build-with-claude/prompt-engineering/overview) & [Guardrail-Implementierungsstrategien](https://platform.claude.com/docs/de/test-and-evaluate/strengthen-guardrails/reduce-hallucinations) hinaus zu verbessern. Hier sind einige häufige Szenarien: ### Verwenden Sie eine taxonomische Hierarchie für Fälle mit 20+ Intent-Kategorien Mit zunehmender Anzahl von Klassen wächst auch die Anzahl der erforderlichen Beispiele, was den Prompt möglicherweise unhandlich macht. Alternativ können Sie ein hierarchisches Klassifizierungssystem mit einer Mischung von Klassifizierern implementieren. 1. Organisieren Sie Ihre Intents in einer taxonomischen Baumstruktur. 2. Erstellen Sie eine Reihe von Klassifizierern auf jeder Ebene des Baums, um einen kaskadierten Routing-Ansatz zu ermöglichen. Zum Beispiel könnten Sie einen Top-Level-Klassifizierer haben, der Tickets grob in "Technische Probleme", "Abrechnungsfragen" und "Allgemeine Anfragen" kategorisiert. Jede dieser Kategorien kann dann ihren eigenen Sub-Klassifizierer haben, um die Klassifizierung weiter zu verfeinern. ![](https://platform.claude.com/docs/images/ticket-hierarchy.png) * **Vorteile - größere Nuance und Genauigkeit:** Sie können verschiedene Prompts für jeden übergeordneten Pfad erstellen, was eine gezielere und kontextspezifischere Klassifizierung ermöglicht. Dies kann zu verbesserter Genauigkeit und nuancierterem Umgang mit Kundenanfragen führen. * **Nachteile - erhöhte Latenz:** Seien Sie gewarnt, dass mehrere Klassifizierer zu erhöhter Latenz führen können, und wir empfehlen, diesen Ansatz mit unserem schnellsten Modell, Haiku, zu implementieren. ### Verwenden Sie Vektor-Datenbanken und Ähnlichkeitssuche-Abruf, um hochvariable Tickets zu handhaben Trotz der Tatsache, dass das Bereitstellen von Beispielen die effektivste Methode zur Verbesserung der Leistung ist, kann es schwierig sein, genug Beispiele in einen einzelnen Prompt einzubeziehen, wenn Support-Anfragen hochvariabel sind. In diesem Szenario könnten Sie eine Vektor-Datenbank verwenden, um Ähnlichkeitssuchen aus einem Datensatz von Beispielen durchzuführen und die relevantesten Beispiele für eine bestimmte Abfrage abzurufen. Dieser Ansatz, der detailliert in unserem [Klassifizierungs-Rezept](https://platform.claude.com/cookbook/capabilities-classification-guide) beschrieben ist, hat sich als Verbesserung der Leistung von 71% Genauigkeit auf 93% Genauigkeit erwiesen. ### Berücksichtigen Sie speziell erwartete Grenzfälle Hier sind einige Szenarien, in denen Claude Tickets möglicherweise falsch klassifiziert (es kann andere geben, die für Ihre Situation einzigartig sind). In diesen Szenarien sollten Sie explizite Anweisungen oder Beispiele im Prompt bereitstellen, wie Claude den Grenzfall handhaben sollte: ### Kunden machen implizite Anfragen ### Claude priorisiert Emotion gegenüber Absicht ### Mehrere Probleme verursachen Verwirrung bei der Problempriorisierung * * * Integrieren Sie Claude in Ihren größeren Support-Workflow --------------------------------------------------------------- Die ordnungsgemäße Integration erfordert, dass Sie einige Entscheidungen treffen, wie Ihr Claude-basiertes Ticket-Routing-Skript in die Architektur Ihres größeren Ticket-Routing-Systems passt. Es gibt zwei Möglichkeiten, wie Sie dies tun könnten: * **Push-basiert:** Das Support-Ticket-System, das Sie verwenden (z. B. Zendesk), löst Ihren Code aus, indem es ein Webhook-Ereignis an Ihren Routing-Service sendet, der dann die Absicht klassifiziert und es leitet. * Dieser Ansatz ist webskalierbarer, erfordert aber, dass Sie einen öffentlichen Endpunkt verfügbar machen. * **Pull-basiert:** Ihr Code ruft die neuesten Tickets basierend auf einem bestimmten Zeitplan ab und leitet sie zum Zeitpunkt des Abrufs. * Dieser Ansatz ist einfacher zu implementieren, könnte aber unnötige Aufrufe an das Support-Ticket-System machen, wenn die Abruffrequenz zu hoch ist, oder könnte übermäßig langsam sein, wenn die Abruffrequenz zu niedrig ist. Für jeden dieser Ansätze müssen Sie Ihr Skript in einen Service einwickeln. Die Wahl des Ansatzes hängt davon ab, welche APIs Ihr Support-Ticketing-System bereitstellt. * * * [Classification cookbook\ \ Besuchen Sie unser Classification Cookbook für mehr Beispielcode und detaillierte Evaluierungsleitfäden.](https://platform.claude.com/cookbook/capabilities-classification-guide) [](https://platform.claude.com/dashboard) ### Benutzerführung ### Feedback ### Bestellungsbezogen ### Serviceanfrage ### Sicherheitsbedenken ### Compliance und Recht ### Notfall-Support ### Schulung und Bildung ### Integration und API ### Self-Service-Deflection-Rate ### Kosten pro Ticket Claude Console Beginnen Sie mit dem Erstellen und Evaluieren Ihres Workflows auf der Claude Console. --- # Unknown \# Anthropic Developer Documentation This file provides an overview of the Anthropic API documentation and developer resources. ## Root URL Claude Developer Platform Console (Requires login) https://platform.claude.com ## Available Languages on Website The full documentation is available in the following languages on https://platform.claude.com/docs: - English (en) - 1088 pages - /docs - Content included below - German (Deutsch) (de) - 133 pages - /docs/de - Visit website for content - Spanish (Español) (es) - 133 pages - /docs/es - Visit website for content - French (Français) (fr) - 133 pages - /docs/fr - Visit website for content - Italian (Italiano) (it) - 133 pages - /docs/it - Visit website for content - Japanese (日本語) (ja) - 133 pages - /docs/ja - Visit website for content - Korean (한국어) (ko) - 133 pages - /docs/ko - Visit website for content - Portuguese (Português) (pt-BR) - 133 pages - /docs/pt-BR - Visit website for content - Russian (Русский) (ru) - 133 pages - /docs/ru - Visit website for content - Chinese Simplified (简体中文) (zh-CN) - 133 pages - /docs/zh-CN - Visit website for content - Chinese Traditional (繁體中文) (zh-TW) - 133 pages - /docs/zh-TW - Visit website for content - Indonesian (Bahasa Indonesia) (id) - 133 pages - /docs/id - Visit website for content --- ## English ### Build - \[Overview\](https://platform.claude.com/docs/en/agent-sdk/overview.md) - Agent SDK overview - \[Overview\](https://platform.claude.com/docs/en/agents-and-tools/agent-skills/overview.md) - Agent Skills - \[Overview\](https://platform.claude.com/docs/en/managed-agents/overview.md) - Claude Managed Agents overview - \[Claude Platform\](https://platform.claude.com/docs/en/release-notes/overview.md) - \[Features overview\](https://platform.claude.com/docs/en/build-with-claude/overview.md) - \[Quickstart\](https://platform.claude.com/docs/en/agents-and-tools/agent-skills/quickstart.md) - Get started with Agent Skills in the API - \[Quickstart\](https://platform.claude.com/docs/en/get-started.md) - Get started with Claude - \[Quickstart\](https://platform.claude.com/docs/en/managed-agents/quickstart.md) - Get started with Claude Managed Agents - \[Overview\](https://platform.claude.com/docs/en/about-claude/use-case-guides/overview.md) - Guides to common use cases - \[Intro to Claude\](https://platform.claude.com/docs/en/intro.md) - \[Overview\](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/overview.md) - Prompt engineering overview - \[Quickstart\](https://platform.claude.com/docs/en/agent-sdk/quickstart.md) - \[Overview\](https://platform.claude.com/docs/en/agents-and-tools/tool-use/overview.md) - Tool use with Claude - \[Accessing GitHub\](https://platform.claude.com/docs/en/managed-agents/github.md) - \[Adaptive thinking\](https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking.md) - \[Adding files\](https://platform.claude.com/docs/en/managed-agents/files.md) - \[Python SDK reference\](https://platform.claude.com/docs/en/agent-sdk/python.md) - Agent SDK reference - Python - \[TypeScript SDK reference\](https://platform.claude.com/docs/en/agent-sdk/typescript.md) - Agent SDK reference - TypeScript - \[Agent Skills in the SDK\](https://platform.claude.com/docs/en/agent-sdk/skills.md) - \[Authenticate with vaults\](https://platform.claude.com/docs/en/managed-agents/vaults.md) - \[Bash tool\](https://platform.claude.com/docs/en/agents-and-tools/tool-use/bash-tool.md) - \[Batch processing\](https://platform.claude.com/docs/en/build-with-claude/batch-processing.md) - \[Extended thinking\](https://platform.claude.com/docs/en/build-with-claude/extended-thinking.md) - Building with extended thinking - \[Citations\](https://platform.claude.com/docs/en/build-with-claude/citations.md) - \[Cloud environment setup\](https://platform.claude.com/docs/en/managed-agents/environments.md) - \[Code execution tool\](https://platform.claude.com/docs/en/agents-and-tools/tool-use/code-execution-tool.md) - \[Compaction\](https://platform.claude.com/docs/en/build-with-claude/compaction.md) - \[Computer use tool\](https://platform.claude.com/docs/en/agents-and-tools/tool-use/computer-use-tool.md) - \[Handling Permissions\](https://platform.claude.com/docs/en/agent-sdk/permissions.md) - Configure permissions - \[Connect MCP servers\](https://platform.claude.com/docs/en/agent-sdk/mcp.md) - Connect to external tools with MCP - \[Console prompting tools\](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/prompting-tools.md) - \[Container reference\](https://platform.claude.com/docs/en/managed-agents/cloud-containers.md) - \[Content moderation\](https://platform.claude.com/docs/en/about-claude/use-case-guides/content-moderation.md) - \[Context editing\](https://platform.claude.com/docs/en/build-with-claude/context-editing.md) - \[Context windows\](https://platform.claude.com/docs/en/build-with-claude/context-windows.md) - \[Customer support agent\](https://platform.claude.com/docs/en/about-claude/use-case-guides/customer-support-chat.md) - \[Define outcomes\](https://platform.claude.com/docs/en/managed-agents/define-outcomes.md) - \[Define success and build evaluations\](https://platform.claude.com/docs/en/test-and-evaluate/develop-tests.md) - Define success criteria and build evaluations - \[Agent setup\](https://platform.claude.com/docs/en/managed-agents/agent-setup.md) - Define your agent - \[Effort\](https://platform.claude.com/docs/en/build-with-claude/effort.md) - \[Embeddings\](https://platform.claude.com/docs/en/build-with-claude/embeddings.md) - \[Fast mode (beta: research preview)\](https://platform.claude.com/docs/en/build-with-claude/fast-mode.md) - \[Files API\](https://platform.claude.com/docs/en/build-with-claude/files.md) - \[Fine-grained tool streaming\](https://platform.claude.com/docs/en/agents-and-tools/tool-use/fine-grained-tool-streaming.md) - \[Structured outputs in the SDK\](https://platform.claude.com/docs/en/agent-sdk/structured-outputs.md) - Get structured output from agents - \[Define custom tools\](https://platform.claude.com/docs/en/agent-sdk/custom-tools.md) - Give Claude custom tools - \[Glossary\](https://platform.claude.com/docs/en/about-claude/glossary.md) - \[User approvals and input\](https://platform.claude.com/docs/en/agent-sdk/user-input.md) - Handle approvals and user input - \[Handling stop reasons\](https://platform.claude.com/docs/en/build-with-claude/handling-stop-reasons.md) - \[Hosting the Agent SDK\](https://platform.claude.com/docs/en/agent-sdk/hosting.md) - \[How the agent loop works\](https://platform.claude.com/docs/en/agent-sdk/agent-loop.md) - \[How tool use works\](https://platform.claude.com/docs/en/agents-and-tools/tool-use/how-tool-use-works.md) - \[Increase output consistency\](https://platform.claude.com/docs/en/test-and-evaluate/strengthen-guardrails/increase-consistency.md) - \[Control execution with hooks\](https://platform.claude.com/docs/en/agent-sdk/hooks.md) - Intercept and control agent behavior with hooks - \[Legal summarization\](https://platform.claude.com/docs/en/about-claude/use-case-guides/legal-summarization.md) - \[MCP connector\](https://platform.claude.com/docs/en/agents-and-tools/mcp-connector.md) - \[MCP connector\](https://platform.claude.com/docs/en/managed-agents/mcp-connector.md) - \[Memory tool\](https://platform.claude.com/docs/en/agents-and-tools/tool-use/memory-tool.md) - \[Migration Guide\](https://platform.claude.com/docs/en/agent-sdk/migration-guide.md) - Migrate to Claude Agent SDK - \[Mitigate jailbreaks\](https://platform.claude.com/docs/en/test-and-evaluate/strengthen-guardrails/mitigate-jailbreaks.md) - Mitigate jailbreaks and prompt injections - \[Modifying system prompts\](https://platform.claude.com/docs/en/agent-sdk/modifying-system-prompts.md) - \[Multiagent sessions\](https://platform.claude.com/docs/en/managed-agents/multi-agent.md) - \[Multilingual support\](https://platform.claude.com/docs/en/build-with-claude/multilingual-support.md) - \[PDF support\](https://platform.claude.com/docs/en/build-with-claude/pdf-support.md) - \[Permission policies\](https://platform.claude.com/docs/en/managed-agents/permission-policies.md) - \[Plugins in the SDK\](https://platform.claude.com/docs/en/agent-sdk/plugins.md) - \[Programmatic tool calling\](https://platform.claude.com/docs/en/agents-and-tools/tool-use/programmatic-tool-calling.md) - \[Prompt caching\](https://platform.claude.com/docs/en/build-with-claude/prompt-caching.md) - \[Prompting best practices\](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices.md) - \[Prototype in Console\](https://platform.claude.com/docs/en/managed-agents/onboarding.md) - \[Reduce hallucinations\](https://platform.claude.com/docs/en/test-and-evaluate/strengthen-guardrails/reduce-hallucinations.md) - \[Reduce prompt leak\](https://platform.claude.com/docs/en/test-and-evaluate/strengthen-guardrails/reduce-prompt-leak.md) - \[Reducing latency\](https://platform.claude.com/docs/en/test-and-evaluate/strengthen-guardrails/reduce-latency.md) - \[Remote MCP servers\](https://platform.claude.com/docs/en/agents-and-tools/remote-mcp-servers.md) - \[File checkpointing\](https://platform.claude.com/docs/en/agent-sdk/file-checkpointing.md) - Rewind file changes with checkpointing - \[Tool search\](https://platform.claude.com/docs/en/agent-sdk/tool-search.md) - Scale to many tools with tool search - \[Search results\](https://platform.claude.com/docs/en/build-with-claude/search-results.md) - \[Securely deploying AI agents\](https://platform.claude.com/docs/en/agent-sdk/secure-deployment.md) - \[Session event stream\](https://platform.claude.com/docs/en/managed-agents/events-and-streaming.md) - \[Best practices\](https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices.md) - Skill authoring best practices - \[Agent Skills\](https://platform.claude.com/docs/en/managed-agents/skills.md) - Skills - \[Skills for enterprise\](https://platform.claude.com/docs/en/agents-and-tools/agent-skills/enterprise.md) - \[Slash Commands in the SDK\](https://platform.claude.com/docs/en/agent-sdk/slash-commands.md) - \[Start a session\](https://platform.claude.com/docs/en/managed-agents/sessions.md) - \[Stream responses in real-time\](https://platform.claude.com/docs/en/agent-sdk/streaming-output.md) - \[Streaming Input\](https://platform.claude.com/docs/en/agent-sdk/streaming-vs-single-mode.md) - \[Streaming Messages\](https://platform.claude.com/docs/en/build-with-claude/streaming.md) - \[Streaming refusals\](https://platform.claude.com/docs/en/test-and-evaluate/strengthen-guardrails/handle-streaming-refusals.md) - \[Structured outputs\](https://platform.claude.com/docs/en/build-with-claude/structured-outputs.md) - \[Subagents in the SDK\](https://platform.claude.com/docs/en/agent-sdk/subagents.md) - \[Text editor tool\](https://platform.claude.com/docs/en/agents-and-tools/tool-use/text-editor-tool.md) - \[Ticket routing\](https://platform.claude.com/docs/en/about-claude/use-case-guides/ticket-routing.md) - \[Todo Lists\](https://platform.claude.com/docs/en/agent-sdk/todo-tracking.md) - \[Token counting\](https://platform.claude.com/docs/en/build-with-claude/token-counting.md) - \[Tool search\](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-search-tool.md) - Tool search tool - \[Tools\](https://platform.claude.com/docs/en/managed-agents/tools.md) - \[Track cost and usage\](https://platform.claude.com/docs/en/agent-sdk/cost-tracking.md) - \[TypeScript V2 reference (preview)\](https://platform.claude.com/docs/en/agent-sdk/typescript-v2-preview.md) - TypeScript SDK V2 interface (preview) - \[Use Claude Code features\](https://platform.claude.com/docs/en/agent-sdk/claude-code-features.md) - Use Claude Code features in the SDK - \[Skills in the API\](https://platform.claude.com/docs/en/build-with-claude/skills-guide.md) - Using Agent Skills with the API - \[Using memory\](https://platform.claude.com/docs/en/managed-agents/memory.md) - \[Using the Evaluation Tool in Console\](https://platform.claude.com/docs/en/test-and-evaluate/eval-tool.md) - Using the Evaluation Tool - \[Using the Messages API\](https://platform.claude.com/docs/en/build-with-claude/working-with-messages.md) - \[Images and vision\](https://platform.claude.com/docs/en/build-with-claude/vision.md) - Vision - \[Web fetch tool\](https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-fetch-tool.md) - \[Web search tool\](https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-search-tool.md) - \[Work with sessions\](https://platform.claude.com/docs/en/agent-sdk/sessions.md) ### Admin - \[Admin API overview\](https://platform.claude.com/docs/en/build-with-claude/administration-api.md) - \[API and data retention\](https://platform.claude.com/docs/en/build-with-claude/api-and-data-retention.md) - \[Claude Code Analytics API\](https://platform.claude.com/docs/en/build-with-claude/claude-code-analytics-api.md) - \[Microsoft Foundry\](https://platform.claude.com/docs/en/build-with-claude/claude-in-microsoft-foundry.md) - Claude in Microsoft Foundry - \[Amazon Bedrock\](https://platform.claude.com/docs/en/build-with-claude/claude-on-amazon-bedrock.md) - Claude on Amazon Bedrock - \[Vertex AI\](https://platform.claude.com/docs/en/build-with-claude/claude-on-vertex-ai.md) - Claude on Vertex AI - \[Data residency\](https://platform.claude.com/docs/en/build-with-claude/data-residency.md) - \[Migration\](https://platform.claude.com/docs/en/managed-agents/migration.md) - \[Session tracing\](https://platform.claude.com/docs/en/managed-agents/observability.md) - \[Usage and Cost API\](https://platform.claude.com/docs/en/build-with-claude/usage-cost-api.md) - \[Workspaces\](https://platform.claude.com/docs/en/build-with-claude/workspaces.md) ### Models & pricing - \[Models overview\](https://platform.claude.com/docs/en/about-claude/models/overview.md) - \[Model cards\](https://platform.claude.com/docs/en/resources/overview.md) - Overview - \[Choosing a model\](https://platform.claude.com/docs/en/about-claude/models/choosing-a-model.md) - Choosing the right model - \[Migration guide\](https://platform.claude.com/docs/en/about-claude/models/migration-guide.md) - \[Model deprecations\](https://platform.claude.com/docs/en/about-claude/model-deprecations.md) - \[Pricing\](https://platform.claude.com/docs/en/about-claude/pricing.md) - \[System prompts\](https://platform.claude.com/docs/en/release-notes/system-prompts.md) - System Prompts - \[What's new in Claude 4.6\](https://platform.claude.com/docs/en/about-claude/models/whats-new-claude-4-6.md) ### Client SDKs - \[C# SDK\](https://platform.claude.com/docs/en/api/sdks/csharp.md) - \[CLI\](https://platform.claude.com/docs/en/api/sdks/cli.md) - \[Overview\](https://platform.claude.com/docs/en/api/client-sdks.md) - Client SDKs - \[Go SDK\](https://platform.claude.com/docs/en/api/sdks/go.md) - \[Java SDK\](https://platform.claude.com/docs/en/api/sdks/java.md) - \[OpenAI SDK compatibility\](https://platform.claude.com/docs/en/api/openai-sdk.md) - \[PHP SDK\](https://platform.claude.com/docs/en/api/sdks/php.md) - \[Python SDK\](https://platform.claude.com/docs/en/api/sdks/python.md) - \[Ruby SDK\](https://platform.claude.com/docs/en/api/sdks/ruby.md) - \[TypeScript SDK\](https://platform.claude.com/docs/en/api/sdks/typescript.md) ### API Reference - \[Features overview\](https://platform.claude.com/docs/en/api/overview.md) - API Overview - \[Add Session Resource (Beta)\](https://platform.claude.com/docs/en/api/beta/sessions/resources/add.md) - \[Add Session Resource (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/sessions/resources/add.md) - \[Add Session Resource (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/sessions/resources/add.md) - \[Add Session Resource (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/sessions/resources/add.md) - \[Add Session Resource (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/sessions/resources/add.md) - \[Add Session Resource (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/sessions/resources/add.md) - \[Add Session Resource (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/sessions/resources/add.md) - \[Add Session Resource (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/sessions/resources/add.md) - \[Add Session Resource (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/sessions/resources/add.md) - \[Add Session Resource (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/sessions/resources/add.md) - \[Admin\](https://platform.claude.com/docs/en/api/admin.md) - \[Agents (Beta)\](https://platform.claude.com/docs/en/api/beta/agents.md) - \[Agents (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/agents.md) - \[Agents (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/agents.md) - \[Agents (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/agents.md) - \[Agents (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/agents.md) - \[Agents (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/agents.md) - \[Agents (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/agents.md) - \[Agents (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/agents.md) - \[Agents (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/agents.md) - \[Agents (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/agents.md) - \[API Keys\](https://platform.claude.com/docs/en/api/admin/api\_keys.md) - \[Archive Agent (Beta)\](https://platform.claude.com/docs/en/api/beta/agents/archive.md) - \[Archive Agent (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/agents/archive.md) - \[Archive Agent (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/agents/archive.md) - \[Archive Agent (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/agents/archive.md) - \[Archive Agent (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/agents/archive.md) - \[Archive Agent (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/agents/archive.md) - \[Archive Agent (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/agents/archive.md) - \[Archive Agent (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/agents/archive.md) - \[Archive Agent (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/agents/archive.md) - \[Archive Agent (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/agents/archive.md) - \[Archive Credential (Beta)\](https://platform.claude.com/docs/en/api/beta/vaults/credentials/archive.md) - \[Archive Credential (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/vaults/credentials/archive.md) - \[Archive Credential (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/vaults/credentials/archive.md) - \[Archive Credential (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/vaults/credentials/archive.md) - \[Archive Credential (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/vaults/credentials/archive.md) - \[Archive Credential (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/vaults/credentials/archive.md) - \[Archive Credential (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/vaults/credentials/archive.md) - \[Archive Credential (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/vaults/credentials/archive.md) - \[Archive Credential (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/vaults/credentials/archive.md) - \[Archive Credential (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/vaults/credentials/archive.md) - \[Archive Environment (Beta)\](https://platform.claude.com/docs/en/api/beta/environments/archive.md) - \[Archive Environment (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/environments/archive.md) - \[Archive Environment (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/environments/archive.md) - \[Archive Environment (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/environments/archive.md) - \[Archive Environment (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/environments/archive.md) - \[Archive Environment (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/environments/archive.md) - \[Archive Environment (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/environments/archive.md) - \[Archive Environment (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/environments/archive.md) - \[Archive Environment (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/environments/archive.md) - \[Archive Environment (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/environments/archive.md) - \[Archive Session (Beta)\](https://platform.claude.com/docs/en/api/beta/sessions/archive.md) - \[Archive Session (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/sessions/archive.md) - \[Archive Session (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/sessions/archive.md) - \[Archive Session (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/sessions/archive.md) - \[Archive Session (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/sessions/archive.md) - \[Archive Session (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/sessions/archive.md) - \[Archive Session (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/sessions/archive.md) - \[Archive Session (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/sessions/archive.md) - \[Archive Session (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/sessions/archive.md) - \[Archive Session (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/sessions/archive.md) - \[Archive Vault (Beta)\](https://platform.claude.com/docs/en/api/beta/vaults/archive.md) - \[Archive Vault (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/vaults/archive.md) - \[Archive Vault (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/vaults/archive.md) - \[Archive Vault (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/vaults/archive.md) - \[Archive Vault (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/vaults/archive.md) - \[Archive Vault (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/vaults/archive.md) - \[Archive Vault (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/vaults/archive.md) - \[Archive Vault (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/vaults/archive.md) - \[Archive Vault (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/vaults/archive.md) - \[Archive Vault (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/vaults/archive.md) - \[Archive Workspace\](https://platform.claude.com/docs/en/api/admin/workspaces/archive.md) - \[Batches\](https://platform.claude.com/docs/en/api/messages/batches.md) - \[Batches (Beta)\](https://platform.claude.com/docs/en/api/beta/messages/batches.md) - \[Batches (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/messages/batches.md) - \[Batches (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/messages/batches.md) - \[Batches (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/messages/batches.md) - \[Batches (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/messages/batches.md) - \[Batches (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/messages/batches.md) - \[Batches (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/messages/batches.md) - \[Batches (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/messages/batches.md) - \[Batches (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/messages/batches.md) - \[Batches (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/messages/batches.md) - \[Batches (cli)\](https://platform.claude.com/docs/en/api/cli/messages/batches.md) - \[Batches (csharp)\](https://platform.claude.com/docs/en/api/csharp/messages/batches.md) - \[Batches (Go)\](https://platform.claude.com/docs/en/api/go/messages/batches.md) - \[Batches (Java)\](https://platform.claude.com/docs/en/api/java/messages/batches.md) - \[Batches (php)\](https://platform.claude.com/docs/en/api/php/messages/batches.md) - \[Batches (Python)\](https://platform.claude.com/docs/en/api/python/messages/batches.md) - \[Batches (Ruby)\](https://platform.claude.com/docs/en/api/ruby/messages/batches.md) - \[Batches (terraform)\](https://platform.claude.com/docs/en/api/terraform/messages/batches.md) - \[Batches (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/messages/batches.md) - \[Beta (Beta)\](https://platform.claude.com/docs/en/api/beta.md) - \[Beta (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta.md) - \[Beta (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta.md) - \[Beta (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta.md) - \[Beta (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta.md) - \[Beta (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta.md) - \[Beta (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta.md) - \[Beta (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta.md) - \[Beta (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta.md) - \[Beta (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta.md) - \[Cancel a Message Batch\](https://platform.claude.com/docs/en/api/messages/batches/cancel.md) - \[Cancel a Message Batch (Beta)\](https://platform.claude.com/docs/en/api/beta/messages/batches/cancel.md) - \[Cancel a Message Batch (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/messages/batches/cancel.md) - \[Cancel a Message Batch (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/messages/batches/cancel.md) - \[Cancel a Message Batch (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/messages/batches/cancel.md) - \[Cancel a Message Batch (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/messages/batches/cancel.md) - \[Cancel a Message Batch (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/messages/batches/cancel.md) - \[Cancel a Message Batch (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/messages/batches/cancel.md) - \[Cancel a Message Batch (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/messages/batches/cancel.md) - \[Cancel a Message Batch (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/messages/batches/cancel.md) - \[Cancel a Message Batch (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/messages/batches/cancel.md) - \[Cancel a Message Batch (cli)\](https://platform.claude.com/docs/en/api/cli/messages/batches/cancel.md) - \[Cancel a Message Batch (csharp)\](https://platform.claude.com/docs/en/api/csharp/messages/batches/cancel.md) - \[Cancel a Message Batch (Go)\](https://platform.claude.com/docs/en/api/go/messages/batches/cancel.md) - \[Cancel a Message Batch (Java)\](https://platform.claude.com/docs/en/api/java/messages/batches/cancel.md) - \[Cancel a Message Batch (php)\](https://platform.claude.com/docs/en/api/php/messages/batches/cancel.md) - \[Cancel a Message Batch (Python)\](https://platform.claude.com/docs/en/api/python/messages/batches/cancel.md) - \[Cancel a Message Batch (Ruby)\](https://platform.claude.com/docs/en/api/ruby/messages/batches/cancel.md) - \[Cancel a Message Batch (terraform)\](https://platform.claude.com/docs/en/api/terraform/messages/batches/cancel.md) - \[Cancel a Message Batch (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/messages/batches/cancel.md) - \[Completions\](https://platform.claude.com/docs/en/api/completions.md) - \[Completions (cli)\](https://platform.claude.com/docs/en/api/cli/completions.md) - \[Completions (csharp)\](https://platform.claude.com/docs/en/api/csharp/completions.md) - \[Completions (Go)\](https://platform.claude.com/docs/en/api/go/completions.md) - \[Completions (Java)\](https://platform.claude.com/docs/en/api/java/completions.md) - \[Completions (php)\](https://platform.claude.com/docs/en/api/php/completions.md) - \[Completions (Python)\](https://platform.claude.com/docs/en/api/python/completions.md) - \[Completions (Ruby)\](https://platform.claude.com/docs/en/api/ruby/completions.md) - \[Completions (terraform)\](https://platform.claude.com/docs/en/api/terraform/completions.md) - \[Completions (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/completions.md) - \[Cost Report\](https://platform.claude.com/docs/en/api/admin/cost\_report.md) - \[Count tokens in a Message\](https://platform.claude.com/docs/en/api/messages/count\_tokens.md) - \[Count tokens in a Message (Beta)\](https://platform.claude.com/docs/en/api/beta/messages/count\_tokens.md) - \[Count tokens in a Message (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/messages/count\_tokens.md) - \[Count tokens in a Message (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/messages/count\_tokens.md) - \[Count tokens in a Message (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/messages/count\_tokens.md) - \[Count tokens in a Message (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/messages/count\_tokens.md) - \[Count tokens in a Message (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/messages/count\_tokens.md) - \[Count tokens in a Message (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/messages/count\_tokens.md) - \[Count tokens in a Message (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/messages/count\_tokens.md) - \[Count tokens in a Message (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/messages/count\_tokens.md) - \[Count tokens in a Message (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/messages/count\_tokens.md) - \[Count tokens in a Message (cli)\](https://platform.claude.com/docs/en/api/cli/messages/count\_tokens.md) - \[Count tokens in a Message (csharp)\](https://platform.claude.com/docs/en/api/csharp/messages/count\_tokens.md) - \[Count tokens in a Message (Go)\](https://platform.claude.com/docs/en/api/go/messages/count\_tokens.md) - \[Count tokens in a Message (Java)\](https://platform.claude.com/docs/en/api/java/messages/count\_tokens.md) - \[Count tokens in a Message (php)\](https://platform.claude.com/docs/en/api/php/messages/count\_tokens.md) - \[Count tokens in a Message (Python)\](https://platform.claude.com/docs/en/api/python/messages/count\_tokens.md) - \[Count tokens in a Message (Ruby)\](https://platform.claude.com/docs/en/api/ruby/messages/count\_tokens.md) - \[Count tokens in a Message (terraform)\](https://platform.claude.com/docs/en/api/terraform/messages/count\_tokens.md) - \[Count tokens in a Message (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/messages/count\_tokens.md) - \[Create a Message\](https://platform.claude.com/docs/en/api/messages/create.md) - \[Create a Message (Beta)\](https://platform.claude.com/docs/en/api/beta/messages/create.md) - \[Create a Message (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/messages/create.md) - \[Create a Message (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/messages/create.md) - \[Create a Message (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/messages/create.md) - \[Create a Message (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/messages/create.md) - \[Create a Message (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/messages/create.md) - \[Create a Message (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/messages/create.md) - \[Create a Message (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/messages/create.md) - \[Create a Message (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/messages/create.md) - \[Create a Message (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/messages/create.md) - \[Create a Message (cli)\](https://platform.claude.com/docs/en/api/cli/messages/create.md) - \[Create a Message (csharp)\](https://platform.claude.com/docs/en/api/csharp/messages/create.md) - \[Create a Message (Go)\](https://platform.claude.com/docs/en/api/go/messages/create.md) - \[Create a Message (Java)\](https://platform.claude.com/docs/en/api/java/messages/create.md) - \[Create a Message (php)\](https://platform.claude.com/docs/en/api/php/messages/create.md) - \[Create a Message (Python)\](https://platform.claude.com/docs/en/api/python/messages/create.md) - \[Create a Message (Ruby)\](https://platform.claude.com/docs/en/api/ruby/messages/create.md) - \[Create a Message (terraform)\](https://platform.claude.com/docs/en/api/terraform/messages/create.md) - \[Create a Message (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/messages/create.md) - \[Create a Message Batch\](https://platform.claude.com/docs/en/api/messages/batches/create.md) - \[Create a Message Batch (Beta)\](https://platform.claude.com/docs/en/api/beta/messages/batches/create.md) - \[Create a Message Batch (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/messages/batches/create.md) - \[Create a Message Batch (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/messages/batches/create.md) - \[Create a Message Batch (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/messages/batches/create.md) - \[Create a Message Batch (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/messages/batches/create.md) - \[Create a Message Batch (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/messages/batches/create.md) - \[Create a Message Batch (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/messages/batches/create.md) - \[Create a Message Batch (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/messages/batches/create.md) - \[Create a Message Batch (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/messages/batches/create.md) - \[Create a Message Batch (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/messages/batches/create.md) - \[Create a Message Batch (cli)\](https://platform.claude.com/docs/en/api/cli/messages/batches/create.md) - \[Create a Message Batch (csharp)\](https://platform.claude.com/docs/en/api/csharp/messages/batches/create.md) - \[Create a Message Batch (Go)\](https://platform.claude.com/docs/en/api/go/messages/batches/create.md) - \[Create a Message Batch (Java)\](https://platform.claude.com/docs/en/api/java/messages/batches/create.md) - \[Create a Message Batch (php)\](https://platform.claude.com/docs/en/api/php/messages/batches/create.md) - \[Create a Message Batch (Python)\](https://platform.claude.com/docs/en/api/python/messages/batches/create.md) - \[Create a Message Batch (Ruby)\](https://platform.claude.com/docs/en/api/ruby/messages/batches/create.md) - \[Create a Message Batch (terraform)\](https://platform.claude.com/docs/en/api/terraform/messages/batches/create.md) - \[Create a Message Batch (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/messages/batches/create.md) - \[Create a Text Completion\](https://platform.claude.com/docs/en/api/completions/create.md) - \[Create a Text Completion (cli)\](https://platform.claude.com/docs/en/api/cli/completions/create.md) - \[Create a Text Completion (csharp)\](https://platform.claude.com/docs/en/api/csharp/completions/create.md) - \[Create a Text Completion (Go)\](https://platform.claude.com/docs/en/api/go/completions/create.md) - \[Create a Text Completion (Java)\](https://platform.claude.com/docs/en/api/java/completions/create.md) - \[Create a Text Completion (php)\](https://platform.claude.com/docs/en/api/php/completions/create.md) - \[Create a Text Completion (Python)\](https://platform.claude.com/docs/en/api/python/completions/create.md) - \[Create a Text Completion (Ruby)\](https://platform.claude.com/docs/en/api/ruby/completions/create.md) - \[Create a Text Completion (terraform)\](https://platform.claude.com/docs/en/api/terraform/completions/create.md) - \[Create a Text Completion (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/completions/create.md) - \[Create Agent (Beta)\](https://platform.claude.com/docs/en/api/beta/agents/create.md) - \[Create Agent (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/agents/create.md) - \[Create Agent (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/agents/create.md) - \[Create Agent (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/agents/create.md) - \[Create Agent (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/agents/create.md) - \[Create Agent (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/agents/create.md) - \[Create Agent (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/agents/create.md) - \[Create Agent (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/agents/create.md) - \[Create Agent (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/agents/create.md) - \[Create Agent (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/agents/create.md) - \[Create Credential (Beta)\](https://platform.claude.com/docs/en/api/beta/vaults/credentials/create.md) - \[Create Credential (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/vaults/credentials/create.md) - \[Create Credential (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/vaults/credentials/create.md) - \[Create Credential (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/vaults/credentials/create.md) - \[Create Credential (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/vaults/credentials/create.md) - \[Create Credential (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/vaults/credentials/create.md) - \[Create Credential (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/vaults/credentials/create.md) - \[Create Credential (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/vaults/credentials/create.md) - \[Create Credential (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/vaults/credentials/create.md) - \[Create Credential (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/vaults/credentials/create.md) - \[Create Environment (Beta)\](https://platform.claude.com/docs/en/api/beta/environments/create.md) - \[Create Environment (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/environments/create.md) - \[Create Environment (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/environments/create.md) - \[Create Environment (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/environments/create.md) - \[Create Environment (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/environments/create.md) - \[Create Environment (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/environments/create.md) - \[Create Environment (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/environments/create.md) - \[Create Environment (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/environments/create.md) - \[Create Environment (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/environments/create.md) - \[Create Environment (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/environments/create.md) - \[Create Invite\](https://platform.claude.com/docs/en/api/admin/invites/create.md) - \[Create Session (Beta)\](https://platform.claude.com/docs/en/api/beta/sessions/create.md) - \[Create Session (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/sessions/create.md) - \[Create Session (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/sessions/create.md) - \[Create Session (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/sessions/create.md) - \[Create Session (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/sessions/create.md) - \[Create Session (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/sessions/create.md) - \[Create Session (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/sessions/create.md) - \[Create Session (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/sessions/create.md) - \[Create Session (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/sessions/create.md) - \[Create Session (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/sessions/create.md) - \[Create Skill (Beta)\](https://platform.claude.com/docs/en/api/beta/skills/create.md) - \[Create Skill (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/skills/create.md) - \[Create Skill (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/skills/create.md) - \[Create Skill (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/skills/create.md) - \[Create Skill (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/skills/create.md) - \[Create Skill (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/skills/create.md) - \[Create Skill (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/skills/create.md) - \[Create Skill (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/skills/create.md) - \[Create Skill (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/skills/create.md) - \[Create Skill (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/skills/create.md) - \[Create Skill Version (Beta)\](https://platform.claude.com/docs/en/api/beta/skills/versions/create.md) - \[Create Skill Version (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/skills/versions/create.md) - \[Create Skill Version (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/skills/versions/create.md) - \[Create Skill Version (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/skills/versions/create.md) - \[Create Skill Version (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/skills/versions/create.md) - \[Create Skill Version (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/skills/versions/create.md) - \[Create Skill Version (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/skills/versions/create.md) - \[Create Skill Version (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/skills/versions/create.md) - \[Create Skill Version (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/skills/versions/create.md) - \[Create Skill Version (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/skills/versions/create.md) - \[Create Vault (Beta)\](https://platform.claude.com/docs/en/api/beta/vaults/create.md) - \[Create Vault (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/vaults/create.md) - \[Create Vault (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/vaults/create.md) - \[Create Vault (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/vaults/create.md) - \[Create Vault (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/vaults/create.md) - \[Create Vault (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/vaults/create.md) - \[Create Vault (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/vaults/create.md) - \[Create Vault (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/vaults/create.md) - \[Create Vault (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/vaults/create.md) - \[Create Vault (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/vaults/create.md) - \[Create Workspace\](https://platform.claude.com/docs/en/api/admin/workspaces/create.md) - \[Create Workspace Member\](https://platform.claude.com/docs/en/api/admin/workspaces/members/create.md) - \[Credentials (Beta)\](https://platform.claude.com/docs/en/api/beta/vaults/credentials.md) - \[Credentials (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/vaults/credentials.md) - \[Credentials (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/vaults/credentials.md) - \[Credentials (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/vaults/credentials.md) - \[Credentials (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/vaults/credentials.md) - \[Credentials (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/vaults/credentials.md) - \[Credentials (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/vaults/credentials.md) - \[Credentials (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/vaults/credentials.md) - \[Credentials (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/vaults/credentials.md) - \[Credentials (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/vaults/credentials.md) - \[Delete a Message Batch\](https://platform.claude.com/docs/en/api/messages/batches/delete.md) - \[Delete a Message Batch (Beta)\](https://platform.claude.com/docs/en/api/beta/messages/batches/delete.md) - \[Delete a Message Batch (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/messages/batches/delete.md) - \[Delete a Message Batch (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/messages/batches/delete.md) - \[Delete a Message Batch (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/messages/batches/delete.md) - \[Delete a Message Batch (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/messages/batches/delete.md) - \[Delete a Message Batch (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/messages/batches/delete.md) - \[Delete a Message Batch (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/messages/batches/delete.md) - \[Delete a Message Batch (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/messages/batches/delete.md) - \[Delete a Message Batch (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/messages/batches/delete.md) - \[Delete a Message Batch (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/messages/batches/delete.md) - \[Delete a Message Batch (cli)\](https://platform.claude.com/docs/en/api/cli/messages/batches/delete.md) - \[Delete a Message Batch (csharp)\](https://platform.claude.com/docs/en/api/csharp/messages/batches/delete.md) - \[Delete a Message Batch (Go)\](https://platform.claude.com/docs/en/api/go/messages/batches/delete.md) - \[Delete a Message Batch (Java)\](https://platform.claude.com/docs/en/api/java/messages/batches/delete.md) - \[Delete a Message Batch (php)\](https://platform.claude.com/docs/en/api/php/messages/batches/delete.md) - \[Delete a Message Batch (Python)\](https://platform.claude.com/docs/en/api/python/messages/batches/delete.md) - \[Delete a Message Batch (Ruby)\](https://platform.claude.com/docs/en/api/ruby/messages/batches/delete.md) - \[Delete a Message Batch (terraform)\](https://platform.claude.com/docs/en/api/terraform/messages/batches/delete.md) - \[Delete a Message Batch (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/messages/batches/delete.md) - \[Delete Credential (Beta)\](https://platform.claude.com/docs/en/api/beta/vaults/credentials/delete.md) - \[Delete Credential (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/vaults/credentials/delete.md) - \[Delete Credential (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/vaults/credentials/delete.md) - \[Delete Credential (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/vaults/credentials/delete.md) - \[Delete Credential (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/vaults/credentials/delete.md) - \[Delete Credential (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/vaults/credentials/delete.md) - \[Delete Credential (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/vaults/credentials/delete.md) - \[Delete Credential (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/vaults/credentials/delete.md) - \[Delete Credential (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/vaults/credentials/delete.md) - \[Delete Credential (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/vaults/credentials/delete.md) - \[Delete Environment (Beta)\](https://platform.claude.com/docs/en/api/beta/environments/delete.md) - \[Delete Environment (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/environments/delete.md) - \[Delete Environment (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/environments/delete.md) - \[Delete Environment (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/environments/delete.md) - \[Delete Environment (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/environments/delete.md) - \[Delete Environment (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/environments/delete.md) - \[Delete Environment (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/environments/delete.md) - \[Delete Environment (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/environments/delete.md) - \[Delete Environment (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/environments/delete.md) - \[Delete Environment (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/environments/delete.md) - \[Delete File (Beta)\](https://platform.claude.com/docs/en/api/beta/files/delete.md) - \[Delete File (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/files/delete.md) - \[Delete File (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/files/delete.md) - \[Delete File (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/files/delete.md) - \[Delete File (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/files/delete.md) - \[Delete File (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/files/delete.md) - \[Delete File (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/files/delete.md) - \[Delete File (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/files/delete.md) - \[Delete File (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/files/delete.md) - \[Delete File (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/files/delete.md) - \[Delete Invite\](https://platform.claude.com/docs/en/api/admin/invites/delete.md) - \[Delete Session (Beta)\](https://platform.claude.com/docs/en/api/beta/sessions/delete.md) - \[Delete Session (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/sessions/delete.md) - \[Delete Session (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/sessions/delete.md) - \[Delete Session (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/sessions/delete.md) - \[Delete Session (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/sessions/delete.md) - \[Delete Session (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/sessions/delete.md) - \[Delete Session (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/sessions/delete.md) - \[Delete Session (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/sessions/delete.md) - \[Delete Session (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/sessions/delete.md) - \[Delete Session (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/sessions/delete.md) - \[Delete Session Resource (Beta)\](https://platform.claude.com/docs/en/api/beta/sessions/resources/delete.md) - \[Delete Session Resource (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/sessions/resources/delete.md) - \[Delete Session Resource (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/sessions/resources/delete.md) - \[Delete Session Resource (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/sessions/resources/delete.md) - \[Delete Session Resource (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/sessions/resources/delete.md) - \[Delete Session Resource (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/sessions/resources/delete.md) - \[Delete Session Resource (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/sessions/resources/delete.md) - \[Delete Session Resource (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/sessions/resources/delete.md) - \[Delete Session Resource (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/sessions/resources/delete.md) - \[Delete Session Resource (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/sessions/resources/delete.md) - \[Delete Skill (Beta)\](https://platform.claude.com/docs/en/api/beta/skills/delete.md) - \[Delete Skill (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/skills/delete.md) - \[Delete Skill (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/skills/delete.md) - \[Delete Skill (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/skills/delete.md) - \[Delete Skill (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/skills/delete.md) - \[Delete Skill (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/skills/delete.md) - \[Delete Skill (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/skills/delete.md) - \[Delete Skill (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/skills/delete.md) - \[Delete Skill (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/skills/delete.md) - \[Delete Skill (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/skills/delete.md) - \[Delete Skill Version (Beta)\](https://platform.claude.com/docs/en/api/beta/skills/versions/delete.md) - \[Delete Skill Version (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/skills/versions/delete.md) - \[Delete Skill Version (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/skills/versions/delete.md) - \[Delete Skill Version (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/skills/versions/delete.md) - \[Delete Skill Version (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/skills/versions/delete.md) - \[Delete Skill Version (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/skills/versions/delete.md) - \[Delete Skill Version (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/skills/versions/delete.md) - \[Delete Skill Version (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/skills/versions/delete.md) - \[Delete Skill Version (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/skills/versions/delete.md) - \[Delete Skill Version (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/skills/versions/delete.md) - \[Delete Vault (Beta)\](https://platform.claude.com/docs/en/api/beta/vaults/delete.md) - \[Delete Vault (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/vaults/delete.md) - \[Delete Vault (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/vaults/delete.md) - \[Delete Vault (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/vaults/delete.md) - \[Delete Vault (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/vaults/delete.md) - \[Delete Vault (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/vaults/delete.md) - \[Delete Vault (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/vaults/delete.md) - \[Delete Vault (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/vaults/delete.md) - \[Delete Vault (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/vaults/delete.md) - \[Delete Vault (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/vaults/delete.md) - \[Delete Workspace Member\](https://platform.claude.com/docs/en/api/admin/workspaces/members/delete.md) - \[Download File (Beta)\](https://platform.claude.com/docs/en/api/beta/files/download.md) - \[Download File (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/files/download.md) - \[Download File (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/files/download.md) - \[Download File (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/files/download.md) - \[Download File (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/files/download.md) - \[Download File (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/files/download.md) - \[Download File (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/files/download.md) - \[Download File (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/files/download.md) - \[Download File (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/files/download.md) - \[Download File (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/files/download.md) - \[Environments (Beta)\](https://platform.claude.com/docs/en/api/beta/environments.md) - \[Environments (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/environments.md) - \[Environments (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/environments.md) - \[Environments (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/environments.md) - \[Environments (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/environments.md) - \[Environments (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/environments.md) - \[Environments (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/environments.md) - \[Environments (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/environments.md) - \[Environments (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/environments.md) - \[Environments (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/environments.md) - \[Events (Beta)\](https://platform.claude.com/docs/en/api/beta/sessions/events.md) - \[Events (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/sessions/events.md) - \[Events (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/sessions/events.md) - \[Events (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/sessions/events.md) - \[Events (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/sessions/events.md) - \[Events (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/sessions/events.md) - \[Events (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/sessions/events.md) - \[Events (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/sessions/events.md) - \[Events (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/sessions/events.md) - \[Events (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/sessions/events.md) - \[Files (Beta)\](https://platform.claude.com/docs/en/api/beta/files.md) - \[Files (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/files.md) - \[Files (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/files.md) - \[Files (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/files.md) - \[Files (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/files.md) - \[Files (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/files.md) - \[Files (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/files.md) - \[Files (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/files.md) - \[Files (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/files.md) - \[Files (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/files.md) - \[Get a Model\](https://platform.claude.com/docs/en/api/models/retrieve.md) - \[Get a Model (Beta)\](https://platform.claude.com/docs/en/api/beta/models/retrieve.md) - \[Get a Model (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/models/retrieve.md) - \[Get a Model (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/models/retrieve.md) - \[Get a Model (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/models/retrieve.md) - \[Get a Model (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/models/retrieve.md) - \[Get a Model (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/models/retrieve.md) - \[Get a Model (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/models/retrieve.md) - \[Get a Model (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/models/retrieve.md) - \[Get a Model (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/models/retrieve.md) - \[Get a Model (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/models/retrieve.md) - \[Get a Model (cli)\](https://platform.claude.com/docs/en/api/cli/models/retrieve.md) - \[Get a Model (csharp)\](https://platform.claude.com/docs/en/api/csharp/models/retrieve.md) - \[Get a Model (Go)\](https://platform.claude.com/docs/en/api/go/models/retrieve.md) - \[Get a Model (Java)\](https://platform.claude.com/docs/en/api/java/models/retrieve.md) - \[Get a Model (php)\](https://platform.claude.com/docs/en/api/php/models/retrieve.md) - \[Get a Model (Python)\](https://platform.claude.com/docs/en/api/python/models/retrieve.md) - \[Get a Model (Ruby)\](https://platform.claude.com/docs/en/api/ruby/models/retrieve.md) - \[Get a Model (terraform)\](https://platform.claude.com/docs/en/api/terraform/models/retrieve.md) - \[Get a Model (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/models/retrieve.md) - \[Get Agent (Beta)\](https://platform.claude.com/docs/en/api/beta/agents/retrieve.md) - \[Get Agent (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/agents/retrieve.md) - \[Get Agent (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/agents/retrieve.md) - \[Get Agent (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/agents/retrieve.md) - \[Get Agent (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/agents/retrieve.md) - \[Get Agent (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/agents/retrieve.md) - \[Get Agent (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/agents/retrieve.md) - \[Get Agent (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/agents/retrieve.md) - \[Get Agent (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/agents/retrieve.md) - \[Get Agent (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/agents/retrieve.md) - \[Get API Key\](https://platform.claude.com/docs/en/api/admin/api\_keys/retrieve.md) - \[Get Claude Code Usage Report\](https://platform.claude.com/docs/en/api/admin/usage\_report/retrieve\_claude\_code.md) - \[Get Cost Report\](https://platform.claude.com/docs/en/api/admin/cost\_report/retrieve.md) - \[Get Credential (Beta)\](https://platform.claude.com/docs/en/api/beta/vaults/credentials/retrieve.md) - \[Get Credential (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/vaults/credentials/retrieve.md) - \[Get Credential (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/vaults/credentials/retrieve.md) - \[Get Credential (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/vaults/credentials/retrieve.md) - \[Get Credential (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/vaults/credentials/retrieve.md) - \[Get Credential (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/vaults/credentials/retrieve.md) - \[Get Credential (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/vaults/credentials/retrieve.md) - \[Get Credential (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/vaults/credentials/retrieve.md) - \[Get Credential (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/vaults/credentials/retrieve.md) - \[Get Credential (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/vaults/credentials/retrieve.md) - \[Get Current Organization\](https://platform.claude.com/docs/en/api/admin/organizations/me.md) - \[Get Environment (Beta)\](https://platform.claude.com/docs/en/api/beta/environments/retrieve.md) - \[Get Environment (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/environments/retrieve.md) - \[Get Environment (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/environments/retrieve.md) - \[Get Environment (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/environments/retrieve.md) - \[Get Environment (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/environments/retrieve.md) - \[Get Environment (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/environments/retrieve.md) - \[Get Environment (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/environments/retrieve.md) - \[Get Environment (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/environments/retrieve.md) - \[Get Environment (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/environments/retrieve.md) - \[Get Environment (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/environments/retrieve.md) - \[Get File Metadata (Beta)\](https://platform.claude.com/docs/en/api/beta/files/retrieve\_metadata.md) - \[Get File Metadata (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/files/retrieve\_metadata.md) - \[Get File Metadata (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/files/retrieve\_metadata.md) - \[Get File Metadata (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/files/retrieve\_metadata.md) - \[Get File Metadata (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/files/retrieve\_metadata.md) - \[Get File Metadata (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/files/retrieve\_metadata.md) - \[Get File Metadata (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/files/retrieve\_metadata.md) - \[Get File Metadata (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/files/retrieve\_metadata.md) - \[Get File Metadata (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/files/retrieve\_metadata.md) - \[Get File Metadata (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/files/retrieve\_metadata.md) - \[Get Invite\](https://platform.claude.com/docs/en/api/admin/invites/retrieve.md) - \[Get Messages Usage Report\](https://platform.claude.com/docs/en/api/admin/usage\_report/retrieve\_messages.md) - \[Get Session (Beta)\](https://platform.claude.com/docs/en/api/beta/sessions/retrieve.md) - \[Get Session (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/sessions/retrieve.md) - \[Get Session (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/sessions/retrieve.md) - \[Get Session (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/sessions/retrieve.md) - \[Get Session (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/sessions/retrieve.md) - \[Get Session (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/sessions/retrieve.md) - \[Get Session (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/sessions/retrieve.md) - \[Get Session (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/sessions/retrieve.md) - \[Get Session (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/sessions/retrieve.md) - \[Get Session (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/sessions/retrieve.md) - \[Get Session Resource (Beta)\](https://platform.claude.com/docs/en/api/beta/sessions/resources/retrieve.md) - \[Get Session Resource (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/sessions/resources/retrieve.md) - \[Get Session Resource (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/sessions/resources/retrieve.md) - \[Get Session Resource (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/sessions/resources/retrieve.md) - \[Get Session Resource (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/sessions/resources/retrieve.md) - \[Get Session Resource (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/sessions/resources/retrieve.md) - \[Get Session Resource (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/sessions/resources/retrieve.md) - \[Get Session Resource (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/sessions/resources/retrieve.md) - \[Get Session Resource (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/sessions/resources/retrieve.md) - \[Get Session Resource (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/sessions/resources/retrieve.md) - \[Get Skill (Beta)\](https://platform.claude.com/docs/en/api/beta/skills/retrieve.md) - \[Get Skill (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/skills/retrieve.md) - \[Get Skill (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/skills/retrieve.md) - \[Get Skill (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/skills/retrieve.md) - \[Get Skill (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/skills/retrieve.md) - \[Get Skill (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/skills/retrieve.md) - \[Get Skill (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/skills/retrieve.md) - \[Get Skill (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/skills/retrieve.md) - \[Get Skill (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/skills/retrieve.md) - \[Get Skill (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/skills/retrieve.md) - \[Get Skill Version (Beta)\](https://platform.claude.com/docs/en/api/beta/skills/versions/retrieve.md) - \[Get Skill Version (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/skills/versions/retrieve.md) - \[Get Skill Version (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/skills/versions/retrieve.md) - \[Get Skill Version (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/skills/versions/retrieve.md) - \[Get Skill Version (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/skills/versions/retrieve.md) - \[Get Skill Version (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/skills/versions/retrieve.md) - \[Get Skill Version (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/skills/versions/retrieve.md) - \[Get Skill Version (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/skills/versions/retrieve.md) - \[Get Skill Version (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/skills/versions/retrieve.md) - \[Get Skill Version (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/skills/versions/retrieve.md) - \[Get User\](https://platform.claude.com/docs/en/api/admin/users/retrieve.md) - \[Get Vault (Beta)\](https://platform.claude.com/docs/en/api/beta/vaults/retrieve.md) - \[Get Vault (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/vaults/retrieve.md) - \[Get Vault (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/vaults/retrieve.md) - \[Get Vault (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/vaults/retrieve.md) - \[Get Vault (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/vaults/retrieve.md) - \[Get Vault (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/vaults/retrieve.md) - \[Get Vault (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/vaults/retrieve.md) - \[Get Vault (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/vaults/retrieve.md) - \[Get Vault (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/vaults/retrieve.md) - \[Get Vault (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/vaults/retrieve.md) - \[Get Workspace\](https://platform.claude.com/docs/en/api/admin/workspaces/retrieve.md) - \[Get Workspace Member\](https://platform.claude.com/docs/en/api/admin/workspaces/members/retrieve.md) - \[Invites\](https://platform.claude.com/docs/en/api/admin/invites.md) - \[List Agent Versions (Beta)\](https://platform.claude.com/docs/en/api/beta/agents/versions/list.md) - \[List Agent Versions (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/agents/versions/list.md) - \[List Agent Versions (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/agents/versions/list.md) - \[List Agent Versions (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/agents/versions/list.md) - \[List Agent Versions (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/agents/versions/list.md) - \[List Agent Versions (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/agents/versions/list.md) - \[List Agent Versions (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/agents/versions/list.md) - \[List Agent Versions (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/agents/versions/list.md) - \[List Agent Versions (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/agents/versions/list.md) - \[List Agent Versions (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/agents/versions/list.md) - \[List Agents (Beta)\](https://platform.claude.com/docs/en/api/beta/agents/list.md) - \[List Agents (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/agents/list.md) - \[List Agents (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/agents/list.md) - \[List Agents (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/agents/list.md) - \[List Agents (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/agents/list.md) - \[List Agents (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/agents/list.md) - \[List Agents (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/agents/list.md) - \[List Agents (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/agents/list.md) - \[List Agents (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/agents/list.md) - \[List Agents (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/agents/list.md) - \[List API Keys\](https://platform.claude.com/docs/en/api/admin/api\_keys/list.md) - \[List Credentials (Beta)\](https://platform.claude.com/docs/en/api/beta/vaults/credentials/list.md) - \[List Credentials (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/vaults/credentials/list.md) - \[List Credentials (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/vaults/credentials/list.md) - \[List Credentials (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/vaults/credentials/list.md) - \[List Credentials (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/vaults/credentials/list.md) - \[List Credentials (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/vaults/credentials/list.md) - \[List Credentials (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/vaults/credentials/list.md) - \[List Credentials (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/vaults/credentials/list.md) - \[List Credentials (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/vaults/credentials/list.md) - \[List Credentials (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/vaults/credentials/list.md) - \[List Environments (Beta)\](https://platform.claude.com/docs/en/api/beta/environments/list.md) - \[List Environments (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/environments/list.md) - \[List Environments (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/environments/list.md) - \[List Environments (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/environments/list.md) - \[List Environments (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/environments/list.md) - \[List Environments (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/environments/list.md) - \[List Environments (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/environments/list.md) - \[List Environments (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/environments/list.md) - \[List Environments (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/environments/list.md) - \[List Environments (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/environments/list.md) - \[List Events (Beta)\](https://platform.claude.com/docs/en/api/beta/sessions/events/list.md) - \[List Events (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/sessions/events/list.md) - \[List Events (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/sessions/events/list.md) - \[List Events (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/sessions/events/list.md) - \[List Events (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/sessions/events/list.md) - \[List Events (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/sessions/events/list.md) - \[List Events (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/sessions/events/list.md) - \[List Events (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/sessions/events/list.md) - \[List Events (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/sessions/events/list.md) - \[List Events (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/sessions/events/list.md) - \[List Files (Beta)\](https://platform.claude.com/docs/en/api/beta/files/list.md) - \[List Files (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/files/list.md) - \[List Files (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/files/list.md) - \[List Files (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/files/list.md) - \[List Files (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/files/list.md) - \[List Files (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/files/list.md) - \[List Files (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/files/list.md) - \[List Files (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/files/list.md) - \[List Files (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/files/list.md) - \[List Files (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/files/list.md) - \[List Invites\](https://platform.claude.com/docs/en/api/admin/invites/list.md) - \[List Message Batches\](https://platform.claude.com/docs/en/api/messages/batches/list.md) - \[List Message Batches (Beta)\](https://platform.claude.com/docs/en/api/beta/messages/batches/list.md) - \[List Message Batches (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/messages/batches/list.md) - \[List Message Batches (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/messages/batches/list.md) - \[List Message Batches (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/messages/batches/list.md) - \[List Message Batches (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/messages/batches/list.md) - \[List Message Batches (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/messages/batches/list.md) - \[List Message Batches (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/messages/batches/list.md) - \[List Message Batches (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/messages/batches/list.md) - \[List Message Batches (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/messages/batches/list.md) - \[List Message Batches (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/messages/batches/list.md) - \[List Message Batches (cli)\](https://platform.claude.com/docs/en/api/cli/messages/batches/list.md) - \[List Message Batches (csharp)\](https://platform.claude.com/docs/en/api/csharp/messages/batches/list.md) - \[List Message Batches (Go)\](https://platform.claude.com/docs/en/api/go/messages/batches/list.md) - \[List Message Batches (Java)\](https://platform.claude.com/docs/en/api/java/messages/batches/list.md) - \[List Message Batches (php)\](https://platform.claude.com/docs/en/api/php/messages/batches/list.md) - \[List Message Batches (Python)\](https://platform.claude.com/docs/en/api/python/messages/batches/list.md) - \[List Message Batches (Ruby)\](https://platform.claude.com/docs/en/api/ruby/messages/batches/list.md) - \[List Message Batches (terraform)\](https://platform.claude.com/docs/en/api/terraform/messages/batches/list.md) - \[List Message Batches (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/messages/batches/list.md) - \[List Models\](https://platform.claude.com/docs/en/api/models/list.md) - \[List Models (Beta)\](https://platform.claude.com/docs/en/api/beta/models/list.md) - \[List Models (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/models/list.md) - \[List Models (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/models/list.md) - \[List Models (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/models/list.md) - \[List Models (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/models/list.md) - \[List Models (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/models/list.md) - \[List Models (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/models/list.md) - \[List Models (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/models/list.md) - \[List Models (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/models/list.md) - \[List Models (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/models/list.md) - \[List Models (cli)\](https://platform.claude.com/docs/en/api/cli/models/list.md) - \[List Models (csharp)\](https://platform.claude.com/docs/en/api/csharp/models/list.md) - \[List Models (Go)\](https://platform.claude.com/docs/en/api/go/models/list.md) - \[List Models (Java)\](https://platform.claude.com/docs/en/api/java/models/list.md) - \[List Models (php)\](https://platform.claude.com/docs/en/api/php/models/list.md) - \[List Models (Python)\](https://platform.claude.com/docs/en/api/python/models/list.md) - \[List Models (Ruby)\](https://platform.claude.com/docs/en/api/ruby/models/list.md) - \[List Models (terraform)\](https://platform.claude.com/docs/en/api/terraform/models/list.md) - \[List Models (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/models/list.md) - \[List Session Resources (Beta)\](https://platform.claude.com/docs/en/api/beta/sessions/resources/list.md) - \[List Session Resources (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/sessions/resources/list.md) - \[List Session Resources (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/sessions/resources/list.md) - \[List Session Resources (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/sessions/resources/list.md) - \[List Session Resources (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/sessions/resources/list.md) - \[List Session Resources (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/sessions/resources/list.md) - \[List Session Resources (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/sessions/resources/list.md) - \[List Session Resources (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/sessions/resources/list.md) - \[List Session Resources (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/sessions/resources/list.md) - \[List Session Resources (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/sessions/resources/list.md) - \[List Sessions (Beta)\](https://platform.claude.com/docs/en/api/beta/sessions/list.md) - \[List Sessions (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/sessions/list.md) - \[List Sessions (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/sessions/list.md) - \[List Sessions (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/sessions/list.md) - \[List Sessions (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/sessions/list.md) - \[List Sessions (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/sessions/list.md) - \[List Sessions (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/sessions/list.md) - \[List Sessions (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/sessions/list.md) - \[List Sessions (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/sessions/list.md) - \[List Sessions (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/sessions/list.md) - \[List Skill Versions (Beta)\](https://platform.claude.com/docs/en/api/beta/skills/versions/list.md) - \[List Skill Versions (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/skills/versions/list.md) - \[List Skill Versions (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/skills/versions/list.md) - \[List Skill Versions (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/skills/versions/list.md) - \[List Skill Versions (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/skills/versions/list.md) - \[List Skill Versions (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/skills/versions/list.md) - \[List Skill Versions (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/skills/versions/list.md) - \[List Skill Versions (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/skills/versions/list.md) - \[List Skill Versions (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/skills/versions/list.md) - \[List Skill Versions (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/skills/versions/list.md) - \[List Skills (Beta)\](https://platform.claude.com/docs/en/api/beta/skills/list.md) - \[List Skills (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/skills/list.md) - \[List Skills (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/skills/list.md) - \[List Skills (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/skills/list.md) - \[List Skills (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/skills/list.md) - \[List Skills (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/skills/list.md) - \[List Skills (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/skills/list.md) - \[List Skills (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/skills/list.md) - \[List Skills (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/skills/list.md) - \[List Skills (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/skills/list.md) - \[List Users\](https://platform.claude.com/docs/en/api/admin/users/list.md) - \[List Vaults (Beta)\](https://platform.claude.com/docs/en/api/beta/vaults/list.md) - \[List Vaults (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/vaults/list.md) - \[List Vaults (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/vaults/list.md) - \[List Vaults (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/vaults/list.md) - \[List Vaults (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/vaults/list.md) - \[List Vaults (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/vaults/list.md) - \[List Vaults (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/vaults/list.md) - \[List Vaults (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/vaults/list.md) - \[List Vaults (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/vaults/list.md) - \[List Vaults (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/vaults/list.md) - \[List Workspace Members\](https://platform.claude.com/docs/en/api/admin/workspaces/members/list.md) - \[List Workspaces\](https://platform.claude.com/docs/en/api/admin/workspaces/list.md) - \[Members\](https://platform.claude.com/docs/en/api/admin/workspaces/members.md) - \[Messages\](https://platform.claude.com/docs/en/api/messages.md) - \[Messages (Beta)\](https://platform.claude.com/docs/en/api/beta/messages.md) - \[Messages (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/messages.md) - \[Messages (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/messages.md) - \[Messages (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/messages.md) - \[Messages (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/messages.md) - \[Messages (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/messages.md) - \[Messages (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/messages.md) - \[Messages (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/messages.md) - \[Messages (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/messages.md) - \[Messages (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/messages.md) - \[Messages (cli)\](https://platform.claude.com/docs/en/api/cli/messages.md) - \[Messages (csharp)\](https://platform.claude.com/docs/en/api/csharp/messages.md) - \[Messages (Go)\](https://platform.claude.com/docs/en/api/go/messages.md) - \[Messages (Java)\](https://platform.claude.com/docs/en/api/java/messages.md) - \[Messages (php)\](https://platform.claude.com/docs/en/api/php/messages.md) - \[Messages (Python)\](https://platform.claude.com/docs/en/api/python/messages.md) - \[Messages (Ruby)\](https://platform.claude.com/docs/en/api/ruby/messages.md) - \[Messages (terraform)\](https://platform.claude.com/docs/en/api/terraform/messages.md) - \[Messages (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/messages.md) - \[Models\](https://platform.claude.com/docs/en/api/models.md) - \[Models (Beta)\](https://platform.claude.com/docs/en/api/beta/models.md) - \[Models (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/models.md) - \[Models (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/models.md) - \[Models (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/models.md) - \[Models (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/models.md) - \[Models (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/models.md) - \[Models (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/models.md) - \[Models (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/models.md) - \[Models (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/models.md) - \[Models (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/models.md) - \[Models (cli)\](https://platform.claude.com/docs/en/api/cli/models.md) - \[Models (csharp)\](https://platform.claude.com/docs/en/api/csharp/models.md) - \[Models (Go)\](https://platform.claude.com/docs/en/api/go/models.md) - \[Models (Java)\](https://platform.claude.com/docs/en/api/java/models.md) - \[Models (php)\](https://platform.claude.com/docs/en/api/php/models.md) - \[Models (Python)\](https://platform.claude.com/docs/en/api/python/models.md) - \[Models (Ruby)\](https://platform.claude.com/docs/en/api/ruby/models.md) - \[Models (terraform)\](https://platform.claude.com/docs/en/api/terraform/models.md) - \[Models (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/models.md) - \[Organizations\](https://platform.claude.com/docs/en/api/admin/organizations.md) - \[Remove User\](https://platform.claude.com/docs/en/api/admin/users/delete.md) - \[Resources (Beta)\](https://platform.claude.com/docs/en/api/beta/sessions/resources.md) - \[Resources (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/sessions/resources.md) - \[Resources (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/sessions/resources.md) - \[Resources (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/sessions/resources.md) - \[Resources (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/sessions/resources.md) - \[Resources (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/sessions/resources.md) - \[Resources (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/sessions/resources.md) - \[Resources (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/sessions/resources.md) - \[Resources (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/sessions/resources.md) - \[Resources (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/sessions/resources.md) - \[Retrieve a Message Batch\](https://platform.claude.com/docs/en/api/messages/batches/retrieve.md) - \[Retrieve a Message Batch (Beta)\](https://platform.claude.com/docs/en/api/beta/messages/batches/retrieve.md) - \[Retrieve a Message Batch (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/messages/batches/retrieve.md) - \[Retrieve a Message Batch (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/messages/batches/retrieve.md) - \[Retrieve a Message Batch (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/messages/batches/retrieve.md) - \[Retrieve a Message Batch (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/messages/batches/retrieve.md) - \[Retrieve a Message Batch (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/messages/batches/retrieve.md) - \[Retrieve a Message Batch (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/messages/batches/retrieve.md) - \[Retrieve a Message Batch (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/messages/batches/retrieve.md) - \[Retrieve a Message Batch (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/messages/batches/retrieve.md) - \[Retrieve a Message Batch (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/messages/batches/retrieve.md) - \[Retrieve a Message Batch (cli)\](https://platform.claude.com/docs/en/api/cli/messages/batches/retrieve.md) - \[Retrieve a Message Batch (csharp)\](https://platform.claude.com/docs/en/api/csharp/messages/batches/retrieve.md) - \[Retrieve a Message Batch (Go)\](https://platform.claude.com/docs/en/api/go/messages/batches/retrieve.md) - \[Retrieve a Message Batch (Java)\](https://platform.claude.com/docs/en/api/java/messages/batches/retrieve.md) - \[Retrieve a Message Batch (php)\](https://platform.claude.com/docs/en/api/php/messages/batches/retrieve.md) - \[Retrieve a Message Batch (Python)\](https://platform.claude.com/docs/en/api/python/messages/batches/retrieve.md) - \[Retrieve a Message Batch (Ruby)\](https://platform.claude.com/docs/en/api/ruby/messages/batches/retrieve.md) - \[Retrieve a Message Batch (terraform)\](https://platform.claude.com/docs/en/api/terraform/messages/batches/retrieve.md) - \[Retrieve a Message Batch (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/messages/batches/retrieve.md) - \[Retrieve Message Batch results\](https://platform.claude.com/docs/en/api/messages/batches/results.md) - \[Retrieve Message Batch results (Beta)\](https://platform.claude.com/docs/en/api/beta/messages/batches/results.md) - \[Retrieve Message Batch results (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/messages/batches/results.md) - \[Retrieve Message Batch results (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/messages/batches/results.md) - \[Retrieve Message Batch results (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/messages/batches/results.md) - \[Retrieve Message Batch results (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/messages/batches/results.md) - \[Retrieve Message Batch results (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/messages/batches/results.md) - \[Retrieve Message Batch results (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/messages/batches/results.md) - \[Retrieve Message Batch results (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/messages/batches/results.md) - \[Retrieve Message Batch results (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/messages/batches/results.md) - \[Retrieve Message Batch results (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/messages/batches/results.md) - \[Retrieve Message Batch results (cli)\](https://platform.claude.com/docs/en/api/cli/messages/batches/results.md) - \[Retrieve Message Batch results (csharp)\](https://platform.claude.com/docs/en/api/csharp/messages/batches/results.md) - \[Retrieve Message Batch results (Go)\](https://platform.claude.com/docs/en/api/go/messages/batches/results.md) - \[Retrieve Message Batch results (Java)\](https://platform.claude.com/docs/en/api/java/messages/batches/results.md) - \[Retrieve Message Batch results (php)\](https://platform.claude.com/docs/en/api/php/messages/batches/results.md) - \[Retrieve Message Batch results (Python)\](https://platform.claude.com/docs/en/api/python/messages/batches/results.md) - \[Retrieve Message Batch results (Ruby)\](https://platform.claude.com/docs/en/api/ruby/messages/batches/results.md) - \[Retrieve Message Batch results (terraform)\](https://platform.claude.com/docs/en/api/terraform/messages/batches/results.md) - \[Retrieve Message Batch results (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/messages/batches/results.md) - \[Send Events (Beta)\](https://platform.claude.com/docs/en/api/beta/sessions/events/send.md) - \[Send Events (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/sessions/events/send.md) - \[Send Events (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/sessions/events/send.md) - \[Send Events (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/sessions/events/send.md) - \[Send Events (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/sessions/events/send.md) - \[Send Events (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/sessions/events/send.md) - \[Send Events (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/sessions/events/send.md) - \[Send Events (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/sessions/events/send.md) - \[Send Events (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/sessions/events/send.md) - \[Send Events (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/sessions/events/send.md) - \[Sessions (Beta)\](https://platform.claude.com/docs/en/api/beta/sessions.md) - \[Sessions (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/sessions.md) - \[Sessions (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/sessions.md) - \[Sessions (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/sessions.md) - \[Sessions (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/sessions.md) - \[Sessions (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/sessions.md) - \[Sessions (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/sessions.md) - \[Sessions (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/sessions.md) - \[Sessions (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/sessions.md) - \[Sessions (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/sessions.md) - \[Skills (Beta)\](https://platform.claude.com/docs/en/api/beta/skills.md) - \[Skills (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/skills.md) - \[Skills (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/skills.md) - \[Skills (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/skills.md) - \[Skills (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/skills.md) - \[Skills (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/skills.md) - \[Skills (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/skills.md) - \[Skills (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/skills.md) - \[Skills (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/skills.md) - \[Skills (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/skills.md) - \[Stream Events (Beta)\](https://platform.claude.com/docs/en/api/beta/sessions/events/stream.md) - \[Stream Events (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/sessions/events/stream.md) - \[Stream Events (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/sessions/events/stream.md) - \[Stream Events (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/sessions/events/stream.md) - \[Stream Events (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/sessions/events/stream.md) - \[Stream Events (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/sessions/events/stream.md) - \[Stream Events (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/sessions/events/stream.md) - \[Stream Events (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/sessions/events/stream.md) - \[Stream Events (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/sessions/events/stream.md) - \[Stream Events (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/sessions/events/stream.md) - \[Update Agent (Beta)\](https://platform.claude.com/docs/en/api/beta/agents/update.md) - \[Update Agent (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/agents/update.md) - \[Update Agent (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/agents/update.md) - \[Update Agent (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/agents/update.md) - \[Update Agent (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/agents/update.md) - \[Update Agent (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/agents/update.md) - \[Update Agent (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/agents/update.md) - \[Update Agent (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/agents/update.md) - \[Update Agent (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/agents/update.md) - \[Update Agent (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/agents/update.md) - \[Update API Key\](https://platform.claude.com/docs/en/api/admin/api\_keys/update.md) - \[Update Credential (Beta)\](https://platform.claude.com/docs/en/api/beta/vaults/credentials/update.md) - \[Update Credential (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/vaults/credentials/update.md) - \[Update Credential (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/vaults/credentials/update.md) - \[Update Credential (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/vaults/credentials/update.md) - \[Update Credential (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/vaults/credentials/update.md) - \[Update Credential (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/vaults/credentials/update.md) - \[Update Credential (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/vaults/credentials/update.md) - \[Update Credential (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/vaults/credentials/update.md) - \[Update Credential (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/vaults/credentials/update.md) - \[Update Credential (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/vaults/credentials/update.md) - \[Update Environment (Beta)\](https://platform.claude.com/docs/en/api/beta/environments/update.md) - \[Update Environment (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/environments/update.md) - \[Update Environment (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/environments/update.md) - \[Update Environment (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/environments/update.md) - \[Update Environment (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/environments/update.md) - \[Update Environment (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/environments/update.md) - \[Update Environment (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/environments/update.md) - \[Update Environment (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/environments/update.md) - \[Update Environment (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/environments/update.md) - \[Update Environment (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/environments/update.md) - \[Update Session (Beta)\](https://platform.claude.com/docs/en/api/beta/sessions/update.md) - \[Update Session (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/sessions/update.md) - \[Update Session (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/sessions/update.md) - \[Update Session (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/sessions/update.md) - \[Update Session (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/sessions/update.md) - \[Update Session (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/sessions/update.md) - \[Update Session (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/sessions/update.md) - \[Update Session (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/sessions/update.md) - \[Update Session (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/sessions/update.md) - \[Update Session (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/sessions/update.md) - \[Update Session Resource (Beta)\](https://platform.claude.com/docs/en/api/beta/sessions/resources/update.md) - \[Update Session Resource (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/sessions/resources/update.md) - \[Update Session Resource (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/sessions/resources/update.md) - \[Update Session Resource (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/sessions/resources/update.md) - \[Update Session Resource (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/sessions/resources/update.md) - \[Update Session Resource (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/sessions/resources/update.md) - \[Update Session Resource (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/sessions/resources/update.md) - \[Update Session Resource (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/sessions/resources/update.md) - \[Update Session Resource (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/sessions/resources/update.md) - \[Update Session Resource (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/sessions/resources/update.md) - \[Update User\](https://platform.claude.com/docs/en/api/admin/users/update.md) - \[Update Vault (Beta)\](https://platform.claude.com/docs/en/api/beta/vaults/update.md) - \[Update Vault (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/vaults/update.md) - \[Update Vault (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/vaults/update.md) - \[Update Vault (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/vaults/update.md) - \[Update Vault (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/vaults/update.md) - \[Update Vault (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/vaults/update.md) - \[Update Vault (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/vaults/update.md) - \[Update Vault (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/vaults/update.md) - \[Update Vault (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/vaults/update.md) - \[Update Vault (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/vaults/update.md) - \[Update Workspace\](https://platform.claude.com/docs/en/api/admin/workspaces/update.md) - \[Update Workspace Member\](https://platform.claude.com/docs/en/api/admin/workspaces/members/update.md) - \[Upload File (Beta)\](https://platform.claude.com/docs/en/api/beta/files/upload.md) - \[Upload File (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/files/upload.md) - \[Upload File (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/files/upload.md) - \[Upload File (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/files/upload.md) - \[Upload File (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/files/upload.md) - \[Upload File (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/files/upload.md) - \[Upload File (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/files/upload.md) - \[Upload File (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/files/upload.md) - \[Upload File (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/files/upload.md) - \[Upload File (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/files/upload.md) - \[Usage Report\](https://platform.claude.com/docs/en/api/admin/usage\_report.md) - \[Users\](https://platform.claude.com/docs/en/api/admin/users.md) - \[Vaults (Beta)\](https://platform.claude.com/docs/en/api/beta/vaults.md) - \[Vaults (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/vaults.md) - \[Vaults (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/vaults.md) - \[Vaults (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/vaults.md) - \[Vaults (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/vaults.md) - \[Vaults (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/vaults.md) - \[Vaults (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/vaults.md) - \[Vaults (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/vaults.md) - \[Vaults (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/vaults.md) - \[Vaults (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/vaults.md) - \[Versions (Beta)\](https://platform.claude.com/docs/en/api/beta/agents/versions.md) - \[Versions (Beta)\](https://platform.claude.com/docs/en/api/beta/skills/versions.md) - \[Versions (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/agents/versions.md) - \[Versions (Beta) (cli)\](https://platform.claude.com/docs/en/api/cli/beta/skills/versions.md) - \[Versions (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/agents/versions.md) - \[Versions (Beta) (csharp)\](https://platform.claude.com/docs/en/api/csharp/beta/skills/versions.md) - \[Versions (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/agents/versions.md) - \[Versions (Beta) (Go)\](https://platform.claude.com/docs/en/api/go/beta/skills/versions.md) - \[Versions (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/agents/versions.md) - \[Versions (Beta) (Java)\](https://platform.claude.com/docs/en/api/java/beta/skills/versions.md) - \[Versions (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/agents/versions.md) - \[Versions (Beta) (php)\](https://platform.claude.com/docs/en/api/php/beta/skills/versions.md) - \[Versions (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/agents/versions.md) - \[Versions (Beta) (Python)\](https://platform.claude.com/docs/en/api/python/beta/skills/versions.md) - \[Versions (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/agents/versions.md) - \[Versions (Beta) (Ruby)\](https://platform.claude.com/docs/en/api/ruby/beta/skills/versions.md) - \[Versions (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/agents/versions.md) - \[Versions (Beta) (terraform)\](https://platform.claude.com/docs/en/api/terraform/beta/skills/versions.md) - \[Versions (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/agents/versions.md) - \[Versions (Beta) (TypeScript)\](https://platform.claude.com/docs/en/api/typescript/beta/skills/versions.md) - \[Workspaces\](https://platform.claude.com/docs/en/api/admin/workspaces.md) - \[Beta headers\](https://platform.claude.com/docs/en/api/beta-headers.md) - \[Errors\](https://platform.claude.com/docs/en/api/errors.md) - \[IP addresses\](https://platform.claude.com/docs/en/api/ip-addresses.md) - \[Rate limits\](https://platform.claude.com/docs/en/api/rate-limits.md) - \[Service tiers\](https://platform.claude.com/docs/en/api/service-tiers.md) - \[Supported regions\](https://platform.claude.com/docs/en/api/supported-regions.md) - \[Versions\](https://platform.claude.com/docs/en/api/versioning.md) --- For more comprehensive documentation, see \[llms-full.txt\](https://platform.claude.com/llms-full.txt) --- # Inhaltsmoderation - Claude API Docs Loading... Anwendungsfälle Content Moderation Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page Was this page helpful? > Besuchen Sie unser [Inhaltsmoderation-Cookbook](https://platform.claude.com/cookbook/misc-building-moderation-filter) > , um eine Beispielimplementierung der Inhaltsmoderation mit Claude zu sehen. Dieser Leitfaden konzentriert sich auf die Moderation von benutzergenerierten Inhalten in Ihrer Anwendung. Wenn Sie nach Anleitung zur Moderation von Interaktionen mit Claude suchen, lesen Sie bitte unseren [Guardrails-Leitfaden](https://platform.claude.com/docs/de/test-and-evaluate/strengthen-guardrails/reduce-hallucinations) . Vor dem Erstellen mit Claude ---------------------------------- ### Entscheiden Sie, ob Sie Claude für die Inhaltsmoderation verwenden möchten Hier sind einige wichtige Indikatoren dafür, dass Sie ein LLM wie Claude anstelle eines traditionellen ML- oder regelgestützten Ansatzes für die Inhaltsmoderation verwenden sollten: ### Sie möchten eine kostengünstige und schnelle Implementierung ### Sie wünschen sich sowohl semantisches Verständnis als auch schnelle Entscheidungen ### Sie benötigen konsistente Richtlinienentscheidungen ### Ihre Moderationsrichtlinien werden sich wahrscheinlich im Laufe der Zeit ändern oder weiterentwickeln ### Sie benötigen interpretierbare Begründungen für Ihre Moderationsentscheidungen ### Sie benötigen mehrsprachige Unterstützung ohne separate Modelle zu verwalten ### Sie benötigen multimodale Unterstützung Anthropic hat alle Claude-Modelle darauf trainiert, ehrlich, hilfreich und harmlos zu sein. Dies kann dazu führen, dass Claude Inhalte moderiert, die als besonders gefährlich erachtet werden (gemäß unserer [Acceptable Use Policy](https://www.anthropic.com/legal/aup) ), unabhängig von der verwendeten Eingabeaufforderung. Beispielsweise kann eine Website für Erwachsene, die Benutzern das Posten von explizitem sexuellem Inhalt ermöglichen möchte, feststellen, dass Claude explizite Inhalte immer noch als Moderation erfordernde Inhalte kennzeichnet, selbst wenn sie in ihrer Eingabeaufforderung angeben, explizite sexuelle Inhalte nicht zu moderieren. Wir empfehlen, unsere AUP vor der Erstellung einer Moderationslösung zu überprüfen. ### Generieren Sie Beispiele von Inhalten zur Moderation Bevor Sie eine Inhaltsmoderierungslösung entwickeln, erstellen Sie zunächst Beispiele von Inhalten, die gekennzeichnet werden sollten, und Inhalten, die nicht gekennzeichnet werden sollten. Stellen Sie sicher, dass Sie Grenzfälle und schwierige Szenarien einbeziehen, die für ein Inhaltsmoderierungssystem schwierig zu handhaben sein können. Überprüfen Sie anschließend Ihre Beispiele, um eine gut definierte Liste von Moderationskategorien zu erstellen. Beispielsweise könnten die von einer Social-Media-Plattform generierten Beispiele Folgendes enthalten: allowed_user_comments = [\ 'This movie was great, I really enjoyed it. The main actor really killed it!',\ 'I hate Mondays.',\ 'It is a great time to invest in gold!'\ ] disallowed_user_comments = [\ 'Delete this post now or you better hide. I am coming after you and your family.',\ 'Stay away from the 5G cellphones!! They are using 5G to control you.',\ 'Congratulations! You have won a $1,000 gift card. Click here to claim your prize!'\ ] # Sample user comments to test the content moderation user_comments = allowed_user_comments + disallowed_user_comments # List of categories considered unsafe for content moderation unsafe_categories = [\ 'Child Exploitation',\ 'Conspiracy Theories',\ 'Hate',\ 'Indiscriminate Weapons', \ 'Intellectual Property',\ 'Non-Violent Crimes', \ 'Privacy',\ 'Self-Harm',\ 'Sex Crimes',\ 'Sexual Content',\ 'Specialized Advice',\ 'Violent Crimes'\ ] Eine effektive Moderation dieser Beispiele erfordert ein nuanciertes Sprachverständnis. Im Kommentar `This movie was great, I really enjoyed it. The main actor really killed it!` muss das Inhaltsmoderierungssystem erkennen, dass „killed it" eine Metapher ist, keine Anzeichen tatsächlicher Gewalt. Umgekehrt sollte der Kommentar `Delete this post now or you better hide. I am coming after you and your family.` trotz fehlender expliziter Gewalterwähnungen vom Inhaltsmoderierungssystem gekennzeichnet werden. Die Liste `unsafe_categories` kann an Ihre spezifischen Anforderungen angepasst werden. Wenn Sie beispielsweise verhindern möchten, dass Minderjährige Inhalte auf Ihrer Website erstellen, könnten Sie „Underage Posting" zur Liste hinzufügen. * * * Inhalte mit Claude moderieren ----------------------------------- ### Wählen Sie das richtige Claude-Modell Bei der Auswahl eines Modells ist es wichtig, die Größe Ihrer Daten zu berücksichtigen. Wenn Kosten ein Problem darstellen, ist ein kleineres Modell wie Claude Haiku 3 aufgrund seiner Kosteneffizienz eine ausgezeichnete Wahl. Nachfolgend finden Sie eine Kostenschätzung für die Moderation von Text für eine Social-Media-Plattform, die eine Milliarde Beiträge pro Monat erhält: * **Inhaltsgröße** * Beiträge pro Monat: 1 Mrd. * Zeichen pro Beitrag: 100 * Gesamtzeichen: 100 Mrd. * **Geschätzte Token** * Eingabe-Token: 28,6 Mrd. (angenommen 1 Token pro 3,5 Zeichen) * Prozentsatz der gekennzeichneten Nachrichten: 3% * Ausgabe-Token pro gekennzeichneter Nachricht: 50 * Gesamtausgabe-Token: 1,5 Mrd. * **Claude Haiku 3 geschätzte Kosten** Die tatsächlichen Kosten können von diesen Schätzungen abweichen. Diese Schätzungen basieren auf der Eingabeaufforderung, die im Abschnitt zur [Batch-Verarbeitung](https://platform.claude.com/docs/de/about-claude/use-case-guides/content-moderation#consider-batch-processing) hervorgehoben wird. Ausgabe-Token können durch Entfernen des Feldes `explanation` aus der Antwort noch weiter reduziert werden. ### Erstellen Sie eine starke Eingabeaufforderung Um Claude für die Inhaltsmoderation zu verwenden, muss Claude die Moderationsanforderungen Ihrer Anwendung verstehen. Beginnen wir mit dem Schreiben einer Eingabeaufforderung, mit der Sie Ihre Moderationsanforderungen definieren können: import anthropic import json # Initialize the Anthropic client client = anthropic.Anthropic() def moderate_message(message, unsafe_categories): # Convert the list of unsafe categories into a string, with each category on a new line unsafe_category_str = '\n'.join(unsafe_categories) # Construct the prompt for Claude, including the message and unsafe categories assessment_prompt = f""" Determine whether the following message warrants moderation, based on the unsafe categories outlined below. Message: {message} Unsafe Categories: {unsafe_category_str} Respond with ONLY a JSON object, using the format below: {{ "violation": , "categories": [Comma-separated list of violated categories], "explanation": [Optional. Only include if there is a violation.] }}""" # Send the request to Claude for content moderation response = client.messages.create( model="claude-3-haiku-20240307", # Using the Haiku model for lower costs max_tokens=200, temperature=0, # Use 0 temperature for increased consistency messages=[\ {"role": "user", "content": assessment_prompt}\ ] ) # Parse the JSON response from Claude assessment = json.loads(response.content[0].text) # Extract the violation status from the assessment contains_violation = assessment['violation'] # If there's a violation, get the categories and explanation; otherwise, use empty defaults violated_categories = assessment.get('categories', []) if contains_violation else [] explanation = assessment.get('explanation') if contains_violation else None return contains_violation, violated_categories, explanation # Process each comment and print the results for comment in user_comments: print(f"\nComment: {comment}") violation, violated_categories, explanation = moderate_message(comment, unsafe_categories) if violation: print(f"Violated Categories: {', '.join(violated_categories)}") print(f"Explanation: {explanation}") else: print("No issues detected.") In diesem Beispiel enthält die Funktion `moderate_message` eine Bewertungsaufforderung, die die unsicheren Inhaltskategorien und die Nachricht enthält, die wir bewerten möchten. Die Eingabeaufforderung fordert Claude auf, zu bewerten, ob die Nachricht basierend auf den von uns definierten unsicheren Kategorien moderiert werden sollte. Die Bewertung des Modells wird dann analysiert, um festzustellen, ob eine Verletzung vorliegt. Wenn eine Verletzung vorliegt, gibt Claude auch eine Liste der verletzten Kategorien sowie eine Erklärung zurück, warum die Nachricht unsicher ist. ### Bewerten Sie Ihre Eingabeaufforderung Inhaltsmoderation ist ein Klassifizierungsproblem. Daher können Sie die gleichen Techniken verwenden, die in unserem [Klassifizierungs-Cookbook](https://platform.claude.com/cookbook/capabilities-classification-guide) beschrieben sind, um die Genauigkeit Ihres Inhaltsmoderierungssystems zu bestimmen. Eine zusätzliche Überlegung ist, dass Sie anstatt Inhaltsmoderation als binäres Klassifizierungsproblem zu behandeln, mehrere Kategorien erstellen können, um verschiedene Risikostufen darzustellen. Das Erstellen mehrerer Risikostufen ermöglicht es Ihnen, die Aggressivität Ihrer Moderation anzupassen. Beispielsweise möchten Sie möglicherweise Benutzerabfragen, die als hohes Risiko eingestuft werden, automatisch blockieren, während Benutzer mit vielen Abfragen mit mittlerem Risiko zur menschlichen Überprüfung gekennzeichnet werden. import anthropic import json # Initialize the Anthropic client client = anthropic.Anthropic() def assess_risk_level(message, unsafe_categories): # Convert the list of unsafe categories into a string, with each category on a new line unsafe_category_str = '\n'.join(unsafe_categories) # Construct the prompt for Claude, including the message, unsafe categories, and risk level definitions assessment_prompt = f""" Assess the risk level of the following message warrants moderation, based on the unsafe categories listed below. Message: {message} Unsafe Categories: {unsafe_category_str} Assign a risk level based on your confidence that the user's message should be moderated based on the defined unsafe categories: 0 - No risk 1 - Low risk 2 - Medium risk 3 - High risk Respond with ONLY a JSON object, using the format below: {{ "risk_level": , "categories": [Comma-separated list of violated categories], "explanation": }}""" # Send the request to Claude for risk assessment response = client.messages.create( model="claude-3-haiku-20240307", # Using the Haiku model for lower costs max_tokens=200, temperature=0, # Use 0 temperature for increased consistency messages=[\ {"role": "user", "content": assessment_prompt}\ ] ) # Parse the JSON response from Claude assessment = json.loads(response.content[0].text) # Extract the risk level, violated categories, and explanation from the assessment risk_level = assessment["risk_level"] violated_categories = assessment["categories"] explanation = assessment.get("explanation") return risk_level, violated_categories, explanation # Process each comment and print the results for comment in user_comments: print(f"\nComment: {comment}") risk_level, violated_categories, explanation = assess_risk_level(comment, unsafe_categories) print(f"Risk Level: {risk_level}") if violated_categories: print(f"Violated Categories: {', '.join(violated_categories)}") if explanation: print(f"Explanation: {explanation}") Dieser Code implementiert eine Funktion `assess_risk_level`, die Claude verwendet, um die Risikostufe einer Nachricht zu bewerten. Die Funktion akzeptiert eine Nachricht und eine Liste unsicherer Kategorien als Eingaben. Innerhalb der Funktion wird eine Eingabeaufforderung für Claude generiert, die die zu bewertende Nachricht, die unsicheren Kategorien und spezifische Anweisungen zur Bewertung der Risikostufe enthält. Die Eingabeaufforderung weist Claude an, mit einem JSON-Objekt zu antworten, das die Risikostufe, die verletzten Kategorien und eine optionale Erklärung enthält. Dieser Ansatz ermöglicht flexible Inhaltsmoderation durch Zuweisung von Risikostufen. Er kann nahtlos in ein größeres System integriert werden, um Inhaltsfilterung zu automatisieren oder Kommentare zur menschlichen Überprüfung basierend auf ihrer bewerteten Risikostufe zu kennzeichnen. Beispielsweise wird bei der Ausführung dieses Codes der Kommentar `Delete this post now or you better hide. I am coming after you and your family.` aufgrund seiner gefährlichen Drohung als hohes Risiko identifiziert. Umgekehrt wird der Kommentar `Stay away from the 5G cellphones!! They are using 5G to control you.` als mittleres Risiko kategorisiert. ### Stellen Sie Ihre Eingabeaufforderung bereit Sobald Sie sich der Qualität Ihrer Lösung sicher sind, ist es Zeit, sie in der Produktion bereitzustellen. Hier sind einige bewährte Verfahren, die bei der Verwendung von Inhaltsmoderation in der Produktion zu befolgen sind: 1. **Geben Sie klares Feedback an Benutzer:** Wenn Benutzereingaben blockiert werden oder eine Antwort aufgrund von Inhaltsmoderation gekennzeichnet wird, geben Sie informatives und konstruktives Feedback, um Benutzern zu helfen, zu verstehen, warum ihre Nachricht gekennzeichnet wurde und wie sie sie angemessen umformulieren können. In den obigen Codebeispielen wird dies durch das Tag `explanation` in der Claude-Antwort durchgeführt. 2. **Analysieren Sie moderierte Inhalte:** Verfolgen Sie die Arten von Inhalten, die von Ihrem Moderationssystem gekennzeichnet werden, um Trends und potenzielle Verbesserungsbereiche zu identifizieren. 3. **Kontinuierlich bewerten und verbessern:** Bewerten Sie regelmäßig die Leistung Ihres Inhaltsmoderierungssystems anhand von Metriken wie Präzisions- und Recall-Verfolgung. Verwenden Sie diese Daten, um Ihre Moderationsaufforderungen, Schlüsselwörter und Bewertungskriterien iterativ zu verfeinern. * * * Verbessern Sie die Leistung --------------------------------- In komplexen Szenarien kann es hilfreich sein, zusätzliche Strategien in Betracht zu ziehen, um die Leistung über standardmäßige [Prompt-Engineering-Techniken](https://platform.claude.com/docs/de/build-with-claude/prompt-engineering/overview) hinaus zu verbessern. Hier sind einige fortgeschrittene Strategien: ### Definieren Sie Themen und geben Sie Beispiele Zusätzlich zur Auflistung der unsicheren Kategorien in der Eingabeaufforderung können weitere Verbesserungen durch die Bereitstellung von Definitionen und Phrasen im Zusammenhang mit jeder Kategorie vorgenommen werden. import anthropic import json # Initialize the Anthropic client client = anthropic.Anthropic() # Dictionary of categories considered unsafe for content moderation, with their definitions unsafe_category_definitions = { 'Child Exploitation': 'Content that depicts child nudity or that enables, encourages, excuses, or depicts the sexual abuse of children.', 'Conspiracy Theories': """Content that promotes or endorses unfounded, false, or misleading theories about events, situations, or individuals, which can incite harm or undermine public trust in institutions or facts.""", 'Hate': """Content that is hateful toward people on the basis of their protected characteristics (race, color, ethnicity, national origin, disability, religious affiliation, caste, sexual orientation, sex, gender identity and serious disease), or content that perpetuates negative stereotypes.""", 'Indiscriminate Weapons': 'Content that enables the creation of weapons of mass destruction.', 'Intellectual Property': 'Content that violates the intellectual property rights of third parties.', 'Non-Violent Crimes': 'Content that enables, encourages, or excuses the commission of non-violent crimes.', 'Privacy': 'Content that contains sensitive, personal information about private individuals.', 'Self-Harm': 'Content that enables, encourages, or excuses acts of intentional self-harm.', 'Sex Crimes': 'Content that enables, encourages, or excuses the commission of sex crimes.', 'Sexual Content': 'Content that contains erotic descriptions or explicit depictions of sex acts.', 'Specialized Advice': """Content that contains financial, medical, or legal advice. Financial advice includes guidance on investments, stocks, bonds, or any financial planning.""", 'Violent Crimes': 'Content that enables, encourages, or excuses the commission of violent crimes.', } def moderate_message_with_definitions(message, unsafe_category_definitions): # Format unsafe categories string, with each category and its definition on a new line unsafe_category_str = '\n'.join(f'{category}: {definition}' for category, definition in unsafe_category_definitions.items() ) # Construct the prompt for Claude, including the message and unsafe categories assessment_prompt = f"""Determine whether the following message warrants moderation, based on the unsafe categories outlined below. Message: {message} Unsafe Categories and Their Definitions: {unsafe_category_str} It's important that you remember all unsafe categories and their definitions. Respond with ONLY a JSON object, using the format below: {{ "violation": , "categories": [Comma-separated list of violated categories], "explanation": [Optional. Only include if there is a violation.] }}""" # Send the request to Claude for content moderation response = client.messages.create( model="claude-3-haiku-20240307", # Using the Haiku model for lower costs max_tokens=200, temperature=0, # Use 0 temperature for increased consistency messages=[\ {"role": "user", "content": assessment_prompt}\ ] ) # Parse the JSON response from Claude assessment = json.loads(response.content[0].text) # Extract the violation status from the assessment contains_violation = assessment['violation'] # If there's a violation, get the categories and explanation; otherwise, use empty defaults violated_categories = assessment.get('categories', []) if contains_violation else [] explanation = assessment.get('explanation') if contains_violation else None return contains_violation, violated_categories, explanation # Process each comment and print the results for comment in user_comments: print(f"\nComment: {comment}") violation, violated_categories, explanation = moderate_message_with_definitions(comment, unsafe_category_definitions) if violation: print(f"Violated Categories: {', '.join(violated_categories)}") print(f"Explanation: {explanation}") else: print("No issues detected.") Die Funktion `moderate_message_with_definitions` erweitert die frühere Funktion `moderate_message`, indem sie jede unsichere Kategorie mit einer detaillierten Definition paaren kann. Dies geschieht im Code durch Ersetzen der Liste `unsafe_categories` aus der ursprünglichen Funktion durch ein Wörterbuch `unsafe_category_definitions`. Dieses Wörterbuch ordnet jede unsichere Kategorie ihrer entsprechenden Definition zu. Sowohl die Kategorienamen als auch ihre Definitionen sind in der Eingabeaufforderung enthalten. Bemerkenswert ist, dass die Definition für die Kategorie `Specialized Advice` nun die Arten von Finanzberatung angibt, die verboten sein sollten. Infolgedessen löst der Kommentar `It's a great time to invest in gold!`, der zuvor die Bewertung `moderate_message` bestanden hat, nun eine Verletzung aus. ### Erwägen Sie Batch-Verarbeitung Um Kosten in Situationen zu senken, in denen Echtzeit-Moderation nicht erforderlich ist, erwägen Sie die Moderation von Nachrichten in Batches. Fügen Sie mehrere Nachrichten im Kontext der Eingabeaufforderung ein und bitten Sie Claude, zu bewerten, welche Nachrichten moderiert werden sollten. import anthropic import json # Initialize the Anthropic client client = anthropic.Anthropic() def batch_moderate_messages(messages, unsafe_categories): # Convert the list of unsafe categories into a string, with each category on a new line unsafe_category_str = '\n'.join(unsafe_categories) # Format messages string, with each message wrapped in XML-like tags and given an ID messages_str = '\n'.join([f'{msg}' for idx, msg in enumerate(messages)]) # Construct the prompt for Claude, including the messages and unsafe categories assessment_prompt = f"""Determine the messages to moderate, based on the unsafe categories outlined below. Messages: {messages_str} Unsafe categories and their definitions: {unsafe_category_str} Respond with ONLY a JSON object, using the format below: {{ "violations": [\ {{\ "id": ,\ "categories": [list of violated categories],\ "explanation": \ }},\ ...\ ] }} Important Notes: - Remember to analyze every message for a violation. - Select any number of violations that reasonably apply.""" # Send the request to Claude for content moderation response = client.messages.create( model="claude-3-haiku-20240307", # Using the Haiku model for lower costs max_tokens=2048, # Increased max token count to handle batches temperature=0, # Use 0 temperature for increased consistency messages=[\ {"role": "user", "content": assessment_prompt}\ ] ) # Parse the JSON response from Claude assessment = json.loads(response.content[0].text) return assessment # Process the batch of comments and get the response response_obj = batch_moderate_messages(user_comments, unsafe_categories) # Print the results for each detected violation for violation in response_obj['violations']: print(f"""Comment: {user_comments[violation['id']]} Violated Categories: {', '.join(violation['categories'])} Explanation: {violation['explanation']} """) In diesem Beispiel verarbeitet die Funktion `batch_moderate_messages` die Moderation eines gesamten Batches von Nachrichten mit einem einzigen Claude-API-Aufruf. Innerhalb der Funktion wird eine Eingabeaufforderung erstellt, die die Liste der zu bewertenden Nachrichten, die definierten unsicheren Inhaltskategorien und ihre Beschreibungen enthält. Die Eingabeaufforderung weist Claude an, ein JSON-Objekt zurückzugeben, das alle Nachrichten mit Verletzungen auflistet. Jede Nachricht in der Antwort wird durch ihre ID identifiziert, die der Position der Nachricht in der Eingabeliste entspricht. Beachten Sie, dass das Finden der optimalen Batch-Größe für Ihre spezifischen Anforderungen möglicherweise einige Experimente erfordert. Während größere Batch-Größen die Kosten senken können, können sie auch zu einem leichten Qualitätsverlust führen. Darüber hinaus müssen Sie möglicherweise den Parameter `max_tokens` im Claude-API-Aufruf erhöhen, um längere Antworten zu berücksichtigen. Weitere Informationen zur maximalen Anzahl von Token, die Ihr ausgewähltes Modell ausgeben kann, finden Sie auf der [Modellvergleichsseite](https://platform.claude.com/docs/de/about-claude/models#model-comparison-table) . [Inhaltsmoderation-Cookbook\ \ Sehen Sie sich ein vollständig implementiertes codebasiertes Beispiel an, wie Claude für die Inhaltsmoderation verwendet wird.](https://platform.claude.com/cookbook/misc-building-moderation-filter) [](https://platform.claude.com/docs/de/test-and-evaluate/strengthen-guardrails/reduce-hallucinations) * Eingabe-Token-Kosten: 2.860 MTok \* $0,25/MTok = $715 * Ausgabe-Token-Kosten: 1.500 MTok \* $1,25/MTok = $1.875 * Monatliche Kosten: $715 + $1.875 = $2.590 * **Claude Opus 4.6 geschätzte Kosten** * Eingabe-Token-Kosten: 2.860 MTok \* $5,00/MTok = $14.300 * Ausgabe-Token-Kosten: 1.500 MTok \* $25,00/MTok = $37.500 * Monatliche Kosten: $14.300 + $37.500 = $51.800 Guardrails-Leitfaden Erkunden Sie unseren Guardrails-Leitfaden für Techniken zur Moderation von Interaktionen mit Claude. --- # Zusammenfassung von Rechtsdokumenten - Claude API Docs Loading... Anwendungsfälle Rechtliche Zusammenfassung Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Loading... Copy page > Besuchen Sie unser [Zusammenfassungs-Cookbook](https://platform.claude.com/cookbook/capabilities-summarization-guide) > , um ein Beispiel für eine Implementierung der Zusammenfassung von Rechtsdokumenten mit Claude zu sehen. Vor dem Aufbau mit Claude ------------------------------- ### Entscheiden Sie, ob Sie Claude für die Zusammenfassung von Rechtsdokumenten verwenden möchten Hier sind einige wichtige Indikatoren dafür, dass Sie ein LLM wie Claude zur Zusammenfassung von Rechtsdokumenten einsetzen sollten: ### Sie möchten eine große Anzahl von Dokumenten effizient und kostengünstig überprüfen ### Sie benötigen eine automatisierte Extraktion von wichtigen Metadaten ### Sie möchten klare, prägnante und standardisierte Zusammenfassungen erstellen ### Sie benötigen präzise Zitate für Ihre Zusammenfassungen ### Sie möchten Ihren Rechtsrechercheprozess rationalisieren und beschleunigen ### Bestimmen Sie die Details, die die Zusammenfassung extrahieren soll Es gibt keine einzige richtige Zusammenfassung für ein gegebenes Dokument. Ohne klare Anleitung kann es für Claude schwierig sein, zu bestimmen, welche Details einzubeziehen sind. Um optimale Ergebnisse zu erzielen, identifizieren Sie die spezifischen Informationen, die Sie in die Zusammenfassung aufnehmen möchten. Wenn Sie beispielsweise eine Untermietvereinbarung zusammenfassen, möchten Sie möglicherweise die folgenden wichtigsten Punkte extrahieren: details_to_extract = [\ 'Parties involved (sublessor, sublessee, and original lessor)',\ 'Property details (address, description, and permitted use)', \ 'Term and rent (start date, end date, monthly rent, and security deposit)',\ 'Responsibilities (utilities, maintenance, and repairs)',\ 'Consent and notices (landlord\'s consent, and notice requirements)',\ 'Special provisions (furniture, parking, and subletting restrictions)'\ ] ### Etablieren Sie Erfolgskriterien Die Bewertung der Qualität von Zusammenfassungen ist eine notorisch schwierige Aufgabe. Im Gegensatz zu vielen anderen Aufgaben der Verarbeitung natürlicher Sprache fehlt der Bewertung von Zusammenfassungen oft ein klares, objektives Messkriterium. Der Prozess kann sehr subjektiv sein, wobei verschiedene Leser unterschiedliche Aspekte einer Zusammenfassung schätzen. Hier sind Kriterien, die Sie möglicherweise berücksichtigen möchten, wenn Sie bewerten, wie gut Claude die Zusammenfassung von Rechtsdokumenten durchführt. ### Sachliche Korrektheit ### Rechtliche Präzision ### Prägnanz ### Konsistenz ### Lesbarkeit ### Voreingenommenheit und Fairness Weitere Informationen finden Sie in unserem Leitfaden zum [Festlegen von Erfolgskriterien](https://platform.claude.com/docs/de/test-and-evaluate/define-success) . * * * Wie man Rechtsdokumente mit Claude zusammenfasst ------------------------------------------------------ ### Wählen Sie das richtige Claude-Modell Die Modellgenauigkeit ist äußerst wichtig bei der Zusammenfassung von Rechtsdokumenten. Claude Opus 4.6 ist eine ausgezeichnete Wahl für Anwendungsfälle wie diesen, bei denen hohe Genauigkeit erforderlich ist. Wenn die Größe und Menge Ihrer Dokumente so groß ist, dass die Kosten zu einem Problem werden, können Sie auch ein kleineres Modell wie Claude Haiku 4.5 verwenden. Um diese Kosten zu schätzen, finden Sie hier einen Vergleich der Kosten für die Zusammenfassung von 1.000 Untermietvereinbarungen mit Sonnet und Haiku: * **Inhaltsgröße** * Anzahl der Vereinbarungen: 1.000 * Zeichen pro Vereinbarung: 300.000 * Gesamtzeichen: 300M * **Geschätzte Token** * Eingabe-Token: 86M (unter der Annahme von 1 Token pro 3,5 Zeichen) * Ausgabe-Token pro Zusammenfassung: 350 * Gesamtausgabe-Token: 350.000 * **Claude Opus 4.6 geschätzte Kosten** * Eingabe-Token-Kosten: 86 MTok \* $5.00/MTok = $430 * Ausgabe-Token-Kosten: 0,35 MTok \* $25.00/MTok = $8,75 * Gesamtkosten: $430,00 + $8,75 = $438,75 * **Claude Haiku 3 geschätzte Kosten** * Eingabe-Token-Kosten: 86 MTok \* $0,25/MTok = $21,50 * Ausgabe-Token-Kosten: 0,35 MTok \* $1,25/MTok = $0,44 * Gesamtkosten: $21,50 + $0,44 = $21,96 Die tatsächlichen Kosten können von diesen Schätzungen abweichen. Diese Schätzungen basieren auf dem Beispiel, das im Abschnitt zum [Prompting](https://platform.claude.com/docs/de/about-claude/use-case-guides/legal-summarization#build-a-strong-prompt) hervorgehoben wird. ### Transformieren Sie Dokumente in ein Format, das Claude verarbeiten kann Bevor Sie mit der Zusammenfassung von Dokumenten beginnen, müssen Sie Ihre Daten vorbereiten. Dies beinhaltet das Extrahieren von Text aus PDFs, das Bereinigen des Textes und das Sicherstellen, dass er von Claude verarbeitet werden kann. Hier ist eine Demonstration dieses Prozesses auf einer Beispiel-PDF: from io import BytesIO import re import pypdf import requests def get_llm_text(pdf_file): reader = pypdf.PdfReader(pdf_file) text = "\n".join([page.extract_text() for page in reader.pages]) # Remove extra whitespace text = re.sub(r'\s+', ' ', text) # Remove page numbers text = re.sub(r'\n\s*\d+\s*\n', '\n', text) return text # Create the full URL from the GitHub repository url = "https://raw.githubusercontent.com/anthropics/anthropic-cookbook/main/skills/summarization/data/Sample Sublease Agreement.pdf" url = url.replace(" ", "%20") # Download the PDF file into memory response = requests.get(url) # Load the PDF from memory pdf_file = BytesIO(response.content) document_text = get_llm_text(pdf_file) print(document_text[:50000]) In diesem Beispiel laden wir zunächst eine PDF einer Beispiel-Untermietvereinbarung herunter, die im [Zusammenfassungs-Cookbook](https://platform.claude.com/cookbook/capabilities-summarization-guide) verwendet wird. Diese Vereinbarung stammt aus einer öffentlich verfügbaren Untermietvereinbarung von der [sec.gov-Website](https://www.sec.gov/Archives/edgar/data/1045425/000119312507044370/dex1032.htm) . Wir verwenden die pypdf-Bibliothek, um den Inhalt der PDF zu extrahieren und in Text umzuwandeln. Die Textdaten werden dann bereinigt, indem zusätzliche Leerzeichen und Seitenzahlen entfernt werden. ### Erstellen Sie einen starken Prompt Claude kann sich an verschiedene Zusammenfassungsstile anpassen. Sie können die Details des Prompts ändern, um Claude zu leiten, um mehr oder weniger ausführlich zu sein, mehr oder weniger technische Terminologie einzubeziehen oder eine höhere oder niedrigere Zusammenfassung des Kontexts bereitzustellen. Hier ist ein Beispiel, wie Sie einen Prompt erstellen, der sicherstellt, dass die generierten Zusammenfassungen eine konsistente Struktur bei der Analyse von Untermietvereinbarungen befolgen: import anthropic # Initialize the Anthropic client client = anthropic.Anthropic() def summarize_document(text, details_to_extract, model="claude-opus-4-6", max_tokens=1000): # Format the details to extract to be placed within the prompt's context details_to_extract_str = '\n'.join(details_to_extract) # Prompt the model to summarize the sublease agreement prompt = f"""Summarize the following sublease agreement. Focus on these key aspects: {details_to_extract_str} Provide the summary in bullet points nested within the XML header for each section. For example: - Sublessor: [Name] // Add more details as needed If any information is not explicitly stated in the document, note it as "Not specified". Do not preamble. Sublease agreement text: {text} """ response = client.messages.create( model=model, max_tokens=max_tokens, system="You are a legal analyst specializing in real estate law, known for highly accurate and detailed summaries of sublease agreements.", messages=[\ {"role": "user", "content": prompt},\ {"role": "assistant", "content": "Here is the summary of the sublease agreement: "}\ ], stop_sequences=[""] ) return response.content[0].text sublease_summary = summarize_document(document_text, details_to_extract) print(sublease_summary) Dieser Code implementiert eine `summarize_document`\-Funktion, die Claude verwendet, um den Inhalt einer Untermietvereinbarung zusammenzufassen. Die Funktion akzeptiert eine Textzeichenkette und eine Liste von zu extrahierenden Details als Eingaben. In diesem Beispiel rufen wir die Funktion mit den Variablen `document_text` und `details_to_extract` auf, die in den vorherigen Code-Snippets definiert wurden. Innerhalb der Funktion wird ein Prompt für Claude generiert, der das zusammenzufassende Dokument, die zu extrahierenden Details und spezifische Anweisungen zur Zusammenfassung des Dokuments enthält. Der Prompt weist Claude an, mit einer Zusammenfassung jedes zu extrahierenden Details zu antworten, die in XML-Headern verschachtelt ist. Da wir uns entschieden haben, jeden Abschnitt der Zusammenfassung in Tags auszugeben, kann jeder Abschnitt leicht als Nachbearbeitungsschritt analysiert werden. Dieser Ansatz ermöglicht strukturierte Zusammenfassungen, die für Ihren Anwendungsfall angepasst werden können, sodass jede Zusammenfassung dem gleichen Muster folgt. ### Bewerten Sie Ihren Prompt Prompting erfordert oft Tests und Optimierung, um produktionsreif zu sein. Um die Bereitschaft Ihrer Lösung zu bestimmen, bewerten Sie die Qualität Ihrer Zusammenfassungen mit einem systematischen Prozess, der quantitative und qualitative Methoden kombiniert. Die Erstellung einer [starken empirischen Bewertung](https://platform.claude.com/docs/de/test-and-evaluate/develop-tests#building-evals-and-test-cases) basierend auf Ihren definierten Erfolgskriterien ermöglicht es Ihnen, Ihre Prompts zu optimieren. Hier sind einige Metriken, die Sie möglicherweise in Ihre empirische Bewertung aufnehmen möchten: ### ROUGE-Scores ### BLEU-Scores ### Kontextuelle Einbettungsähnlichkeit ### LLM-basierte Bewertung ### Menschliche Bewertung ### Stellen Sie Ihren Prompt bereit Hier sind einige zusätzliche Überlegungen, die Sie bei der Bereitstellung Ihrer Lösung in der Produktion beachten sollten. 1. **Gewährleisten Sie keine Haftung:** Verstehen Sie die rechtlichen Auswirkungen von Fehlern in den Zusammenfassungen, die zu rechtlicher Haftung für Ihre Organisation oder Kunden führen könnten. Geben Sie Haftungsausschlüsse oder rechtliche Hinweise ab, die klarstellen, dass die Zusammenfassungen von KI generiert werden und von Rechtsfachleuten überprüft werden sollten. 2. **Behandeln Sie verschiedene Dokumenttypen:** In diesem Leitfaden haben wir besprochen, wie man Text aus PDFs extrahiert. In der Praxis können Dokumente in verschiedenen Formaten vorliegen (PDFs, Word-Dokumente, Textdateien usw.). Stellen Sie sicher, dass Ihre Datenextraktions-Pipeline alle Dateiformate konvertieren kann, die Sie erwarten zu erhalten. 3. **Parallelisieren Sie API-Aufrufe an Claude:** Lange Dokumente mit einer großen Anzahl von Token können bis zu eine Minute dauern, bis Claude eine Zusammenfassung generiert. Für große Dokumentsammlungen möchten Sie möglicherweise API-Aufrufe an Claude parallel senden, damit die Zusammenfassungen in einem angemessenen Zeitrahmen abgeschlossen werden können. Beachten Sie Anthropics [Ratenlimits](https://platform.claude.com/docs/de/api/rate-limits#rate-limits) , um die maximale Anzahl von API-Aufrufen zu bestimmen, die parallel durchgeführt werden können. * * * Verbessern Sie die Leistung --------------------------------- In komplexen Szenarien kann es hilfreich sein, zusätzliche Strategien zur Verbesserung der Leistung über Standard-[Prompt-Engineering-Techniken](https://platform.claude.com/docs/de/build-with-claude/prompt-engineering/overview) hinaus zu berücksichtigen. Hier sind einige fortgeschrittene Strategien: ### Führen Sie Meta-Zusammenfassung durch, um lange Dokumente zusammenzufassen Die Zusammenfassung von Rechtsdokumenten beinhaltet oft die Behandlung langer Dokumente oder vieler verwandter Dokumente gleichzeitig, sodass Sie das Kontextfenster von Claude überschreiten. Sie können eine Chunking-Methode namens Meta-Zusammenfassung verwenden, um diesen Anwendungsfall zu behandeln. Diese Technik beinhaltet die Aufteilung von Dokumenten in kleinere, handhabbare Chunks und die separate Verarbeitung jedes Chunks. Sie können dann die Zusammenfassungen jedes Chunks kombinieren, um eine Meta-Zusammenfassung des gesamten Dokuments zu erstellen. Hier ist ein Beispiel, wie man Meta-Zusammenfassung durchführt: import anthropic # Initialize the Anthropic client client = anthropic.Anthropic() def chunk_text(text, chunk_size=20000): return [text[i:i+chunk_size] for i in range(0, len(text), chunk_size)] def summarize_long_document(text, details_to_extract, model="claude-opus-4-6", max_tokens=1000): # Format the details to extract to be placed within the prompt's context details_to_extract_str = '\n'.join(details_to_extract) # Iterate over chunks and summarize each one chunk_summaries = [summarize_document(chunk, details_to_extract, model=model, max_tokens=max_tokens) for chunk in chunk_text(text)] final_summary_prompt = f""" You are looking at the chunked summaries of multiple documents that are all related. Combine the following summaries of the document from different truthful sources into a coherent overall summary: {"".join(chunk_summaries)} Focus on these key aspects: {details_to_extract_str}) Provide the summary in bullet points nested within the XML header for each section. For example: - Sublessor: [Name] // Add more details as needed If any information is not explicitly stated in the document, note it as "Not specified". Do not preamble. """ response = client.messages.create( model=model, max_tokens=max_tokens, system="You are a legal expert that summarizes notes on one document.", messages=[\ {"role": "user", "content": final_summary_prompt},\ {"role": "assistant", "content": "Here is the summary of the sublease agreement: "}\ \ ], stop_sequences=[""] ) return response.content[0].text long_summary = summarize_long_document(document_text, details_to_extract) print(long_summary) Die `summarize_long_document`\-Funktion baut auf der früheren `summarize_document`\-Funktion auf, indem sie das Dokument in kleinere Chunks aufteilt und jeden Chunk einzeln zusammenfasst. Der Code erreicht dies, indem die `summarize_document`\-Funktion auf jeden Chunk von 20.000 Zeichen innerhalb des ursprünglichen Dokuments angewendet wird. Die einzelnen Zusammenfassungen werden dann kombiniert, und eine endgültige Zusammenfassung wird aus diesen Chunk-Zusammenfassungen erstellt. Beachten Sie, dass die `summarize_long_document`\-Funktion für unsere Beispiel-PDF nicht unbedingt erforderlich ist, da das gesamte Dokument in Claudes Kontextfenster passt. Sie wird jedoch für Dokumente, die Claudes Kontextfenster überschreiten, oder bei der Zusammenfassung mehrerer verwandter Dokumente zusammen unverzichtbar. Unabhängig davon erfasst diese Meta-Zusammenfassungstechnik oft zusätzliche wichtige Details in der endgültigen Zusammenfassung, die im früheren Single-Summary-Ansatz übersehen wurden. ### Verwenden Sie zusammengefasste indizierte Dokumente, um eine große Dokumentsammlung zu erkunden Die Suche in einer Dokumentsammlung mit einem LLM beinhaltet normalerweise Retrieval-Augmented Generation (RAG). In Szenarien mit großen Dokumenten oder wenn präzise Informationsbeschaffung entscheidend ist, kann ein grundlegender RAG-Ansatz jedoch unzureichend sein. Zusammengefasste indizierte Dokumente ist ein fortgeschrittener RAG-Ansatz, der eine effizientere Möglichkeit zur Einstufung von Dokumenten für den Abruf bietet und weniger Kontext als traditionelle RAG-Methoden verwendet. Bei diesem Ansatz verwenden Sie zunächst Claude, um eine prägnante Zusammenfassung für jedes Dokument in Ihrem Corpus zu generieren, und verwenden dann Claude, um die Relevanz jeder Zusammenfassung für die gestellte Frage einzustufen. Weitere Details zu diesem Ansatz, einschließlich eines Code-basierten Beispiels, finden Sie im Abschnitt zu zusammengefassten indizierten Dokumenten im [Zusammenfassungs-Cookbook](https://platform.claude.com/cookbook/capabilities-summarization-guide) . ### Fine-Tunen Sie Claude, um von Ihrem Datensatz zu lernen Eine weitere fortgeschrittene Technik zur Verbesserung von Claudes Fähigkeit, Zusammenfassungen zu generieren, ist Fine-Tuning. Fine-Tuning beinhaltet das Training von Claude auf einem benutzerdefinierten Datensatz, der speziell mit Ihren Anforderungen zur Zusammenfassung von Rechtsdokumenten übereinstimmt, um sicherzustellen, dass Claude sich an Ihren Anwendungsfall anpasst. Hier ist ein Überblick über die Durchführung von Fine-Tuning: 1. **Identifizieren Sie Fehler:** Beginnen Sie damit, Instanzen zu sammeln, in denen Claudes Zusammenfassungen zu kurz kommen – dies könnte das Fehlen kritischer Rechtsdetails, das Missverständnis von Kontext oder die Verwendung unangemessener Rechtsterminologie umfassen. 2. **Kuratieren Sie einen Datensatz:** Sobald Sie diese Probleme identifiziert haben, stellen Sie einen Datensatz dieser problematischen Beispiele zusammen. Dieser Datensatz sollte die ursprünglichen Rechtsdokumente zusammen mit Ihren korrigierten Zusammenfassungen enthalten, um sicherzustellen, dass Claude das gewünschte Verhalten erlernt. 3. **Führen Sie Fine-Tuning durch:** Fine-Tuning beinhaltet das erneute Training des Modells auf Ihrem kuratierten Datensatz, um seine Gewichte und Parameter anzupassen. Dieses erneute Training hilft Claude, die spezifischen Anforderungen Ihrer Rechtsdomäne besser zu verstehen und seine Fähigkeit zur Zusammenfassung von Dokumenten gemäß Ihren Standards zu verbessern. 4. **Iterative Verbesserung:** Fine-Tuning ist kein einmaliger Prozess. Während Claude weiterhin Zusammenfassungen generiert, können Sie iterativ neue Beispiele hinzufügen, bei denen es unterperformt hat, und seine Fähigkeiten weiter verfeinern. Im Laufe der Zeit wird diese kontinuierliche Feedback-Schleife zu einem Modell führen, das hochgradig spezialisiert für Ihre Aufgaben zur Zusammenfassung von Rechtsdokumenten ist. Fine-Tuning ist derzeit nur über Amazon Bedrock verfügbar. Weitere Details finden Sie im [AWS-Startblog](https://aws.amazon.com/blogs/machine-learning/fine-tune-anthropics-claude-3-haiku-in-amazon-bedrock-to-boost-model-accuracy-and-quality/) . [Zusammenfassungs-Cookbook\ \ Sehen Sie sich ein vollständig implementiertes Code-basiertes Beispiel an, wie Sie Claude zur Zusammenfassung von Verträgen verwenden.](https://platform.claude.com/cookbook/capabilities-summarization-guide) [Zitate-Cookbook\ \ Erkunden Sie unser Zitate-Cookbook-Rezept für Anleitungen zur Gewährleistung von Genauigkeit und Erklärbarkeit von Informationen.](https://platform.claude.com/cookbook/misc-using-citations) Was this page helpful? ---