# @standardagents/anthropic

Anthropic (Claude) provider for [Standard Agents](https://standardagentbuilder.com). Wraps the official `@anthropic-ai/sdk` and translates between the Standard Agents provider spec and the Anthropic Messages API.

## Features

- Streaming and non-streaming generation through the Messages API
- Tool use with parallel tool results and image tool outputs
- Extended thinking across model generations: adaptive thinking + effort on Claude 4.6+, token budgets on Claude 4.0-4.5, with thinking blocks (text + signature) round-tripped exactly on multi-turn conversations
- Anthropic server-side `web_search` tool exposed as a provider tool
- Vision (images), PDF and plain-text document inputs
- Structured outputs via `output_config.format` for JSON schema response formats
- Prompt caching opt-in for the system prompt (`providerOptions.cacheSystemPrompt`)
- Live model listing and per-model capability detection via the Anthropic Models API
- Usage normalization (prompt/completion/cached/reasoning tokens) plus exact per-request cost derived from raw billing buckets (cache writes at 1.25x/2x, cache reads at 0.1x) for documented Claude models

## Usage

```typescript
import { defineModel } from '@standardagents/spec';
import { anthropic } from '@standardagents/anthropic';

export default defineModel({
  name: 'claude-opus',
  provider: anthropic,
  model: 'claude-opus-4-8',
  inputPrice: 5,
  outputPrice: 25,
  providerOptions: {
    cacheSystemPrompt: true,
  },
});
```

Set `ANTHROPIC_API_KEY` in your environment.

## Pricing Helpers

Known Anthropic model pricing is available through both the package root and the
pure `@standardagents/anthropic/pricing` subpath. The helpers calculate exact
request cost from raw cache buckets and are the same helpers used by provider
responses to populate `usage.cost` when pricing is known.
