The Claude API documentation is the official technical reference for developers building applications with Anthropic’s AI models. It provides the specifications, code examples, and guidelines needed to integrate Claude into software using the RESTful interface or official SDKs.
The primary hub for all documentation is the Claude Developer Platform.
Core Components of the Documentation
The documentation is divided into several key sections to help developers at different stages:
- API Reference: detailed technical specifications for every endpoint, including the core Messages API (for chat and text generation), Message Batches API (for high volume async processing), and Token Counting API.
- SDK Guides: Setup and usage instructions for the official Python SDK and TypeScript/Node.js SDK.
- Prompt Engineering: A comprehensive guide on Prompting Best Practices, including techniques for system prompts, XML tagging, and tool use.
- Workbench & Tools: Guides for using the Anthropic Console to generate API keys, manage billing, and test prompts in the browser.
Available Models (Current Generation)
According to the latest documentation, the API provides access to the “Claude 4” series of models:
- Claude Opus 4.8: The most capable model, optimized for complex reasoning, agentic coding, and deep analysis.
- Claude Sonnet 4.6: A balanced model offering frontier intelligence at scale, ideal for enterprise workflows.
- Claude Haiku 4.5: The fastest model, designed for high speed, near frontier intelligence tasks.
You can learn how to use Claude Opus using step by step guide.
Key Capabilities
The documentation explains how to implement specific features:
- Vision: sending images to Claude for analysis.
- Tool Use (Function Calling): Defining external tools that Claude can “call” to perform actions like fetching data or calculating values.
- Computer Use: specialized beta features that allow models to interact with computer interfaces.
- PDF Support: Processing text and visuals directly from PDF files.

How To Set Up Claude API Documentation?
To set up the Claude API, you need to generate an access key from the Anthropic Console and install the official SDK for your programming language.
Step 1. Get Your API Key
You must have a funded developer account to generate a key.
- Sign Up: Go to console.anthropic.com and create an account.
- Add Credits: Navigate to Billing and add a minimum of $5 in credits to activate your account.
- Create Key: Click Get API Keys > Create Key. Give it a name (e.g., “my-app-key”) and copy the sk-ant-… string immediately. You will not be able to see it again.
Step 2. Install the SDK
Open your terminal and run the command for your preferred language:
Python
pip install anthropic
TypeScript / Node.js
npm install @anthropic-ai/sdk
Step 3. Send Your First Request
Create a file (e.g., quickstart.py or index.ts) and paste the following code.
Step 4. Recommended Configuration
- Environment Variables: Do not hardcode your API key in your source files. Instead, set it in your environment:
Mac/Linux: export ANTHROPIC_API_KEY=”sk-ant-…”
Windows: setx ANTHROPIC_API_KEY “sk-ant-…”
The SDKs will automatically detect this variable, so you don’t need to pass it manually in the client constructor. - Model Versions: While “Opus” is the most powerful model, Claude 3.5 Sonnet (claude-3-5-sonnet-20240620) is currently the recommended default for most use cases due to its balance of speed and intelligence.
If you encounter a 401 Unauthorized error, check that your API key is correct and that your account has a positive credit balance.
You can learn how to use Claude Code using step by step guide.
What Are Pricing Tokens?
In the context of the Claude API documentation, “pricing tokens” refers to the unit of measurement used to calculate your bill. You are not charged per request or per hour; you are charged based on the volume of text (tokens) you send to the model and the volume of text it generates in return.
Here is the breakdown of how tokens dictate your costs:
What is a Token?
A “token” is a fragment of a word.
- Rule of Thumb: 1,000 tokens \(\approx \) 750 words.
- Visual: The word “generative” might be one token, while “AI” might be another. Complex words are split into multiple tokens.
- Impact: You pay for every token you send (Input) and every token Claude writes (Output).
How Pricing Works? (The “Per Million” Standard)
Anthropic prices its models per Million Tokens (MTok). Input tokens (what you read/send) are significantly cheaper than Output tokens (what the model writes).
| Model | Input Price (per 1M tokens) | Output Price (per 1M tokens) | Best For |
| Claude 3.5 Sonnet | $3.00 | $15.00 | Most Workflows. The standard for balance. |
| Claude 3 Opus | $15.00 | $75.00 | Complex Tasks. Highest intelligence, highest cost. |
| Claude 3 Haiku | $0.25 | $1.25 | Speed. Simple tasks, huge volume. |
Critical Documentation Features for Pricing
The API documentation includes specific tools to help you manage these “pricing tokens”:
- Token Counting API: A dedicated endpoint (/v1/messages/count_tokens) that lets you calculate exactly how many tokens a text string will use before you send it, allowing you to estimate costs instantly.
- usage Response Field: Every API response includes a usage field telling you exactly how many input and output tokens were consumed by that specific request.
"usage": {
"input_tokens": 14,
"output_tokens": 23
}
- Prompt Caching: A feature where you can “cache” large context (like a book or codebase). You pay a premium to write it to the cache once, but then pay a 90% discounted rate to read it again in subsequent requests.
- Batch API: If you don’t need immediate responses, you can send a file of requests to be processed within 24 hours for 50% off standard token prices.
“Pricing Tokens” vs. “Credits”
It is important not to confuse tokens with Credits.
- Credits are the currency you deposit into your account (e.g., you add $50 USD).
- Tokens are what you “spend” to deplete those credits.
