Beautiful HTML visualizations for Claude API Message objects
Project description
Claude Message Visualizer
Beautiful HTML visualizations for Claude API Message objects in Jupyter notebooks and IPython environments.
Features
✨ Rich Visualizations
- Color-coded block types with icons
- Expandable details for complex content
- Clean, typographic styling
🔍 Citation Support
- Automatic citation numbering
- URL matching to search results
- Quoted text previews
🛠️ Tool Use Debugging
- Clear tool call visualization
- Input/output formatting
- Error highlighting
📚 Educational Tooltips
- Hover over block types for explanations
- Learn the API as you develop
- Perfect for learning Claude
🌐 Web Search Results
- Expandable search result cards
- Page age and URL display
- Encrypted content handling
Installation
pip install claude-message-visualizer
Quick Start
from anthropic import Anthropic
from claude_message_visualizer import visualize_message
# Create client and get response
client = Anthropic()
response = client.messages.create(
model="claude-sonnet-4-5",
max_tokens=1000,
messages=[{"role": "user", "content": "Hello!"}]
)
# Visualize the response
visualize_message(response)
That's it! The visualization will display inline in your notebook.
Usage Examples
Basic Text Response
response = client.messages.create(
model="claude-sonnet-4-5",
max_tokens=1000,
messages=[{"role": "user", "content": "Explain quantum computing"}]
)
visualize_message(response)
Web Search with Citations
response = client.messages.create(
model="claude-sonnet-4-5",
max_tokens=1000,
messages=[{"role": "user", "content": "What are the best exercises for leg muscle gain?"}],
tools=[{"type": "web_search_20250305", "name": "web_search", "max_uses": 5}]
)
visualize_message(response)
The visualizer automatically:
- Numbers citations based on search results
- Shows quoted text from each citation
- Links citations to their source URLs
Tool Use Debugging
tools = [
{
"name": "get_weather",
"description": "Get weather for a location",
"input_schema": {
"type": "object",
"properties": {
"location": {"type": "string"}
}
}
}
]
response = client.messages.create(
model="claude-sonnet-4-5",
max_tokens=1000,
messages=[{"role": "user", "content": "What's the weather in SF?"}],
tools=tools
)
visualize_message(response)
See tool calls with:
- Tool name and ID
- Formatted input parameters
- Clear visual separation
Extended Thinking
response = client.messages.create(
model="claude-sonnet-4-5",
max_tokens=1000,
messages=[{"role": "user", "content": "Solve this math problem: ..."}],
thinking={
"type": "enabled",
"budget_tokens": 5000
}
)
visualize_message(response)
Thinking blocks are collapsible with character counts, letting you inspect Claude's reasoning process.
What Gets Visualized?
The visualizer handles all Claude API block types:
| Block Type | Description | Visual Treatment |
|---|---|---|
| Text | Claude's text responses | Clean typography, citations |
| Tool Use | Tool call requests | Formatted JSON, tool name |
| Tool Result | Tool execution results | Expandable, error highlighting |
| Server Tool Use | Anthropic-hosted tools | Like tool_use, with server badge |
| Web Search Results | Search results from web_search | Expandable cards with metadata |
| Citations | Source references | Numbered, linked to search results |
| Thinking | Extended thinking content | Collapsible, italic styling |
| Image | Image content | Inline display |
| Document | Document content | Preview with metadata |
Requirements
- Python 3.8+
- IPython 7.0+ (Jupyter notebooks, IPython terminal, VS Code notebooks)
- Anthropic Python SDK 0.40.0+
API Reference
visualize_message(message)
Visualizes a Claude API Message object.
Parameters:
message(Message): A Message object returned fromclient.messages.create()
Returns:
- None (displays HTML inline)
Example:
from claude_message_visualizer import visualize_message
response = client.messages.create(...)
visualize_message(response)
Development
Want to modify the visualizer for your needs?
# Clone the repo
git clone https://github.com/frankiewarren/claude-message-visualizer.git
cd claude-message-visualizer
# Install in editable mode
pip install -e .
# Make changes to claude_message_visualizer/visualizer.py
# Changes take effect immediately in your notebooks
Contributing
Contributions welcome! This project is designed to help the Claude developer community. Feel free to:
- Report bugs via GitHub Issues
- Suggest features
- Submit pull requests
License
MIT License - see LICENSE file for details.
Acknowledgments
Built for developers working with the Anthropic Claude API. Special thanks to the Anthropic team for creating such a powerful API.
Related Resources
Questions or feedback? Open an issue on GitHub!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file claude_message_visualizer-0.1.0.tar.gz.
File metadata
- Download URL: claude_message_visualizer-0.1.0.tar.gz
- Upload date:
- Size: 12.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26162279745af4af4fd6277402230025b99a95d39cf9ec075fdf804a5c5bba62
|
|
| MD5 |
0a68a3df3b479c3ca2cf5bb2661625a7
|
|
| BLAKE2b-256 |
597143df20aa74b92db5cc0b275b157cfb06c66eea508c06e3fc9643865e0600
|
File details
Details for the file claude_message_visualizer-0.1.0-py3-none-any.whl.
File metadata
- Download URL: claude_message_visualizer-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
38a93dba70f412868aa987aaf47470498f75b81ed6bb9dcd767ef0b2e9ef66b8
|
|
| MD5 |
bc0f0753636ded2a324e7343e1425ba9
|
|
| BLAKE2b-256 |
d5fd6f82dedf940702b93ed32645ad281f939098df70d445988ac11b7e5d3006
|