HTTP API agent for remote model management
Project description
XM Agent
HTTP API agent for remote model management. Runs on RunPod or Linux servers and exposes endpoints for model listing, hashing, downloading, and CivitAI metadata lookup.
Installation
# Using uv
uv pip install xm-agent
# Or from git
pip install git+https://github.com/user/xm-agent.git
# Or install locally for development
cd xm-agent
uv sync --dev
Usage
# Start the server (default port 8765)
xm-agent serve
# With custom port and host
xm-agent serve --port 9000 --host 0.0.0.0
Configuration
Configuration via environment variables:
| Variable | Default | Description |
|---|---|---|
XM_AGENT_HOST |
0.0.0.0 |
Server bind address |
XM_AGENT_PORT |
8765 |
Server port |
XM_AGENT_MODELS_PATH |
/workspace/ComfyUI/models |
Base path for model directories |
CIVITAI_API_KEY |
- | CivitAI API key for gated models |
RunPod
On RunPod, the agent auto-detects the environment via RUNPOD_POD_ID and prints the proxy URL on startup:
XM Agent v0.1.0 starting...
Listening on 0.0.0.0:8765
Models path: /workspace/ComfyUI/models
RunPod detected: abc123xyz
Proxy URL: https://abc123xyz-8765.proxy.runpod.net
API Endpoints
Health
GET /health
Returns server status and version.
{"status": "ok", "version": "0.1.0", "runpod_url": null}
Models
GET /models
List all models across all types.
GET /models/{type}
List models of a specific type. Types: checkpoints, loras, embeddings, vae, controlnet.
GET /models/{type}/{filename}/hash
Compute SHA256 hash of a model file.
{"hash": "ABC123...", "filename": "my_lora.safetensors"}
DELETE /models/{type}/{filename}
Delete a model file.
Download
POST /download
Start a model download as a background task.
Request body:
{
"url": "https://civitai.com/api/download/models/12345",
"type": "loras",
"filename": "my_lora.safetensors",
"expected_hash": "ABC123..."
}
Response:
{"task_id": "abc123def456"}
GET /download/{task_id}
Get download progress.
{
"task_id": "abc123def456",
"status": "running",
"progress": 45,
"speed": "5.2 MB/s",
"error": null,
"result": null
}
DELETE /download/{task_id}
Cancel a download.
Metadata
GET /metadata/{hash}
Look up model metadata on CivitAI by SHA256 hash.
POST /metadata/sync
Sync metadata for all models. Computes hashes and fetches CivitAI metadata. Returns a task ID for progress tracking.
Development
# Install dev dependencies
uv sync --dev
# Run tests
uv run pytest
# Run server in development
uv run xm-agent serve --port 8765
Security
- Only downloads from allowed domains (CivitAI, HuggingFace)
- Path traversal protection for model file operations
- No authentication by default (assumes trusted network/RunPod proxy)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file xm_agent-0.1.10.tar.gz.
File metadata
- Download URL: xm_agent-0.1.10.tar.gz
- Upload date:
- Size: 17.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
11d63d84302ff81dd70c7e21abab7edda7e9c761348e059ecbbb91cc2fb8fd33
|
|
| MD5 |
54ce341fafd7ae9dccf2139e899a40cb
|
|
| BLAKE2b-256 |
cd2afeb0ff1866bcef542a2dcd37bfe4a1db57943518d6a1d1cbb9073fd499c7
|
Provenance
The following attestation bundles were made for xm_agent-0.1.10.tar.gz:
Publisher:
python-publish.yml on aladac/xm-agent
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xm_agent-0.1.10.tar.gz -
Subject digest:
11d63d84302ff81dd70c7e21abab7edda7e9c761348e059ecbbb91cc2fb8fd33 - Sigstore transparency entry: 877924819
- Sigstore integration time:
-
Permalink:
aladac/xm-agent@5bf08378b7b215a8580ba2bd4ee65dbb27892761 -
Branch / Tag:
refs/tags/v0.1.10 - Owner: https://github.com/aladac
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@5bf08378b7b215a8580ba2bd4ee65dbb27892761 -
Trigger Event:
release
-
Statement type:
File details
Details for the file xm_agent-0.1.10-py3-none-any.whl.
File metadata
- Download URL: xm_agent-0.1.10-py3-none-any.whl
- Upload date:
- Size: 23.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad354838bc130890302cb148ebfe8478154010173a1e7618cb2f5a270e96ae55
|
|
| MD5 |
b1b888faa6c459dfeed97b0a89551186
|
|
| BLAKE2b-256 |
871e1c35b72f9af8201f35bfe4f62334c6e8705f0ac383d91e6c035df46da569
|
Provenance
The following attestation bundles were made for xm_agent-0.1.10-py3-none-any.whl:
Publisher:
python-publish.yml on aladac/xm-agent
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xm_agent-0.1.10-py3-none-any.whl -
Subject digest:
ad354838bc130890302cb148ebfe8478154010173a1e7618cb2f5a270e96ae55 - Sigstore transparency entry: 877924901
- Sigstore integration time:
-
Permalink:
aladac/xm-agent@5bf08378b7b215a8580ba2bd4ee65dbb27892761 -
Branch / Tag:
refs/tags/v0.1.10 - Owner: https://github.com/aladac
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@5bf08378b7b215a8580ba2bd4ee65dbb27892761 -
Trigger Event:
release
-
Statement type: