Skip to content

AIMO Python SDK

Introduction

AIMO Python SDK is the official Python client for the AI Model Optimizer platform (AIMO). It helps developers access AIMO services programmatically and integrate model conversion workflows into their own systems. The SDK supports task creation, parameter configuration, task control, status polling, result retrieval, and model artifact download.

Workflow

The basic AIMO Python SDK workflow is shown below:

  1. Log in to AIMO with your personal API Key.
  2. Create a task and provide source model information.
  3. Select target deployment platform (chip vendor/model/runtime).
  4. Configure optimization options (for example quantization settings).
  5. Submit the task for automatic processing.
  6. Download the converted model and related artifacts after success.

Development Environment

Python Version

Make sure Python 3.9 or later is installed.

Install AIMO Python SDK

Install the SDK with pip:

bash
pip install aplux_aimo -i https://mirrors.aidlux.com/simple/

Note

Keep pip up to date to avoid installation issues.

Get AIMO API Key

After signing in to AIMO, click the user icon at the top-right corner, then open User Key to view your API Key.

Quick Start

The following example demonstrates a typical optimization flow with AIMO Python SDK:

python
from aplux_aimo import AimoApi
from aplux_aimo.enums import SourceModelType, TargetDevice, ModelRuntime, TaskStatus, DownloadFileMode

# 1. Initialize client (default base URL: https://aimo.aidlux.com/)
aimo = AimoApi()

# 2. Login with your API Key
api_key = "YOUR_API_KEY"
aimo.login(api_key=api_key)

# 3. Create task
task = aimo.new_task(
	source_model_type=SourceModelType.ONNX,
	source_model_file=r"C:\\path\\to\\your\\model.onnx",
	target_device=TargetDevice.Qualcomm_QCS6490,
	target_runtime=ModelRuntime.QNN_2_28,
	description="My first AIMO task"
)

# 4. Submit task
task.submit()

# 5. Poll task status
final_status = task.poll_status(interval=10, timeout=3600)

# 6. Get result and download output model
if final_status == TaskStatus.SUCCESS:
	result_info = task.get_result()
	print(result_info.message)
	saved_file = task.download(
		file_mode=DownloadFileMode.OutputModel,
		output_file_path=r"C:\\path\\to\\downloads"
	)
	print(f"Downloaded: {saved_file}")
else:
	print(f"Task not successful: {final_status}")

Core APIs

AimoApi

  • login(api_key: str): Authenticate using API Key.
  • new_task(...): Create a conversion/optimization task.
  • new_task_from_exist_task(exist_task_id: str): Clone task from an existing task.
  • new_task_from_config(...): Create task from exported task config.
  • task(task_id: str): Get a task handle by task ID.

AimoTask

  • upload_model(...): Upload source model files.
  • upload_calibration_data_files(...): Upload image calibration dataset.
  • upload_raw_calibration_data_files(...): Upload raw calibration data.
  • submit(): Submit task for processing.
  • poll_status(...): Poll conversion status.
  • get_result(): Get final task result.
  • download(...): Download output or input model package.
  • terminate(): Terminate running task.
  • delete(): Delete task from server.
  • get_info_log(): Get task logs for troubleshooting.

Data Structures and Enums

The SDK provides typed data classes and enums in:

  • aplux_aimo.base_data: task and quantization-related data structures.
  • aplux_aimo.enums: source model type, runtime type, quantization modes, task status, and other constants.

These classes and enums help keep task configuration explicit and less error-prone in production integrations.

FAQ

For common conversion issues and error log explanations, see: