Skip to main content

Models API

Endpoints for creating, listing, retrieving models, and managing model versions (upload/download).

List models

GET /api/v1/models

Returns a paginated list of models in the catalog, ordered by creation time (newest first).

Parameters

ParameterTypeDefaultDescription
limitinteger20Max models to return (1-100)
offsetinteger0Number of models to skip
frameworkstring--Filter by framework: pytorch, tensorflow, xgboost, sklearn
is_baselineboolean--Filter by baseline flag

Request

curl "https://api.octomil.com/api/v1/models?framework=pytorch&limit=10" \
-H "Authorization: Bearer $OCTOMIL_API_KEY"

Response

{
"models": [
{
"id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
"round_id": null,
"model_path": "s3://octomil-models/baseline/model_v1.pt",
"model_size_bytes": 4521984,
"model_hash": "sha256:e3b0c442...",
"framework": "pytorch",
"framework_version": "2.1.0",
"accuracy": 0.82,
"loss": 0.53,
"is_baseline": true,
"description": "MNIST digit classifier - 3-layer CNN",
"created_at": "2025-07-01T11:00:00Z"
}
],
"total": 18,
"limit": 10,
"offset": 0
}

Retrieve a model

GET /api/v1/models/{model_id}

Retrieves a single model by ID, including its full metadata and version history.

Parameters

ParameterTypeDescription
model_idstring (uuid)UUID of the model

Request

curl https://api.octomil.com/api/v1/models/b2c3d4e5-f6a7-8901-bcde-f12345678901 \
-H "Authorization: Bearer $OCTOMIL_API_KEY"

Response

{
"id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
"framework": "pytorch",
"framework_version": "2.1.0",
"accuracy": 0.82,
"loss": 0.53,
"is_baseline": true,
"description": "MNIST digit classifier - 3-layer CNN",
"created_at": "2025-07-01T11:00:00Z",
"versions": [
{
"version": 1,
"format": "pytorch",
"model_size_bytes": 4521984,
"uploaded_at": "2025-07-01T11:00:00Z"
},
{
"version": 2,
"format": "onnx",
"model_size_bytes": 4100096,
"uploaded_at": "2025-07-01T13:00:00Z"
}
]
}

Create a model

POST /api/v1/models

Creates a new model entry in the catalog. This registers model metadata -- actual weights are uploaded separately via the upload endpoint below.

Parameters

ParameterTypeRequiredDescription
frameworkstringNopytorch, tensorflow, xgboost, or sklearn
framework_versionstringNoVersion of the ML framework (e.g. 2.1.0)
descriptionstringNoHuman-readable description (max 1000 chars)
is_baselinebooleanNoWhether this is a baseline model. Default: false

Request

curl -X POST https://api.octomil.com/api/v1/models \
-H "Authorization: Bearer $OCTOMIL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"framework": "pytorch",
"framework_version": "2.1.0",
"description": "MNIST digit classifier - 3-layer CNN",
"is_baseline": true
}'

Response (201 Created)

{
"id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
"framework": "pytorch",
"framework_version": "2.1.0",
"is_baseline": true,
"description": "MNIST digit classifier - 3-layer CNN",
"created_at": "2025-07-01T11:00:00Z"
}

Upload a version

POST /api/v1/models/{model_id}/versions/upload

Uploads model weights as a new version. The server stores the file in S3/MinIO and optionally converts it to ONNX format.

Parameters

Path: model_id (string, uuid) -- UUID of the model.

Body (multipart/form-data):

FieldTypeRequiredDescription
filebinaryYesModel weights file (.pt, .h5, .pkl, .onnx)
formatstringNoSource format: pytorch, tensorflow, onnx, sklearn, xgboost
descriptionstringNoHuman-readable description of this version

Request

curl -X POST https://api.octomil.com/api/v1/models/b2c3d4e5-f6a7-8901-bcde-f12345678901/versions/upload \
-H "Authorization: Bearer $OCTOMIL_API_KEY" \
-F "file=@model.pt" \
-F "format=pytorch" \
-F "description=After round 18 aggregation"

Response (201 Created)

{
"model_id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
"version": 3,
"format": "pytorch",
"model_path": "s3://octomil-models/b2c3d4e5/v3/model.pt",
"model_size_bytes": 4521984,
"model_hash": "sha256:a1b2c3d4...",
"description": "After round 18 aggregation",
"uploaded_at": "2025-07-01T13:30:00Z"
}

Download a version

GET /api/v1/models/{model_id}/versions/{version}/download

Downloads model weights for a specific version. Use the optional format query parameter to request a converted artifact (ONNX, TFLite, CoreML). Returns 404 if the requested format is not yet available.

Parameters

Path: model_id (uuid), version (integer).

Query: format (string, default: original) -- Desired format: pytorch, onnx, tflite, coreml.

Request

# Download as ONNX
curl -O "https://api.octomil.com/api/v1/models/b2c3d4e5-f6a7-8901-bcde-f12345678901/versions/3/download?format=onnx" \
-H "Authorization: Bearer $OCTOMIL_API_KEY"

Response (200 OK)

Binary file download with these headers:

HeaderDescription
Content-DispositionSuggested filename (e.g. attachment; filename="model_v3.onnx")
Content-LengthFile size in bytes
X-Model-HashSHA-256 hash for integrity verification

Errors

All model endpoints return standard error responses:

StatusErrorDescription
400bad_requestInvalid or missing request fields
401unauthorizedMissing or invalid API key
404not_foundResource does not exist
409conflictResource already exists or state conflict
429rate_limitedToo many requests; check Retry-After
500internal_errorUnexpected server error