Skip to main content

Ultralytics logo

🔌 Ultralytics Platform API Python SDK

Ultralytics Discord Ultralytics Forums Ultralytics Reddit

Typed synchronous and asynchronous Python clients generated from the Ultralytics Platform API contract with Ultralytics OpenAPI. The interactive API reference documents every resource and includes Python examples.

🐍 Python

PyPI - Version Ultralytics Downloads PyPI - Python Version

Install the standalone ultralytics-platform package from PyPI in a Python >=3.11 environment. It has one lightweight runtime dependency (httpx) and does not install the larger ultralytics package:

uv pip install ultralytics-platform

Pass your API key directly as shown below. Alternatively, omit api_key to use ULTRALYTICS_API_KEY or the Platform key saved by yolo login. Both clients use explicit credentials first, then the environment, then saved settings. Pass api_key="" to disable authentication. yolo logout removes the saved key; it does not unset an environment variable. The SDK reads the existing Ultralytics settings directory, including YOLO_CONFIG_DIR and Linux XDG_CONFIG_HOME, without importing or installing ultralytics.

from ultralytics_platform import Platform

with Platform(api_key="YOUR_API_KEY") as client:
    response = client.datasets.list("your_username")

The asynchronous client exposes the same resource tree:

import asyncio

from ultralytics_platform import AsyncPlatform


async def main():
    async with AsyncPlatform(api_key="YOUR_API_KEY") as client:
        response = await client.datasets.list("your_username")


asyncio.run(main())

The package includes typed responses, multipart uploads, retries for temporary failures, structured API errors, custom HTTP clients, and context-manager cleanup.

Unified ul CLI

This package installs ul. API resource commands work without the ML package. Local commands and ul cloud train/predict/export require ultralytics in the same environment. Existing yolo behavior, including local training with ul:// inputs, is unchanged.

ul login API_KEY                # validate and save a Platform API key
ul logout                       # clear the saved key
ul train model=yolo26n.pt data=coco8.yaml epochs=100
ul cloud train model=yolo26n.pt data=ul://you/datasets/animals epochs=100
ul cloud train model=./best.pt data=./dataset/data.yaml epochs=100
ul cloud predict model=ul://you/project/model source=image.jpg conf=0.25
ul cloud export model=./best.pt format=onnx imgsz=640
ul cloud --help
ul cloud datasets images --help
ul cloud datasets               # list your datasets
ul cloud datasets dataset=coco8 # retrieve one dataset
ul cloud datasets images dataset=coco8 limit=20
ul cloud models project=p model=m
ul cloud training start model_id=MODEL_ID gpu_type=rtx-4090 train_args=@train.json
ul cloud models predict project=p model=m body='{"file":"@image.jpg","conf":0.25}'
ul cloud exports create project=p model=m format=onnx

