The Respan Anthropic SDK integration provides a pass-through gateway for Claude API requests. Change the base_url to the Respan endpoint and all requests are automatically logged with full observability.
The integration supports all Claude models including thinking capabilities in Claude 3.7 Sonnet and Claude 4. Pass metadata through the nested metadata object for request tracking and customer attribution.
Update the base_url to https://api.keywordsai.co/api/anthropic/ and provide your Respan API key. No other code changes needed.
Anthropic requests through Respan default to 4096 max_tokens - specify max_tokens explicitly if you need a different value. Use the metadata parameter for custom tracking identifiers.
python
import anthropic
client = anthropic.Anthropic(
base_url="https://api.keywordsai.co/api/anthropic/",
api_key="YOUR_RESPAN_API_KEY",
)
response = client.messages.create(
model="claude-sonnet-4-20250514",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello, Claude!"}],
metadata={
"customer_identifier": "user-123",
},
)