canonical: https://jentic.com/apis/anthropic.com/anthropic-api

# Anthropic API

Jentic publishes the only available OpenAPI specification for Anthropic API, keeping it validated and agent-ready. Send messages to Claude models with up to 200K token context windows for complex reasoning, analysis, and code generation across 11 endpoints. Supports message batching for high-volume async workloads, token counting for cost estimation, and model listing for version discovery. Authentication uses the x-api-key header with API key validation.

## For AI agents

Send prompts to Claude models for text generation, reasoning, and code tasks. Supports 200K context windows, message batching, and token counting for cost-aware agent workflows.

## Scope

Does not handle image generation, audio processing, embeddings, or vector storage - use for text generation, reasoning, and analysis only.

## Capabilities

- Generate multi-turn conversations with Claude models using 200K token context windows
- Process high-volume message requests asynchronously through batch endpoints
- Count tokens before sending requests to estimate costs and manage context budgets
- List and inspect available Claude model versions and capabilities
- Cancel in-progress batch jobs to manage resource usage
- Retrieve batch results as downloadable output once processing completes

## Use cases

### AI Agent Reasoning via Jentic

AI agents discover and invoke Claude's message endpoint through Jentic's intent-based search for complex multi-step reasoning tasks. Agents search for the operation, receive the input schema including system prompts and tool definitions, and execute message requests without configuring API headers manually. Claude's 200K context window handles large document analysis and multi-turn conversations within a single request.

Example prompt: Search Jentic for 'send a message to Claude for analysis', load the POST /v1/messages schema, and execute with model claude-sonnet-4-20250514 and a 50K token document for summarization

### Batch Message Processing

Submit hundreds or thousands of message requests as a single batch via POST /v1/messages/batches for asynchronous processing at reduced cost. Monitor batch status, retrieve results when complete, or cancel if no longer needed. Ideal for bulk content generation, document analysis pipelines, or evaluation runs that do not require real-time responses.

Example prompt: Create a message batch with 100 requests via POST /v1/messages/batches, poll GET /v1/messages/batches/{message_batch_id} for completion, then retrieve results

### Token Counting for Cost Management

Estimate token usage and costs before sending requests using the POST /v1/messages/count_tokens endpoint. Pass your intended messages and system prompt to receive an exact token count without consuming model compute. Agents use this to stay within budget constraints, split large documents into appropriately-sized chunks, and choose between model tiers based on actual token requirements.

Example prompt: Count tokens for a 30K-word document via POST /v1/messages/count_tokens with model claude-sonnet-4-20250514 to verify it fits within the context window

### Long Document Analysis and Summarization

Analyze documents up to 200K tokens in a single request using Claude's extended context window through POST /v1/messages. Handles legal contracts, research papers, codebases, and meeting transcripts without chunking or retrieval augmentation. Returns structured summaries, extractions, or analyses based on system prompt instructions.

Example prompt: Send a 150K token legal document to POST /v1/messages with a system prompt to extract all obligations, deadlines, and parties mentioned

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| POST | /v1/messages | Send messages to Claude for text generation and reasoning |
| POST | /v1/messages/count_tokens | Count tokens in a message without generating a response |
| POST | /v1/messages/batches | Create a batch of message requests for async processing |
| GET | /v1/messages/batches/{message_batch_id} | Retrieve status and results of a message batch |
| POST | /v1/messages/batches/{message_batch_id}/cancel | Cancel an in-progress message batch |
| GET | /v1/messages/batches/{message_batch_id}/results | Download results of a completed batch |
| GET | /v1/models | List all available Claude models |
| GET | /v1/models/{model_id} | Get details for a specific model |

## Key resources

- **Messages** — Send prompts to Claude models and receive generated text responses with multi-turn context
- **Message Batches** — Submit, monitor, cancel, and retrieve results for bulk async message processing
- **Models** — List available Claude model versions and inspect their capabilities
- **Token Counting** — Pre-calculate token usage for cost estimation and context window management

## Why Jentic

- **Setup:** Wiring the Anthropic API by hand means setting the x-api-key and anthropic-version headers on every request and tracking batch job ids yourself. Through Jentic you install once, import the Anthropic API from the API Directory, store the API key once, and your agent calls it.
- **Permission scoping:** The Anthropic API takes message content in the request body and exposes batch and model reads by id in the path, so scope the agent to the operations it needs, such as sending messages and counting tokens. You choose the operations it may call, so batch cancellation is not included unless you add it.
- **Credential handling:** Your Anthropic API key is stored once, encrypted, by your own Jentic One instance and injected with the required version header at execution time. It never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'analyze a long document with Claude' or 'count tokens for a prompt', and Jentic returns the matching Anthropic operation with its input schema so the agent calls the right endpoint without browsing the reference docs.

## Related APIs

- **OpenAI API** — Broader model ecosystem with 126 endpoints spanning text, images, audio, and embeddings
- **Cohere API** — Enterprise LLM with native embedding and reranking for RAG pipelines
- **Mistral AI API** — Open-weight European models with competitive pricing
- **Groq API** — Ultra-fast inference hardware for latency-sensitive LLM workloads

## FAQ

### Why is there no official OpenAPI spec for Anthropic API?

Anthropic does not publish an OpenAPI specification. Jentic generates and maintains this spec so that AI agents and developers can call Anthropic API via structured tooling. It is validated against the live API and kept up to date. Get started with Jentic One, the self-hosted execution layer.

### What authentication does the Anthropic API use?

The Anthropic API uses an API key passed in the x-api-key header. You also need to include an anthropic-version header (e.g., '2024-10-22') specifying the API version. Through Jentic, your Anthropic API key is stored encrypted in your Jentic One instance and agents receive scoped access tokens without the raw key entering their context.

### Can I process large documents with Claude's 200K context window?

Yes. The POST /v1/messages endpoint accepts messages with up to 200K tokens of combined input. You can send entire legal contracts, codebases, or research papers in a single request without chunking. Use POST /v1/messages/count_tokens first to verify your document fits within the window before incurring generation costs.

### What are the rate limits for the Anthropic API?

Rate limits vary by tier. Tier 1 accounts get 50 requests per minute and 40,000 input tokens per minute. Higher tiers scale to 4,000 RPM and 400,000 input tokens per minute. The API returns 429 status codes with retry-after headers when limits are reached. Batch endpoints have separate, higher limits for async workloads.

### How do I send a message to Claude through Jentic?

Search Jentic for 'send a message to Claude for reasoning', which returns the POST /v1/messages operation schema. The schema specifies required fields: model (e.g., claude-sonnet-4-20250514), messages array with role and content, and max_tokens. Execute the call through Jentic's SDK with pip install jentic. The x-api-key header is handled automatically by the vault.

### What is the difference between the Messages API and the batch endpoint?

POST /v1/messages returns a response synchronously within seconds for real-time interactions. POST /v1/messages/batches accepts an array of message requests and processes them asynchronously - you poll for status and download results when ready. Batches offer cost savings and higher throughput limits but are not suitable for interactive conversations.

### Can I limit what my agent is allowed to do with the Anthropic API?

Yes. Because you run Jentic One yourself, your own rules decide which Anthropic API operations and credentials the agent may use. You can scope it to just the operations it needs, such as sending messages via POST /v1/messages and counting tokens via POST /v1/messages/count_tokens, while leaving out batch creation and cancellation. If the agent has no rule granting an operation like cancelling a batch, it cannot call it.
