Adapters & versions

The adapter lifecycle over raw HTTP: register, upload a version, deploy it, roll back, and delete. Org keys manage their own org; the admin key manages everything.

Full deploy flow

Three requests take an adapter directory to live inference:

# 1. Register the adapter
curl https://lorivo.dev/api/adapters \
-H "Authorization: Bearer ad_…" \
-H "Content-Type: application/json" \
-d '{"name":"my-lora","baseModel":"qwen3-4b"}'
# 2. Upload the version (multipart, from the adapter directory)
curl https://lorivo.dev/api/adapters/<adapter-id>/versions \
-H "Authorization: Bearer ad_…" \
-F adapter_config.json=@./my-lora/adapter_config.json \
-F adapter_model.safetensors=@./my-lora/adapter_model.safetensors
# 3. Deploy it onto the GPU node
curl https://lorivo.dev/api/adapters/<adapter-id>/deploy \
-H "Authorization: Bearer ad_…" \
-H "Content-Type: application/json" \
-d '{"versionId":"<version-id>"}'

GET/api/adapters

List adapters with their org and active version. The admin key sees every org; an org key only its own.

curl https://lorivo.dev/api/adapters \
-H "Authorization: Bearer ad_…"
response
{
"adapters": [
{
"id": "…",
"name": "my-lora",
"baseModel": "qwen3-4b",
"status": "LOADED",
"org": { "id": "…", "name": "acme-ai" },
"activeVersion": { "id": "…", "version": 3, "status": "DEPLOYED" },
"_count": { "versions": 3 }
}
]
}

POST/api/adapters

Register a new adapter. Org keys always register into their own org (orgName is ignored); the admin key may pick any org (default local).

Body fieldDescription
name (required)Adapter name, matching [a-z0-9][a-z0-9-]{0,63}
baseModelBase model id (default qwen3-4b)
orgNameOrg name (admin keys only)
curl https://lorivo.dev/api/adapters \
-H "Authorization: Bearer ad_…" \
-H "Content-Type: application/json" \
-d '{"name":"my-lora","baseModel":"qwen3-4b"}'
201 response
{ "adapter": { "id": "…", "name": "my-lora", "baseModel": "qwen3-4b", "status": "UPLOADED" } }

GET/api/adapters/:id

Adapter detail, including every version (newest first), the org, and the active version.

curl https://lorivo.dev/api/adapters/<adapter-id> \
-H "Authorization: Bearer ad_…"

POST/api/adapters/:id/versions

Upload a new version as multipart/form-data. Required files: adapter_config.json and adapter_model.safetensors. The server validates the config (rank 1–64, base-model family match) and the safetensors header before persisting.

curl https://lorivo.dev/api/adapters/<adapter-id>/versions \
-H "Authorization: Bearer ad_…" \
-F adapter_config.json=@./my-lora/adapter_config.json \
-F adapter_model.safetensors=@./my-lora/adapter_model.safetensors
201 response
{
"version": { "id": "…", "version": 1, "status": "READY", "rank": 8, "sha256": "…" },
"weights": { "tensors": 14, "dtypes": ["BF16"], "sha256": "…" }
}

Limits: at most 10 files, 2 GiB total (oversized bodies are rejected with 413 before buffering).

POST/api/adapters/:id/deploy

Load a version onto the GPU node and make it the active version.

Body fieldDescription
versionId (required)Version to deploy
nodeIdTarget node (admin only); the node must be online and serve the adapter's base-model family
curl https://lorivo.dev/api/adapters/<adapter-id>/deploy \
-H "Authorization: Bearer ad_…" \
-H "Content-Type: application/json" \
-d '{"versionId":"<version-id>"}'
response
{ "version": { "id": "…", "version": 1, "status": "DEPLOYED" } }

POST/api/adapters/:id/rollback

Redeploy the previous version. No body; returns the newly active version.

curl -X POST https://lorivo.dev/api/adapters/<adapter-id>/rollback \
-H "Authorization: Bearer ad_…"

DELETE/api/adapters/:id

Delete an adapter entirely: unloads it from the node, removes its files, and deletes the DB rows (versions cascade; usage logs keep their org).

curl -X DELETE https://lorivo.dev/api/adapters/<adapter-id> \
-H "Authorization: Bearer ad_…"

DELETE/api/adapters/:id/versions/:versionId

Delete a single version and its files. The active version cannot be deleted.

Status values

AdapterVersionMeaning
UPLOADEDREADYFiles stored; nothing loaded yet
LOADING-Deploy in flight
LOADEDDEPLOYEDServing on the node
ERRORFAILEDLoad failed; the error is persisted on the version
-ROLLED_BACKWas serving, replaced by a newer deploy