A proxy gateway for intercepting and analyzing Anthropic Claude API streaming responses
Project description
Numyra Gateway
A proxy gateway for intercepting and analyzing Anthropic Claude API streaming responses using mitmproxy.
Features
- SSE Stream Parsing: Parse Server-Sent Events from Claude API responses
- Anthropic Message Reconstruction: Rebuild streaming messages from SSE chunks
- Tool Use Support: Handle both text and tool use responses with JSON pretty-printing
- mitmproxy Integration: Visual inspection of streaming responses in mitmproxy web interface
- Custom Content Views: Dedicated "Numyra Anthropic View" for formatted message display
Installation
pip install numyra-gateway
Usage
Command Line
Start the gateway proxy:
numyra-gateway
This will start:
- Proxy server on
http://127.0.0.1:8080(reverse proxy tohttps://api.anthropic.com) - Web interface on
http://127.0.0.1:8081
Python API
from numyra_gateway.streaming import AnthropicStreamParser
# Parse streaming SSE responses
parser = AnthropicStreamParser()
message = parser.feed(sse_content)
if message and message.is_complete:
print(f"Content: {message.content}")
print(f"Stop reason: {message.stop_reason}")
Requirements
- Python 3.13+
- mitmproxy 12.1.2+
Development
# Install with dev dependencies
uv sync --group dev
# Run tests
uv run pytest
# Start development server
uv run numyra-gateway
License
MIT
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
numyra_gateway-0.1.0.tar.gz
(6.3 kB
view details)
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 numyra_gateway-0.1.0.tar.gz.
File metadata
- Download URL: numyra_gateway-0.1.0.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
66d1327a6463284510b1697ae1b57374de95c6682dc24838cb86db925ecf035e
|
|
| MD5 |
d48ccbe7c64cd54d5ce4fb6393fcdef0
|
|
| BLAKE2b-256 |
546245be725bc8ed9b7087e7e3d3584f5ec8f6badb06197f8d170802514b3889
|
File details
Details for the file numyra_gateway-0.1.0-py3-none-any.whl.
File metadata
- Download URL: numyra_gateway-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d011e4d077d8bb83795396c8ce0cad26c91ae20772b9423d248210f678cbc9f6
|
|
| MD5 |
f3d868d5093123605c3c19bf463ca44e
|
|
| BLAKE2b-256 |
f8ecb6a94b43c92a4f3ffcf569ce7e4e625d465d72d6559c9ff62ae16d0e4732
|