Skip to main content
The v2.7.4 source requests claude-sonnet-4-20250514, which Anthropic retired on June 15, 2026. Replace it with claude-sonnet-4-6 before running. See Claude model deprecations.
tool_use.py

Run the Example

1

Set up your virtual environment

2

Install dependencies

3

Export your Anthropic API key

4

Start the Nexus gateway

Install and start Nexus on http://localhost:8000 using the Nexus setup guide. Configure its Anthropic provider with ANTHROPIC_API_KEY and explicitly register claude-sonnet-4-6. Replace anthropic/claude-sonnet-4-20250514 in the saved file with anthropic/claude-sonnet-4-6.
5

Run the example

Save the code above as tool_use.py, then run:
Full source: cookbook/90_models/nexus/tool_use.py