# Tiiny SDK

A Python SDK for communicating with Tiiny edge computing power boxes via USB-C connection.

## Overview

The Tiiny SDK provides a simple, OpenAI-like interface for interacting with Tiiny edge computing devices. The workflow involves:

1. Detecting if the device is connected to the host computer
2. Authenticating with the device
3. Sending chat completions requests to the edge computing device

## Installation

```bash
pip install tiiny-sdk
```

## Quick Start

```python
import tiiny

# Initialize the client
client = tiiny.TiinyClient()

# Check if device is connected
if client.is_device_connected():
    # Authenticate with the device
    client.login(api_key="your-api-key")
    
    # Send a chat completion request
    response = client.chat.completions.create(
        model="tiiny-edge",
        messages=[
            {"role": "user", "content": "Hello, edge device!"}
        ]
    )
    print(response.choices[0].message.content)
else:
    print("No Tiiny device found. Please check your USB connection.")
```

## Features

- **Device Detection**: Automatically detect connected Tiiny devices
- **Authentication**: Secure login with API keys
- **Chat Completions**: OpenAI-compatible chat interface
- **Error Handling**: Comprehensive error handling and logging
- **Type Hints**: Full type annotation support

## Requirements

- Python 3.8+
- USB-C connection to Tiiny edge computing device
- Valid API key for authentication

## Development

Install development dependencies:

```bash
pip install -e ".[dev]"
```

Run tests:

```bash
pytest
```

## License

MIT License - see LICENSE file for details.