# ChatAnthropic
```
pip install -U "langchain[anthropic]"
```
```python
from langchain_anthropic import ChatAnthropic
model = ChatAnthropic(model="claude-sonnet-4-6")
```
Or provider-agnostic:
```python
from langchain.chat_models import init_chat_model
model = init_chat_model("claude-sonnet-4-6")
```
## Rules
- The key comes from ANTHROPIC_API_KEY in the environment. If auth fails, check the variable is actually set in the process environment (dotenv loading order bites people) before assuming the key is bad.
- Claude is one of the providers that supports standard content blocks (`message.content_blocks`), so prefer that accessor when you want reasoning or tool-use content in a provider-agnostic shape.
- For long agentic runs, bump `max_retries` (default 6) and set a checkpointer so a transient failure does not lose the conversation.