Anthropic Python
Official Anthropic SDK for Python applications
Pythoneasy
The Anthropic Python SDK provides access to Claude models. Decyra captures all Anthropic API calls, giving you complete visibility into your Claude interactions.
Prerequisites
- Decyra account with API key
- Python 3.8+ installed
- anthropic package installed
Installation
pip install anthropic decyra-sdk httpx
Integration
Configure custom HTTP transport with Decyra:
from anthropic import Anthropic
import httpx
import os
def create_decyra_transport():
return httpx.Client(
base_url="https://proxy.decyra.com",
headers={
"X-Decyra-API-Key": os.getenv("DECYRA_API_KEY"),
"anthropic-version": "2023-06-01",
}
)
client = Anthropic(
api_key=os.getenv("DECYRA_API_KEY"),
http_client=create_decyra_transport(),
)
Use the client for messages:
message = client.messages.create(
model="claude-3-opus-20240229",
max_tokens=1024,
messages=[
{"role": "user", "content": "What is quantum computing?"}
],
)
print(message.content[0].text)
What Gets Captured
| Field | Description |
|---|---|
| Model | Claude model identifier |
| Max Tokens | Maximum response tokens |
| Messages | Conversation messages array |
| Prompt Hash | Hash of input prompt |
| Response Time | API call duration |
| Token Usage | Input/output tokens |
| Cost | Estimated cost |
| Stop Sequences | Stop sequence settings |
Verify
Visit your Decyra dashboard and check the traces page. All Anthropic API calls will be visible with complete context.