Metadata-Version: 2.3
Name: tailli
Version: 0.1.0
Summary: Python client for Tailli API key management and usage tracking
Project-URL: Homepage, https://tailli.latentsearch.io/
Project-URL: Documentation, https://tailli.latentsearch.io/
Author-email: Latent Search <info@rigr.ai>
License: MIT License
        
        Copyright (c) 2024 Tailli
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: api,async,authentication
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.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Requires-Dist: httpx>=0.24.0
Requires-Dist: pydantic>=2.0.0
Provides-Extra: dev
Requires-Dist: black; extra == 'dev'
Requires-Dist: isort; extra == 'dev'
Requires-Dist: pytest-asyncio; extra == 'dev'
Requires-Dist: pytest-cov; extra == 'dev'
Requires-Dist: pytest>=7.0; extra == 'dev'
Description-Content-Type: text/markdown

# Tailli API Client

A high-performance Python client for Tailli API key management and usage tracking. This client provides easy-to-use async interfaces with built-in caching and background usage recording for optimal performance - track consumption accurately without adding latency to your APIs.

## Features

- 🚀 Asynchronous API with proper connection management
- 💾 Local caching of API key validation
- 🔄 Background usage recording with automatic retries
- ⚡ Low-latency operations prioritizing your application's performance
- 🛡️ Type-safe with full typing support

## Installation

```bash
pip install tailli
```

## Quick Start

```python
from tailli import TailliClient

async def main():
    async with TailliClient() as client:
        # Validate an API key and use it in a session
        api_key = "your-api-key"
        try:
            async with client.validated_session(api_key):
                # Your API calls here
                await client.record_usage(api_key, 5)
        except InvalidApiKeyError:
            print("Invalid API key")

if __name__ == "__main__":
    asyncio.run(main())
```

For more examples, check out the [examples directory](examples/basic_usage.py).


## Building and Publishing

1. Install build tools:
   ```bash
   pip install build twine
   ```

2. Build the package:
   ```bash
   python -m build
   ```

3. Test the build locally:
   ```bash
   pip install dist/tailli-0.1.0.tar.gz
   ```

4. Upload to PyPI:
   ```bash
   python -m twine upload dist/*
   ```

## Project Structure

```
tailli/
├── pyproject.toml      # Project configuration and dependencies
├── setup.cfg           # Additional build configuration
├── README.md           # This file
├── LICENSE             # MIT License
├── requirements.txt    # Python dependencies
├── src/
│   └── tailli/         # Main package code
│       ├── __init__.py
│       ├── client.py   # Core client implementation
│       ├── models.py   # Pydantic models
│       └── utils.py    # Utility functions
├── tests/              # Test suite
└── examples/           # Example code
```

## Sample Implementation

The reference implementation can be found in the [examples directory](examples/basic_usage.py). This shows the recommended way to use the client, including:

- API key validation
- Usage recording
- Error handling
- Async context management

## Contributing

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

## License

The Tailli Client (but not the Tailli backend) is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.