Anthropic API logo

Anthropic API

api

by anthropic

Direct access to Claude models via a developer API. Pay per token pricing for text generation, tool use, vision, extended thinking, computer use, and more.

Key features

Messages API
Tool Use (Function Calling)
Vision (Image and PDF Input)
Extended Thinking
Computer Use
Prompt Caching
Pricing

From $undefined/undefined

Best For

Developers building AI powered applications, chatbots, and agents that need direct model access with full control over prompts, parameters, and tool integrations

Verdict

Claude models consistently lead on writing quality, instruction following, and nuanced reasoning, giving API consumers best in class output for most text and code tasks

What it does

Messages API

The core endpoint for generating text. Send a conversation of user and assistant messages, receive Claude's response. Supports streaming, system prompts, stop sequences, and temperature control.

Learn more

Tool Use (Function Calling)

Define tools with JSON schemas and Claude will decide when and how to call them. Supports auto, any, and specific tool selection modes. The foundation for building AI agents.

Learn more

Vision (Image and PDF Input)

Send images (JPEG, PNG, GIF, WebP) and PDFs directly in messages. Claude can analyze charts, read documents, describe images, extract data from screenshots, and reason about visual content.

Learn more

Extended Thinking

Enable deep, multi step reasoning by giving Claude a thinking budget. Claude reasons through complex problems internally before producing its final answer, dramatically improving accuracy on hard tasks.

Learn more

Computer Use

Claude can see a screen, move the mouse, click buttons, and type text. Build automation that controls any application through its visual interface, from form filling to multi app workflows.

Learn more

Prompt Caching

Cache large system prompts, documents, or tool definitions to reduce costs by up to 90% on repeated requests. Supports 5 minute (default) and 1 hour cache durations.

Learn more

Batch API

Submit up to 100,000 requests as a batch for asynchronous processing with a 50% discount on all tokens. Ideal for data processing, evaluations, and classification at scale.

Learn more

Web Search and Web Fetch

Server side tools that let Claude search the web ($10 per 1,000 searches) and fetch content from any URL (no additional charge beyond tokens). Give your applications access to real time information.

Code Execution

Run Python code in a sandboxed environment for data analysis, calculations, and file processing. Free when used with web search or web fetch; otherwise billed at $0.05 per hour per container.

Model Context Protocol (MCP)

Anthropic created MCP, the open standard for AI tool integration. Build MCP servers to connect Claude to databases, APIs, file systems, and any external service with a standardized protocol.

Learn more

Streaming

Server sent events for real time token by token output. Essential for responsive user interfaces and long running generations.

Citations

Claude can provide source citations that reference specific passages in the documents you provide, enabling verifiable and traceable AI responses.

Adaptive Thinking

Available on Opus 4.6 and Sonnet 4.6. Claude automatically calibrates its reasoning depth to the complexity of each request, balancing speed and quality without manual configuration.

Fast Mode (Research Preview)

Significantly faster output from Opus 4.6 at 6x standard pricing ($30/$150 per MTok). Ideal for latency sensitive applications that need the most capable model.

Pricing

ModelInput / 1M tokensOutput / 1M tokens
Claude Opus 4.6Most intelligent model. 200K context (1M beta). 128K max output. Extended thinking, adaptive thinking, fast mode (6x pricing).$5.00$25.00
Claude Sonnet 4.6Best balance of intelligence and speed. 200K context (1M beta). 64K max output. Extended thinking, adaptive thinking.$3.00$15.00
Claude Haiku 4.5Fastest, most cost efficient. 200K context. 64K max output. Extended thinking.$1.00$5.00
Claude Opus 4.5 (legacy)Previous generation Opus. Same pricing as 4.6.$5.00$25.00
Claude Sonnet 4.5 (legacy)Previous generation Sonnet. Same pricing as 4.6.$3.00$15.00
Claude Opus 4.1 (legacy)Higher priced legacy model.$15.00$75.00
Claude Haiku 3.5 (legacy)Older Haiku model. Still available for existing integrations.$0.80$4.00
Claude Haiku 3 (legacy)Most affordable legacy model.$0.25$1.25

Pros & Cons

Pros

  • Claude models consistently lead on writing quality, instruction following, and nuanced reasoning, giving API consumers best in class output for most text and code tasks
  • Comprehensive tool use system with auto, any, and specific tool selection modes, plus server side tools (web search, web fetch, code execution) that run without client infrastructure
  • Anthropic created MCP (Model Context Protocol), the emerging open standard for AI tool integration, and Claude's API is the most deeply integrated with it
  • Prompt caching can reduce costs by up to 90% for repeated context, and the Batch API provides a flat 50% discount for async workloads
  • 200K token standard context window (roughly 500 pages) with 1M token beta available, and up to 128K token output on Opus 4.6
  • Extended thinking dramatically improves accuracy on complex reasoning (from roughly 50% to 90%+ on hard benchmarks) and is available on all current models
  • Official SDKs for Python, TypeScript, Java, and Go with excellent documentation and a well designed, consistent API surface
  • Available on three major cloud platforms (AWS Bedrock, Google Vertex AI, Microsoft Foundry) for teams that need provider billing or regional data residency

Cons

  • No image or video generation capability. If you need multimedia generation, you will need a separate API (OpenAI, Google, Stability, etc.)
  • Rate limits can be restrictive at lower usage tiers, especially for Opus 4.6. Scaling to Tier 3+ requires sustained spending over time
  • Legacy Opus models (4.1 and 4) are priced at $15/$75 per MTok, which is significantly more expensive than current generation models
  • The 1M token context window is still in beta and only available to organizations in usage Tier 4 or with custom rate limits
  • No fine tuning or model customization is available. You must achieve your desired behavior through prompting, system instructions, and tool definitions
  • Fast mode for Opus 4.6 carries a steep 6x pricing premium ($30/$150 per MTok), making it expensive for high throughput use cases
  • Web search costs $10 per 1,000 searches in addition to token costs, which can add up quickly in search heavy applications

How to get started

1

Create an account and get your API key

Sign up at the Claude Developer Console. Navigate to API Keys and generate your first key. New accounts receive free credits for testing.

2

Install an official SDK

Install the SDK for your language: pip install anthropic (Python), npm install @anthropic-ai/sdk (TypeScript/Node), or use the Java/Go SDKs. Set your API key as the ANTHROPIC_API_KEY environment variable.

3

Make your first API call

Use the Messages API to send a conversation and receive a response. Start with claude-sonnet-4-6 for a good balance of speed and quality, then upgrade to claude-opus-4-6 for complex tasks or downgrade to claude-haiku-4-5 for speed.

4

Explore the Workbench

Use the Workbench in the Developer Console to prototype prompts, test tool definitions, and compare model outputs before writing code. The prompt generator can help you craft effective system prompts.

5

Add tools and features

Experiment with tool use (function calling), vision (image/PDF input), extended thinking for complex reasoning, and streaming for real time output. Each feature is opt in and works with all models.

6

Optimize costs and scale

Enable prompt caching for repeated context (up to 90% savings), use the Batch API for async workloads (50% discount), and choose the right model for each task. Monitor usage in the Developer Console.

Deep dive

Detailed guides with comparisons, tips, and visuals for each feature.

Get notified about updates

We'll email you when this tool's pricing or features change.

Last updated: 2026-02-21