Metadata-Version: 2.3
Name: numyra-gateway
Version: 0.1.0
Summary: A proxy gateway for intercepting and analyzing Anthropic Claude API streaming responses
Keywords: anthropic,claude,proxy,streaming,sse,mitmproxy
Author: simone
Author-email: simone <simone.giacomelli@gmail.com>
License: MIT
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Internet :: Proxy Servers
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Dist: mitmproxy>=12.1.2
Requires-Python: >=3.13
Project-URL: Homepage, https://github.com/your-username/numyra-gateway
Project-URL: Issues, https://github.com/your-username/numyra-gateway/issues
Project-URL: Repository, https://github.com/your-username/numyra-gateway.git
Description-Content-Type: text/markdown

# 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

```bash
pip install numyra-gateway
```

## Usage

### Command Line

Start the gateway proxy:

```bash
numyra-gateway
```

This will start:
- Proxy server on `http://127.0.0.1:8080` (reverse proxy to `https://api.anthropic.com`)
- Web interface on `http://127.0.0.1:8081`

### Python API

```python
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

```bash
# Install with dev dependencies
uv sync --group dev

# Run tests
uv run pytest

# Start development server
uv run numyra-gateway
```

## License

MIT