ul cloud train, ul cloud predict, and ul cloud export accept YOLO key=value arguments and cfg=path.yaml; command-line values override the config. gpu_type= selects cloud compute for training and export. model= accepts official YOLO weights (yolo26, yolo11, yolov8, and yolov5 weights hosted on Platform resolve to their public ul://ultralytics/... models; other official names are passed to training unchanged), a local .pt checkpoint uploaded as its own model, or a ul://owner/project/model URI. The commands use the installed ultralytics package for local file preparation and output saving; inference and training execute on Platform.

  • Train: uploads local dataset YAMLs/folders or ZIP/TAR archives (other data= values such as the built-in coco8.yaml are passed to Platform unchanged), waits for ingestion and training, then downloads weights/best.pt and writes args.yaml, results.csv (when present in the checkpoint), and results.json. Platform currently exposes the promoted checkpoint, not a separate last.pt or the worker's complete output directory. Local datasets must have split directories under one root. Classification class folders are supported; Platform infers the dataset task from the labels during ingest. Uploaded datasets print a reusable URI. A new output model is created per invocation.
  • Predict: submits one local image or video, then uses YOLO's writers for annotated images/videos, save_txt, save_conf, save_crop, save_frames, and display options. save=False disables annotated output. Saved runs also include the API response as results.json. conf, iou, and imgsz run on Platform; classes and max_det are applied locally to the returned detections; other inference execution settings are accepted but ignored because Platform controls remote execution. This lets you reuse local YOLO arguments when switching to cloud prediction. Responses contain rounded detections, polygon masks, top-five classification scores, and quantized depth, so cloud artifacts need not be byte-identical to local inference.
  • Export: clones official weights into your project first (exports require an owned model), waits for completion and downloads the same artifact exposed in Portal. save_dir= selects the download directory; otherwise project= does, then the local checkpoint's directory or the current directory for hosted weights. Archives remain archives. Existing files are replaced only after a successful download. name= keeps YOLO's hardware-target meaning (for example, RKNN); it is not a download filename.

Train and predict reuse YOLO's save_dir, project, name, and exist_ok output-directory rules. For uploaded models and training runs, project= also selects or creates a private Platform project using the local directory's final component as its slug; the default is cloud-training. Explicit existing projects retain their visibility. The training worker assigns its own GPU, so device= is not sent. Boolean cache settings map to the API’s ram/false values. name= also names the output model on Platform, suffixed -2, -3 on conflict the way YOLO increments local run directories; save_dir=, exist_ok=, and device= stay local. This also permits local paths that are longer or contain characters the API does not accept. Export consumes local output/device options before sending format arguments. It ignores save, plots, workers, and cache with one warning; artifact settings such as quantize, imgsz, and dynamic remain validated by Platform. Local commands (ul train, ul predict, ul export) remain unchanged.

These workflow commands return success only after completion and local output handling. Ctrl-C stops waiting (exit 130) but does not cancel the remote job. Failed or interrupted operations retain created resources; use the generated resource commands to inspect or cancel them before retrying. Training/export failures exit nonzero. Saved outputs from a previous run remain until a new artifact has downloaded successfully.

For API resource commands, arguments use key=value with values attached to =, command names use hyphens (storage-integrations), and argument names match Python keywords (train_args, from_). A separate help, --help, or -h token shows help without making a request; literal help values use name=--help. Bare booleans mean true. Omitted values, False, 0, nullable None/null, and strings such as license=None remain distinct. Objects, arrays, and whole union bodies use JSON; @request.json reads JSON from a file and @- from stdin (one argument only). Binary fields require @path, including inside multipart body JSON.

A missing path owner defaults to the logged-in username through one account lookup, including for project operations; explicit owners win. For API resource commands, project identifiers (project) and destination owners are never inferred. Collection commands default to GET list, or matching GET retrieve when an item identifier is supplied; missing retrieval arguments fail instead of listing. Other resources show help. Writes require an explicit operation. Each API resource command invokes one SDK operation, plus any owner lookup, and prints the complete JSON, text, or binary response. Pagination is explicit; the SDK owns serialization, credentials, transport, and retries. Types and required arguments come from SDK signatures; the API validates nested JSON.

Cloud jobs may incur charges. API resource commands submit, inspect, or cancel one operation and exit, without polling or downloading artifacts. Success means the API call succeeded, not that a job finished. Exit codes: 0 success, 1 API/network errors (including nested validation), 2 local input errors, 130 interruption. Interrupting the CLI does not cancel a submitted job; use its cancellation operation.

Credentials prefer ULTRALYTICS_API_KEY, then shared YOLO settings. Login validates before saving; logout leaves environment variables unchanged. ULTRALYTICS_PLATFORM_URL selects another API origin. On systems with an existing Unix ul command, activate your Python environment or use python -m ultralytics_platform.cli.

🧩 One Contract, Typed Python

The Ultralytics Platform API contract is the single source of truth for the generated client:

OpenAPI contract
    └── Python SDK # ultralytics-platform

The source repository pins the consumed contract and generated output so API changes remain deterministic and reviewable. Generated SDK files should never be edited manually; update the contract, consumer configuration, package README source, or generator and regenerate.

🛠️ Validation

CI regenerates the Python SDK to detect contract mismatch or generated drift. It also formats and lints Python, compiles the package, builds its wheel, installs it through the package boundary, and exercises representative synchronous and asynchronous requests.

💡 Contribute

Ultralytics thrives on community collaboration, and we deeply value your contributions! Please see our Contributing Guide for details on how you can get involved. We also encourage you to share your feedback through our Survey. A huge thank you 🙏 to all our contributors!

API shape changes belong in the service OpenAPI contract; generated files should not be edited directly.

Ultralytics open-source contributors

📄 License

📫 Contact

For bug reports or feature suggestions related to this SDK, please submit an issue via GitHub Issues. Join our Discord, Reddit, or Community Forums for discussions and support!


Ultralytics GitHub space Ultralytics LinkedIn space Ultralytics Twitter space Ultralytics YouTube space Ultralytics TikTok space Ultralytics BiliBili space Ultralytics Discord

Release files for ultralytics-platform 0.1.51

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

Source distribution (sdist)

Source distribution for ultralytics-platform 0.1.51
File Size Uploaded
ultralytics_platform-0.1.51.tar.gz 78.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ultralytics-platform 0.1.51
File Interpreter ABI Platform
ultralytics_platform-0.1.51-py3-none-any.whl Python 3 none any Details

Total release size: 166.7 kB

Release files / ultralytics_platform-0.1.51.tar.gz

Download URL ultralytics_platform-0.1.51.tar.gz
Size 78.7 kB
Tags Source
SHA-256 checksum
How to use checksums
69e1f9b01c1909b158f1bd9e57bc4e54921030c5b4c2bd91250a95ebfe16550c
BLAKE2b-256 checksum
How to use checksums
0e0d4b652a3c31eb46e7a4e30ac31d1ac48ede15443e028c15696a32f9e6324a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.

Transparency log

Release files / ultralytics_platform-0.1.51-py3-none-any.whl

Download URL ultralytics_platform-0.1.51-py3-none-any.whl
Size 88.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
587e26c42f45587b55a9877c8ae93e12691b88d905389c566a2581d082514e1d
BLAKE2b-256 checksum
How to use checksums
369b4107b8328a165d9beea48fc399171245653833dbeedd04fc630920f50fb5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.

Transparency log

Release history Release notifications | RSS feed

0.1.65

2 release files

0.1.62

2 release files

0.1.57

2 release files

0.1.54

2 release files

0.1.52

2 release files

This release

0.1.51 This release

2 release files

0.1.50

2 release files

0.1.49

2 release files

0.1.48

2 release files

0.1.46

2 release files

0.1.45

2 release files

0.1.44

2 release files

0.1.41

2 release files

0.1.40

2 release files

0.1.39

2 release files

0.1.38

2 release files

0.1.35

2 release files

0.1.20

2 release files

0.1.19

2 release files

0.1.18

2 release files

0.1.16

2 release files

0.1.14

2 release files

0.1.13

2 release files

0.1.11

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.1

2 release files

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