> ## Documentation Index
> Fetch the complete documentation index at: https://docs.runcascade.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Anthropic

> Trace Anthropic LLM calls with Cascade

Cascade auto-detects Anthropic clients by module name or `messages` API structure. Wrap your client once and all calls are automatically traced.

## Setup

```python theme={null}
from cascade import init_tracing, wrap_llm_client
from anthropic import Anthropic

init_tracing(project="my_agent")

client = wrap_llm_client(Anthropic())
```

## Usage

```python theme={null}
response = client.messages.create(
    model="claude-sonnet-4-20250514",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello!"}],
)
# Automatically traced!
```

## Streaming

Streaming is fully supported:

```python theme={null}
with client.messages.stream(
    model="claude-sonnet-4-20250514",
    max_tokens=1024,
    messages=messages
) as stream:
    for event in stream:
        ...
    final = stream.get_final_message()
```

The wrapped client behaves identically to the original. All existing method calls, attributes, and patterns continue to work. The only difference is that LLM calls now produce spans in your Cascade traces.

<Info>
  If the SDK does not recognize a client type, it returns the client unwrapped with a warning. LLM calls will still work but won't be traced.
</Info>
