Skip to main content

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

pip install tailli

Quick Start

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.

Building and Publishing

  1. Install build tools:

    pip install build twine
    
  2. Build the package:

    python -m build
    
  3. Test the build locally:

    pip install dist/tailli-0.1.0.tar.gz
    
  4. Upload to PyPI:

    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. This shows the recommended way to use the client, including:

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

License

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

Metadata

Release files for tailli 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tailli 0.2.0
File Size Uploaded Provenance Actions
tailli-0.2.0.tar.gz 6.4 kB Without provenance Details for tailli-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tailli 0.2.0
File Interpreter ABI Platform Actions
tailli-0.2.0-py3-none-any.whl Python 3 none any Details for tailli-0.2.0-py3-none-any.whl

Total release size: 13.5 kB

Release files / tailli-0.2.0.tar.gz

Download URL tailli-0.2.0.tar.gz
Size 6.4 kB
Tags Source
SHA-256 checksum
How to use checksums
de0a0a964f340de543ce0cf330a7a3a84e39a7a58f01e2653624be97fd567010
BLAKE2b-256 checksum
How to use checksums
a5cb36bd540ea7ae8751b513bb1f68b721e8b04053e796fbe68bbf0aa8a042c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.10

Release files / tailli-0.2.0-py3-none-any.whl

Download URL tailli-0.2.0-py3-none-any.whl
Size 7.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7034ae9a5013154f1fc83340e55b98184dda5ced340bd944b08cb80f9f263c81
BLAKE2b-256 checksum
How to use checksums
d1ece5602bd8265ae4a81626e2c5819694d664ec277338fbcf9ba66b2057c3ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.10

Security for tailli 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page