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
- Đăng nhập vào Portal, mở trang GPU Container.
- 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ồmorgIdentifiervàworkspaceIdentifier). - 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
| # | Action | Query param | Body | Mục đích |
|---|---|---|---|---|
| 1 | container.list | name (tìm kiếm, tuỳ chọn) | {} | Danh sách container |
| 2 | container.get | container_id | {} | Chi tiết container |
| 3 | container.stat | — | {} | Thống kê số lượng theo status |
| 4 | container.create | — | Xem bên dưới | Tạo container |
| 5 | container.start | container_id | { "action": "START" } | Start |
| 6 | container.stop | container_id | { "action": "STOP" } | Stop |
| 7 | container.restart | container_id | { "action": "RESTART" } | Restart |
| 8 | container.delete | container_id | {} | Xoá |
| 9 | container.edit | container_id | Xem bên dưới | Sửa settings / cập nhật whitelist |
| 10 | container.downloadlog | container_id | {} | Tải log (responseType: blob) |
| 11 | container.template.list | — | {} | Danh sách template |
| 12 | container.template.config | config_name | {} | Cấu hình chi tiết template |
| 13 | container.flavor.list | — | {} | Danh sách GPU flavor |
| 14 | cost-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
| Action | Response |
|---|---|
container.list | data: { 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.get | Như 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.stat | data: { stats: [{ status, count }] } |
container.template.list | data: { 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.list | data: { 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_BALANCE | Khô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_PERMISSIONS | Khô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_found | Endpoint không tồn tại. |
method_not_allowed | Sai method (chỉ dùng POST). |
request_too_large | Body vượt 64 KB. |
invalid_token | Token không hợp lệ hoặc hết hạn. |
gateway_internal_error | Lỗi nội bộ gateway. |
upstream_unavailable | Service phía sau tạm thời không khả dụng. |
gateway_timeout | Service phía sau timeout. |
Mã lỗi riêng của GPU Container
| Code | Thông báo |
|---|---|
DDI-SYSTEM-00001 | Dịch vụ GPU Container chưa được cấu hình cho tenant, liên hệ support. |
DDI-SYSTEM-00002 | Lỗi không xác định, thử lại sau. |