Overview
The basic Anthropic demo mirrors the OpenAI demo but uses Claude models. It tries common Anthropic model IDs in order until one succeeds. Use it to confirm yourANTHROPIC_API_KEY is valid.
Prerequisites
ANTHROPIC_API_KEYset in your environment- Python 3.12+
icrl-pyinstalled
Run
Model Fallback
IfMODEL is not set, the script tries these in order:
claude-sonnet-4-5claude-sonnet-4claude-3-7-sonnet-latestclaude-3-5-sonnet-latest
Expected Output
Source
examples/basic_anthropic_demo.py — about 80 lines, including model fallback logic.
