Nutanix Enterprise AI(NAI)2.6 の Management API と curl コマンドを利用して、Hugging Face Hub にあるモデルを URL からインポートしてみます。
今回の内容です。
今回のモデル
下記の投稿で NAI UI からインポートしたモデルを、API でインポートしてみます。
今回も、Sarashina の軽量なモデルを使用します。
1. 既存モデル インスタンスの確認
まず、API でモデルをインポートする際に渡す JSON データを用意します。
今回実行する API は、NAI の Management API です。これは、推論エンドポイントの API とは異なる、NAI 独自のものです。API リファレンスは、下記のあたりにあります。
参考にするため、以前の投稿でインポートしたモデルのデータも確認しておきます。
まず、curl コマンドを実行しやすいように、NAI への接続情報を変数に格納しておきます。
NAI_UI=<NAI UIのIPアドレス> NAI_USER=admin NAI_PASS='パスワード'
前回インポートしたモデルのインスタンス名(sarashina22-05b)も、変数に格納しておきます。
MODEL_INST_NAME=sarashina22-05b
モデルの情報を確認する curl コマンドは下記のようになります。コマンドの結果は JSON 形式で返されるため、jq コマンドで整形します。
curl -k -s --request GET \ --url "https://$NAI_UI/api/enterpriseai/v1/models/list?name=$MODEL_INST_NAME" \ --header 'Accept: application/json' \ -u "$NAI_USER:$NAI_PASS" \ --header 'Content-Type: application/json' | jq -r .
実際に実行すると、下記のようにモデル インスタンスのデータを取得できます。ちなみに、「?name=$MODEL_INST_NAME」を省略するとすべてのモデル(モデル数が少なければ)を取得できます。
$ curl -k -s --request GET \ --url "https://$NAI_UI/api/enterpriseai/v1/models/list?name=$MODEL_INST_NAME" \ --header 'Accept: application/json' \ -u "$NAI_USER:$NAI_PASS" \ --header 'Content-Type: application/json' | jq -r . { "data": { "totalCount": 1, "models": [ { "id": "nai-ced3d622-038b-42ba-acac-55", "createdAt": "2026-05-24T18:04:50.036128Z", "updatedAt": "2026-05-24T18:04:50.036128Z", "name": "sarashina22-05b", "createdBy": { "id": "00000000-0000-0000-0000-000000000000", "username": "admin" }, "modelDetails": { "modelSizeInGB": 12, "modelCapabilities": [ "text-to-text" ], "developer": "sbintuitions", "validated": false, "adminEnabled": true }, "storageProvider": { "huggingFaceHub": { "repoId": "sbintuitions/sarashina2.2-0.5b-instruct-v0.1", "repoVersion": "" } }, "outputFormat": "hf" } ] }, "msg": "Models fetched successfully" }
2. モデルのインポート(curl + API)
同様にモデルをインポートするには、下記のような curl コマンドを実行します。
- API のメソッドは、POST になります。
- 同じモデルをインポートするので、モデル インスタンス名を変更しています。
- モデル インスタンス名:sarashina22-05b-api
curl -k -s --request POST \
--url "https://$NAI_UI/api/enterpriseai/v1/models" \
--header 'Accept: application/json' \
-u "$NAI_USER:$NAI_PASS" \
--header 'Content-Type: application/json' \
--data '{
"modelProvider": {
"catalogId": null,
"customModelDetails": {
"developer": "sbintuitions",
"modelCapabilities": [
"text-to-text"
]
}
},
"name": "sarashina22-05b-api",
"sourceFormat": "hf",
"storageProvider": {
"huggingFaceHub": {
"repoId": "sbintuitions/sarashina2.2-0.5b-instruct-v0.1"
}
}
}'
実際に実行すると、下記のようにモデル インスタンスの ID が返され、Hugging Face Hub からモデルのダウンロードが開始されます。
{"data":{"id":"nai-8088d283-6616-4870-8e33-4e"},"msg":"Model created successfully"}
3. インポートしたモデルの確認
NAI UI と API で、インポートしたモデルの情報を確認してみます。
3-1. NAI UI での確認
インポートされたモデルは、NAI UI の「モデル」→「リスト」タブでも確認できます。

モデル インスタンス名をクリックすると「モデルの詳細」が表示され、モデル URL を使用してインポートされたことがわかります。

3-2. API での確認
インポートしたモデルのインスタンス名を、変数に格納します。
MODEL_INST_NAME=sarashina22-05b-api
モデルの情報を確認するコマンドは、冒頭で実行したものと同様です。
curl -k -s --request GET \ --url "https://$NAI_UI/api/enterpriseai/v1/models/list?name=$MODEL_INST_NAME" \ --header 'Accept: application/json' \ -u "$NAI_USER:$NAI_PASS" \ --header 'Content-Type: application/json' | jq -r .
下記のように、モデルの情報を確認できます。このモデルは Nutanix の事前確認済みモデルではないので、modelDetails → validated が false になっていることがわかります。
$ curl -k -s --request GET \ --url "https://$NAI_UI/api/enterpriseai/v1/models/list?name=$MODEL_INST_NAME" \ --header 'Accept: application/json' \ -u "$NAI_USER:$NAI_PASS" \ --header 'Content-Type: application/json' | jq -r . { "data": { "totalCount": 1, "models": [ { "id": "nai-8088d283-6616-4870-8e33-4e", "createdAt": "2026-06-15T15:01:50.700931Z", "updatedAt": "2026-06-15T15:01:50.700931Z", "name": "sarashina22-05b-api", "createdBy": { "id": "00000000-0000-0000-0000-000000000000", "username": "admin" }, "modelDetails": { "modelSizeInGB": 12, "modelCapabilities": [ "text-to-text" ], "developer": "sbintuitions", "validated": false, "adminEnabled": true }, "storageProvider": { "huggingFaceHub": { "repoId": "sbintuitions/sarashina2.2-0.5b-instruct-v0.1", "repoVersion": "" } }, "outputFormat": "hf" } ] }, "msg": "Models fetched successfully" }
つづく。
