Metadata-Version: 2.4
Name: dlab-ai-forward
Version: 0.1.0
Summary: AI Forward - Expose local LLM services (Ollama, LM Studio) to the cloud
Author-email: DLab <dlab@example.com>
License: MIT
Project-URL: Homepage, https://github.com/dlab/ai-forward
Project-URL: Documentation, https://github.com/dlab/ai-forward#readme
Project-URL: Repository, https://github.com/dlab/ai-forward
Project-URL: Issues, https://github.com/dlab/ai-forward/issues
Keywords: ai,llm,ollama,lm-studio,tunnel,proxy
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: System :: Networking
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: python-socketio[client]>=5.10.0
Requires-Dist: websocket-client>=1.0.0
Requires-Dist: requests>=2.28.0
Requires-Dist: aiohttp>=3.9.0
Requires-Dist: psutil>=5.9.0
Provides-Extra: nvidia
Requires-Dist: nvidia-ml-py>=12.0.0; extra == "nvidia"
Provides-Extra: amd
Requires-Dist: WMI>=1.5.1; platform_system == "Windows" and extra == "amd"
Requires-Dist: pyadl>=0.1.0; extra == "amd"
Provides-Extra: dev
Requires-Dist: build>=0.10.0; extra == "dev"
Requires-Dist: twine>=4.0.0; extra == "dev"

# DLab AI Forward CLI

Command-line interface for AI Forward - expose your local LLM services (Ollama, LM Studio) to the cloud via secure WebSocket tunnel.

## Features

- 🔌 **Easy Tunneling** - Connect local LLM services to cloud infrastructure
- 🤖 **Multi-Service Support** - Works with Ollama and LM Studio
- 📊 **System Monitoring** - Reports CPU, RAM, and GPU metrics
- 🔄 **Auto-Discovery** - Automatically detects available models
- 🔒 **Secure** - Token-based authentication
- 🖥️ **Cross-Platform** - Works on macOS, Linux, and Windows

## Installation

```bash
pip install dlab-ai-forward
```

For NVIDIA GPU monitoring support:

```bash
pip install dlab-ai-forward[nvidia]
```

Or using pipx (recommended for CLI tools):

```bash
pipx install dlab-ai-forward
pipx install dlab-ai-forward[nvidia]  # With NVIDIA support
```

## Usage

```bash
# Basic usage
dlab-ai-forward --name demo --server https://ai.example.com --token YOUR_TOKEN

# With custom ports
dlab-ai-forward --name my-node --server https://ai.example.com --token YOUR_TOKEN \
    --ollama-port 11434 --lmstudio-port 1234

# Expose only specific services
dlab-ai-forward --name ollama-only --server https://ai.example.com --token YOUR_TOKEN \
    --services ollama

# Verbose mode (debug logging)
dlab-ai-forward --name demo --server https://ai.example.com --token YOUR_TOKEN --verbose
```

## Options

| Option | Description | Default |
|--------|-------------|---------|
| `--name` | Tunnel name (unique identifier) | Required |
| `--server` | Backend server URL | Required |
| `--token` | Authentication token (32 chars) | Required |
| `--ollama-port` | Ollama local port | 11434 |
| `--lmstudio-port` | LM Studio local port | 1234 |
| `--services` | Services to expose | ollama lmstudio |
| `--verbose`, `-v` | Enable debug logging | False |

## System Requirements

- Python 3.8+
- Ollama (optional) - running on localhost:11434
- LM Studio (optional) - running on localhost:1234

## GPU Monitoring

GPU metrics are automatically detected and reported:

- **NVIDIA GPUs**: Install with `pip install dlab-ai-forward[nvidia]`
- **AMD GPUs (Windows)**: Install with `pip install dlab-ai-forward[amd]`
- **Apple Silicon (M1/M2/M3)**: Automatically supported on macOS
- **Other GPUs**: Not currently supported

### AMD GPU on Windows

For AMD GPU monitoring on Windows, you have two options:

1. **Using WMI** (built-in, no extra install):
   - Works with most AMD GPUs
   - Uses Windows Performance Counters
   - May require running as Administrator for full metrics

2. **Using pyadl** (optional):
   ```bash
   pip install dlab-ai-forward[amd]
   ```
   - Uses AMD Display Library (ADL)
   - More accurate metrics
   - Requires AMD drivers installed

## How It Works

1. CLI connects to backend via WebSocket with authentication token
2. CLI detects local LLM services and available models
3. CLI reports system metrics (CPU, RAM, GPU)
4. Cloud services can proxy requests through the backend to your local models

## Example: Call Local Model from Cloud

```bash
# Cloud service makes request to backend
curl https://ai.example.com/api/demo/ollama/api/tags \
    -H "Authorization: Bearer YOUR_TOKEN"

# Or for LM Studio
curl https://ai.example.com/api/demo/lmstudio/v1/models \
    -H "Authorization: Bearer YOUR_TOKEN"
```

## License

MIT License
