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

The package is not yet published to PyPI. Install from the repository:

uv add "aimage-sdk @ file:///path/to/aimage-monorepo/sdks/python"
# or: pip install /path/to/aimage-monorepo/sdks/python

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.0.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.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aimage_sdk-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 1cc9e61f3159f101646898ebdbde4c4d05e8e71f6060b21939373e8a9eca8b30
MD5 d4e7af87f7bf69ae3971d46025edbcb8
BLAKE2b-256 23462bab5b26fb63cf2064049b27b70bb1649743f3119affb533ca82465f4083

See more details on using hashes here.

Provenance

The following attestation bundles were made for aimage_sdk-0.1.0.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.0-py3-none-any.whl.

File metadata

  • Download URL: aimage_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.1 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5d61c2a18d955567d84fb27186d22848b1da1c77fa55034c234ce3ac7f82bcf0
MD5 bdf7152bbe7ee4788b1c688ac4182b5b
BLAKE2b-256 7659405e34bfb95e4ffb483e21fc375f7a5c09cf5800cda521789c8a2128d6b6

See more details on using hashes here.

Provenance

The following attestation bundles were made for aimage_sdk-0.1.0-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