Chuyển tới nội dung chính

GPU Container

Quy ước chung​

  • Base URL: https://api-neo.fpt.ai/
  • Path: api/bff/v1/gpucontainer/{orgIdentifier}/workspaces/{workspaceIdentifier}/{action}
  • Method: Tất cả đều POST.
  • Header riêng của service: X-ENV: <APP_ENV>, X-Region: <region>
  • Header chung (apiClient): X-Org-Id, X-Workspace-Id, X-User-Id
  • Response: { "data": {...}, "errors": [] }

Cách lấy Token và Header​

  1. Đăng nhập vào Portal, mở trang GPU Container.
  2. Mở Network tab trong DevTools của trình duyệt, chọn request container.list để lấy định dạng API path (bao gồm orgIdentifier và workspaceIdentifier).
  3. Lấy các giá trị Request Header sau: cookie, x-env, x-org-id, x-region, x-user-id, x-workspace-id.

Danh sách endpoint​

#ActionQuery paramBodyMục đích
1container.listname (tìm kiếm, tuỳ chọn){}Danh sách container
2container.getcontainer_id{}Chi tiết container
3container.stat—{}Thống kê số lượng theo status
4container.create—Xem bên dướiTạo container
5container.startcontainer_id{ "action": "START" }Start
6container.stopcontainer_id{ "action": "STOP" }Stop
7container.restartcontainer_id{ "action": "RESTART" }Restart
8container.deletecontainer_id{}Xoá
9container.editcontainer_idXem bên dướiSửa settings / cập nhật whitelist
10container.downloadlogcontainer_id{}Tải log (responseType: blob)
11container.template.list—{}Danh sách template
12container.template.configconfig_name{}Cấu hình chi tiết template
13container.flavor.list—{}Danh sách GPU flavor
14cost-estimation—Xem bên dướiƯớc tính chi phí

Request body​

4. container.create​

{
"name": "my-container",
"instance_type": "H100",
"container_group": "",
"purpose": "SERVICE",
"description": "",
"container_settings": [{
"enable_ssh": true,
"authorized_keys": [{ "name": "key1", "ssh_key": "ssh-ed25519 AAAA..." }],
"image_setting": { "image_url": "...", "image_tag": "latest", "image_user": "", "image_password": "", "fptcloud_official": false },
"volume_settings": [{ "volume_type": "TEMP_DISK | PERSISTENT_DISK", "mount_path": "/workspace", "mount_capacity": 100 }],
"advance_setting": {
"http_ports": [{ "container_port": 8888 }],
"tcp_ports": [{ "container_port": 22 }],
"container_envs": [{ "key": "K", "value": "V" }],
"startup_cmd": { "cmd": [], "args": [] },
"healthchecks": []
}
}],
"billing_plan": { "billing_type": "PAYG", "billing_level": "NORMAL", "cost_estimate": 0, "currency_code": "USD" }
}

Response: { id, name, status }.

9. container.edit​

Gửi lại đầy đủ object container (lấy từ container.get) với phần đã sửa.

Các field top-level: id, status, created_at, updated_at, tenant_id, name, container_group, purpose, instance_type, billing_plan, description, tags, domain, version, deleted.

Các field trong container_settings[]: enable_ssh, authorized_keys, ssh_connect, image_setting, volume_settings[{volume_name?, volume_type, mount_path, mount_capacity}], advance_setting{http_ports, tcp_ports, startup_cmd, container_envs, healthchecks, block_cidrs}.

Cập nhật whitelist:

{ "block_cidrs": [{ "type": "TCP | HTTP", "ports": [8888], "sources": ["1.2.3.4/32"], "description": "" }] }

14. cost-estimation​

{
"instance_type": "H100",
"container_settings": [{ "volume_settings": [{ "volume_type": "PERSISTENT_DISK", "mount_path": "/data", "mount_capacity": 100 }] }]
}

Response: { org_id, items: [{ sku, quantity, price }], currency_code, total }.

Response chính​

ActionResponse
container.listdata: { items: ListItem[], total, page?, page_size?, total_pages? }; ListItem: id, name, status, region, org_id, ws_id, created_by, purpose, instance_type, container_group, tenant_id, container_settings[{image_setting, enable_ssh, authorized_keys, ssh_connect}], billing_plan, tags, created_at, updated_at
container.getNhư ListItem, nhưng container_settings[] đầy đủ: image_setting, enable_ssh, authorized_keys, ssh_connect, advance_setting, volume_settings, container_resource, observability.container_monitor{container_metric_url, container_log_url}
container.statdata: { stats: [{ status, count }] }
container.template.listdata: { items: [{ name, url, icon?, priority?, fptcloud_official? }], total, page?, size? }
container.template.config{ name, priority, fptcloud_official, purpose, flavor_name, description, instance_type, container_settings[{ image_settings, volume_settings, advanced_setting }] }
container.flavor.listdata: { items: [{ flavor, price_info{currency, value, unit?}, resource{cpu, ram, gpu, vram, temp_disk}, available, region }], total }

Enum​

  • status: CREATING, RUNNING, STOPPED, PROCESSING, FAILED, DELETING, DELETED
  • billing_type: PAYG, SAVING_PLAN_1_WEEK, SAVING_PLAN_1_MONTH, SAVING_PLAN_3_MONTH, SAVING_PLAN_1_YEAR
  • billing_level: NORMAL, WARNING, STOPPED, AT_RISK
  • volume_type: TEMP_DISK, PERSISTENT_DISK

Mã lỗi​

Định dạng lỗi​

Khi lỗi, HTTP status ≠ 2xx và body có dạng:

{ "code": "DDI-SYSTEM-00001", "message": "...", "params": {}, "role_based": false }
  • role_based: true — thông báo phụ thuộc vai trò (MANAGEMENT / WS_ADMIN / MEMBER).
  • HTTP 401 — tự đăng xuất và chuyển về trang login.

Mã lỗi chung (gateway / BFF / billing)​

CodeÝ nghĩa
INSUFFICIENT_BALANCEKhông đủ credit. Role MANAGEMENT sẽ tự mở modal top-up, các role khác được yêu cầu liên hệ owner.
INSUFFICIENT_PERMISSIONSKhông có quyền thực hiện thao tác.
EQ-RESOURCE-SYSTEM-LIMITĐã đạt quota của resource (params.name).
BFF-CREATING-CONCURRENCYĐang có resource khác được tạo trong workspace/service này, chờ hoàn tất rồi thử lại.
route_not_foundEndpoint không tồn tại.
method_not_allowedSai method (chỉ dùng POST).
request_too_largeBody vượt 64 KB.
invalid_tokenToken không hợp lệ hoặc hết hạn.
gateway_internal_errorLỗi nội bộ gateway.
upstream_unavailableService phía sau tạm thời không khả dụng.
gateway_timeoutService phía sau timeout.

Mã lỗi riêng của GPU Container​

CodeThông báo
DDI-SYSTEM-00001Dịch vụ GPU Container chưa được cấu hình cho tenant, liên hệ support.
DDI-SYSTEM-00002Lỗi không xác định, thử lại sau.