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

# Anthropic APIs

Anthropic builds the Claude family of large language models and exposes them through HTTP APIs for text generation, reasoning, code, and analysis. Jentic publishes and maintains OpenAPI specifications for Anthropic's surfaces, covering synchronous message completions with system prompts and tool use, token counting for cost estimation, asynchronous message batches for high-volume workloads, and model listing for version discovery. Claude models accept context windows up to 200K tokens, so a single request can carry entire contracts, codebases, or research papers without chunking. All operations authenticate with an Anthropic API key and require an anthropic-version header that pins model behaviour.

## For AI agents

An agent can send prompts to Claude models for reasoning, code, and long-document analysis, run tool-use loops, count tokens before dispatch to control cost, and submit or monitor asynchronous message batches for bulk workloads. It can also list available Claude models and inspect their context limits before choosing which one to call.

## Scope

Use for: Sending prompts to Claude for text generation, reasoning, code, and long-document analysis, running tool-use loops, counting tokens before dispatch, and submitting or monitoring asynchronous message batches.

Not supported:
- image generation
- audio transcription
- text embeddings
- vector storage
- model fine-tuning

## APIs

| API | Category | Endpoints | Description |
| --- | --- | --- | --- |
| Anthropic API | ai-ml | 11 | Send prompts to Claude models for text generation, reasoning, and code tasks. |
| Anthropic Messages API | ai-ml | 2 | Send messages to Claude for reasoning, code, and analysis tasks; count tokens before dispatch to manage cost and context. |

## Which API to use

| Need | API | Why |
| --- | --- | --- |
| Synchronous chat completions with tool use and streaming | messages | A focused two-endpoint surface for POST /messages and token counting, ideal when the agent only delegates reasoning steps to Claude and does not need batch or model-management operations. |
| Bulk async processing, batch management, and model discovery | anthropic-api | The broader 11-endpoint surface adds message batches, batch status and result retrieval, batch cancellation, and model listing on top of the same messaging and token-counting operations. |
| Counting tokens before a request to estimate cost | messages | Both APIs expose count_tokens; the Messages API is the lighter choice when token counting and single completions are all the agent needs. |

## Cross-API use cases

### Size a prompt, then send it to Claude

Before dispatching a request, the agent counts tokens for the intended messages and system prompt, confirms the payload fits the chosen model's context window, and only then sends the completion. This keeps requests inside budget and context limits without wasting model compute on oversized inputs.

Example prompt: Call count_tokens with the candidate messages and system prompt; if the count is under the model limit, call the messages endpoint with the same payload and model claude-sonnet

### Interactive reasoning with a batch fallback

The agent handles real-time questions through synchronous message completions, then hands large offline workloads to the batch surface so hundreds of requests run asynchronously at reduced cost. It polls batch status and retrieves results once processing finishes.

Example prompt: Answer live questions via POST /messages, then create a message batch with the day's bulk requests, poll batch status until complete, and download the results

### Pick a model, then run a tool-use loop

The agent lists available Claude models to choose one that fits the task and context requirement, then drives a tool-use loop against the messages endpoint: Claude returns tool_use blocks, the runtime executes each tool, and the appended history is posted back for the next turn.

Example prompt: Call GET /v1/models to select a model, then POST /messages with tool definitions, parse the tool_use block, execute the tool, and POST /messages again with the tool_result appended

## Why Jentic

- **Setup:** Calling these APIs by hand means setting the x-api-key and anthropic-version headers on every request and tracking batch job ids yourself. With Jentic One you install once, add the Anthropic APIs from the Jentic directory, store the API key once, and your agent calls any operation across both surfaces.
- **Permission scoping:** Because you run Jentic One yourself, your own rules decide which Anthropic operations the agent may call. You can scope it to sending messages and counting tokens while leaving out batch creation, batch cancellation, or model listing, and an operation with no granting rule cannot be invoked.
- **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 the Jentic directory by intent, such as 'send a message to 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 vendors

- **OpenAI** — A broad model ecosystem with chat completions and tool use plus image, audio, and embedding endpoints beyond text generation.
- **Cohere** — An LLM vendor with native embedding and reranking, useful when an agent needs retrieval alongside chat in one API.
- **Mistral AI** — Open-weight European models with EU data residency options and lower-cost inference for high-volume text tasks.
- **Groq** — Low-latency inference hardware to pair with Claude when smaller models need sub-second responses.

## FAQ

### What can an agent do across Anthropic's APIs?

An agent can send prompts to Claude for reasoning, code, and analysis, run multi-step tool-use loops, count tokens to control cost, submit and monitor asynchronous message batches, and list available Claude models to choose the right one. The messaging and token-counting operations appear on both surfaces, while batch and model-management operations live on the broader Anthropic API.

### Why does Jentic publish these specs?

Anthropic does not publish an OpenAPI specification. Jentic generates and maintains these specs so agents and developers can call Claude through structured tooling. They are validated against the live API and kept up to date across the messaging, batch, token-counting, and model endpoints.

### Does one credential work across both APIs?

Yes. Both the Messages API and the broader Anthropic API authenticate with the same Anthropic API key in the x-api-key header, paired with the required anthropic-version header. A single stored credential covers every operation on both surfaces.

### Which API should an agent use for synchronous chat versus bulk work?

Use the Messages API for real-time completions, streaming, and tool-use loops when a small two-endpoint surface is enough. Use the broader Anthropic API when the agent also needs message batches for high-volume async work, batch result retrieval or cancellation, or model listing.

### How does the 200K context window change agent design?

Claude accepts up to 200K tokens of combined input in a single request, so an agent can reason over an entire contract, codebase, or research paper without chunking or building a retrieval pipeline. Counting tokens first confirms the payload fits before any generation cost is incurred.

### Can an agent estimate cost before spending model compute?

Yes. The count_tokens operation, available on both APIs, accepts the same messages and system prompt shape as a real request and returns an exact token count without consuming model compute. Agents use it to stay within budgets, choose between model tiers, and decide whether to truncate retrieved content.
