Skip to main content

AILabTools SDK for Python (async)

Project description

AILabTools Python SDK (async)

Official async Python SDK for AILabTools APIs.

Installation

pip install ailabtools-sdk

Quick Start

1. Get your API key

Create or copy your API key from the AILabTools developer console:

https://www.ailabtools.com/developer

2. Configure your environment

export AILAB_API_KEY="your_api_key_here"

3. Call the API

import os
import asyncio
from ailabtools import AILabClient

async def main():
    client = AILabClient(api_key=os.environ["AILAB_API_KEY"])
    credits = await client.common.commonQueryCredits({})
    print(credits.get("data"))
    await client.aclose()

asyncio.run(main())

Example: Image Upscaling

import os
import asyncio
from ailabtools import AILabClient

async def main():
    client = AILabClient(api_key=os.environ["AILAB_API_KEY"])
    with open("./image.jpg", "rb") as image:
        result = await client.image.imageLosslessEnlargement({
            "image": image,
            "upscaleFactor": "2",
        })
    print(result.get("data"))
    await client.aclose()

asyncio.run(main())

Parameter Mapping

The SDK exposes camelCase parameters, for example upscaleFactor, and maps them to API field names such as upscale-factor internally.

File Uploads

File parameters support file-like objects with a read method, or bytes / bytearray.

Async Tasks

Async APIs return task_id. Poll results with commonQueryAsyncTaskResult({"taskId": ...}).

API Reference

Testing

AILAB_API_KEY=xxx pytest -q

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ailabtools_sdk-0.5.1.tar.gz (18.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ailabtools_sdk-0.5.1-py3-none-any.whl (19.3 kB view details)

Uploaded Python 3

File details

Details for the file ailabtools_sdk-0.5.1.tar.gz.

File metadata

  • Download URL: ailabtools_sdk-0.5.1.tar.gz
  • Upload date:
  • Size: 18.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for ailabtools_sdk-0.5.1.tar.gz
Algorithm Hash digest
SHA256 bed4646d6981c0bb19a114ea18dd5ce6bf4afa4e08cb323492e9502a7d7b162e
MD5 537dd005239e2e2477fd5a62d2cda3ed
BLAKE2b-256 6b4befad6d08e19379cd7fe4f8bfb33e06f792941b5ac7505ae7778706386529

See more details on using hashes here.

File details

Details for the file ailabtools_sdk-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: ailabtools_sdk-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 19.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for ailabtools_sdk-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 19386e05f8ae9f3057f6cb5ead8bfa8f0959f464c1e9210c7046c4364f4b8a87
MD5 442298943882372faa71da0aaf3d3805
BLAKE2b-256 48be205acbf89ad97c10003599654c28ca06459ef84ce5a2ae852a9f3289b0d1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page