Anthropic SDK
Set up Respan
- Sign up — Create an account at platform.respan.ai
- Create an API key — Generate one on the API keys page
- Add credits or a provider key — Add credits on the Credits page or connect your own provider key on the Integrations page
Use AI
Add the Docs MCP to your AI coding tool to get help building with Respan. No API key needed.
What is Anthropic SDK?
The Anthropic SDK is the official Python client for Anthropic’s Claude models, supporting messages, streaming, and tool use. Respan can auto-instrument all Anthropic calls for tracing, route them through the Respan gateway, or both.
Setup
Use Respan Gateway instead? only need respan key, easier setup
Install packages
OpenInference (Recommended)
Traceloop
Set environment variables
No ANTHROPIC_API_KEY needed — the Respan gateway handles provider authentication.
Initialize and run
OpenInference (Recommended)
Traceloop
Configuration
Attributes
Attach customer identifiers, thread IDs, and metadata to spans.
In Respan()
Set defaults at initialization — these apply to all spans.
With propagate_attributes
Override per-request using a context manager.
Decorators
Use @workflow and @task to create structured trace hierarchies.
Examples
Basic message
Streaming
Tool calls
Gateway features
The features below require the gateway setup from the expandable section above.
Switch models
Change the model parameter to use different Claude models through the same gateway.
See the full model list.
Respan parameters
Pass additional Respan parameters via metadata under the respan_params key for gateway features.
See Respan parameters for the full list.