Skip to main content

Python SDK for the AI-Mage Search public API

Project description

aimage-sdk

Python SDK for the AI-Mage Search public API (/v0). Python 3.12+, httpx is the only dependency.

Install

pip install aimage-sdk
# or: uv add aimage-sdk

Quickstart

import os

from aimage_sdk import AimageClient

client = AimageClient(
    api_key=os.environ["AIMAGE_API_KEY"],  # "aimage_api_..."
    base_url="https://api.search.ai-mage.jp",  # API server origin; the client calls {base_url}/v0/...
)

# Discover accessible projects.
me = client.me()
project_id = me["projects"][0]["id"]

# Upload a video: mints a presigned URL, PUTs the bytes, registers the video.
video = client.upload_video(
    project_id=project_id,
    file="./episode-01.mp4",  # str | pathlib.Path | bytes (bytes need file_name=)
    name="Episode 1",
    season=1,
    episode=1,
    on_progress=print,
)

# Wait until clip extraction and AI tagging finish.
processed = client.wait_for_processing(video["id"], poll_interval_s=10, timeout_s=1800)
if processed["processing_status"] == "failed":
    raise RuntimeError(processed["processing_error"])

# Search clips with a natural-language query.
result = client.search_clips(project_id=project_id, query="two characters arguing in the rain")
for clip in result["clips"]:
    print(clip["start_time"], clip["subtitle"], clip["tags"], clip["characters"])

API surface

  • ping() / me()
  • mint_upload_url(project_id=, file_name=, content_type=)
  • register_video(project_id=, name=, file_name=|s3_key=, season=, episode=, auto_process=)
  • get_video(video_id) / list_videos(project_id=, page=, page_size=) / delete_video(video_id)
  • search_clips(project_id=, query=, page=, page_size=)
  • upload_video(project_id=, file=, name=, ...) — full 3-step upload orchestration
  • wait_for_processing(video_id, poll_interval_s=, timeout_s=)

Failed API calls raise AimageApiError with code, message, and HTTP status parsed from the {"error": {"code", "message"}} envelope.

Development

cd sdks/python
uv sync
uv run pytest
uv run ruff check .

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

aimage_sdk-0.1.1.tar.gz (13.1 kB view details)

Uploaded Source

Built Distribution

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

aimage_sdk-0.1.1-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file aimage_sdk-0.1.1.tar.gz.

File metadata

  • Download URL: aimage_sdk-0.1.1.tar.gz
  • Upload date:
  • Size: 13.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for aimage_sdk-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a5bc3c3dfb50bca0795ee00ece794104f4780f5480abe22b1f7eb9794eec5ad7
MD5 a29aa5a28f9f552db0db9c6e72d2084e
BLAKE2b-256 63450f97a2da8e1a31d6241b6d69f8e4f9ea95261435ec77e99618652f11fc10

See more details on using hashes here.

Provenance

The following attestation bundles were made for aimage_sdk-0.1.1.tar.gz:

Publisher: publish-sdk.yml on aimagexyz/aimage-monorepo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aimage_sdk-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: aimage_sdk-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for aimage_sdk-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1c98cca63751f2dd75fd5d793e5f3bea4ab3bf7532a04af6b6b4bb994fad567e
MD5 8945c7d9885585665d625bccf88ce61e
BLAKE2b-256 a52fff9f21bf0ee140e3acb7848e64de9bd6513bc0d9e4765add11c570a1ab23

See more details on using hashes here.

Provenance

The following attestation bundles were made for aimage_sdk-0.1.1-py3-none-any.whl:

Publisher: publish-sdk.yml on aimagexyz/aimage-monorepo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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