API v0.1 documentation

Welcome to mkinf! This guide will help you get started with our GPU on-demand platform via API. We’ll walk you through the process of authentication, listing available GPUs, create a VM and setup Firewall Rules.

Overview

mkinf provides scalable GPU resources on demand, ideal for making inferences of AI models with variable user base. Through our API, you can manage and deploy GPU VMs easily, ensuring you have the computational power you need when you need it.

Pricing

A40

$1.10 / h

L40s

$1.25 / h

A100 40GB PCIe

$1.60 / h

A100 80GB PCIe

$1.81 / h

A100 80GB SXM

$2.15 / h

Attachable persistent disks

$0.00013 / GB / h

VM specifications

Customers can create GPU-enabled VMs with the following specs

TypevCPUGPUMemoryDiskVPC Network
a40.1x6-core Intel Xeon (Ice Lake)1x NVIDIA A40 48GB PCIe60GB1x 960GB NVMe25 Gbps
a40.2x12-core Intel Xeon (Ice Lake)2x NVIDIA A40 48GB PCIe120GB2x 960GB NVMe50 Gbps
a40.4x24-core Intel Xeon (Ice Lake)4x NVIDIA A40 48GB PCIe240GB4x 960GB NVMe100 Gbps
a40.8x48-core Intel Xeon (Ice Lake)8x NVIDIA A40 48GB PCIe480GB8x 960GB NVMe200 Gbps
a100.1x12-core Intel Xeon (Ice Lake)1x NVIDIA A100 40GB PCIe120GB1x 960GB NVMe25 Gbps
a100.2x24-core Intel Xeon (Ice Lake)2x NVIDIA A100 40GB PCIe240GB2x 960GB NVMe50 Gbps
a100.4x48-core Intel Xeon (Ice Lake)4x NVIDIA A100 40GB PCIe480GB4x 960GB NVMe100 Gbps
a100.8x96-core Intel Xeon (Ice Lake)8x NVIDIA A100 40GB PCIe960GB8x 960GB NVMe200 Gbps
a100-80gb.1x12-core Intel Xeon (Ice Lake)1x NVIDIA A100 80GB PCIe120GB1x 960GB NVMe25 Gbps
a100-80gb.2x24-core Intel Xeon (Ice Lake)2x NVIDIA A100 80GB PCIe240GB2x 960GB NVMe50 Gbps
a100-80gb.4x48-core Intel Xeon (Ice Lake)4x NVIDIA A100 80GB PCIe480GB4x 960GB NVMe100 Gbps
a100-80gb.8x96-core Intel Xeon (Ice Lake)8x NVIDIA A100 80GB PCIe960GB8x 960GB NVMe200 Gbps
l40s-48gb.1x8-core AMD EPYC (Genoa)1x NVIDIA L40S 48GB PCIe147GBN/A20 Gbps
l40s-48gb.2x16-core AMD EPYC (Genoa)2x NVIDIA L40S 48GB PCIe294GBN/A40 Gbps
l40s-48gb.4x32-core AMD EPYC (Genoa)4x NVIDIA L40S 48GB PCIe588GBN/A80 Gbps
l40s-48gb.8x64-core AMD EPYC (Genoa)8x NVIDIA L40S 48GB PCIe1176GBN/A160 Gbps
l40s-48gb.10x80-core AMD EPYC (Genoa)10x NVIDIA L40S 48GB PCIe1470GBN/A200 Gbps

Authentication

To access the mkinf API, you need to authenticate with your Access Key or email and password.

Access Key

If you want to authenticate your requests with your project Access Key, always include it in the header of your requests.

GET /v0.1 HTTP/1.1
Host: api.mkinf.io
Content-Type: application/json
Authorization: Bearer {{access_key}}

Email and password

If you want to authenticate your requests using your email and password use the Sign in endpoint.

POST /v0.1/auth/token HTTP/1.1
Host: api.mkinf.io
Content-Type: application/json

{
    "grant_type": "password",
    "email": "example@mkinf.io",
    "password": "test1234"
}

Response: You will receive the Access and Refresh tokens.

{
    "access_token": "eyJhbG...",
    "refresh_token": "xdclrV...",
    "expires_in": 3600,
    "token_type": "bearer"
}

If you want to refresh your Access Token use the same endpoint as follow

POST /v0.1/auth/token HTTP/1.1
Host: api.mkinf.io
Content-Type: application/json

{
    "grant_type": "refresh_token",
    "refresh_token": "xdclrV...",
}

List organizations

Retrieve all your organizations using the Lists Organizations endpoint

GET /v0.1/organizations HTTP/1.1
Host: api.mkinf.io
Content-Type: application/json
Authorization: Bearer {{access_key}}

Response

[
  {
    "id": "b5821b92-00d1-4d63-8ca7-c2457be75432",
    "name": "mkinf",
    "stripe_customer_id": "cus_QIw..."
  }
]

List projects

Retrieve all your organization project using the Lists Projects endpoint

GET /v0.1/projects HTTP/1.1
Host: api.mkinf.io
Content-Type: application/json
Authorization: Bearer {{access_key}}

Response

[
    {
        "id": "e91bb876-3358-466d-a49a-4fb524629906",
        "name": "mkinf",
        "version": "v0.1",
        "organization_id": "b5821b92-00d1-4d63-8ca7-c2457be75432"
    }
]

Setup Billing Profile

Before start using mkinf APIs you need to setup your billing profile. You can access your billing dashboard using Billing.

GET /v0.1/organizations/{organization_id}/billing HTTP/1.1
Host: api.mkinf.io
Authorization: Bearer {{access_token}}

Response: You will receive a temporary URL to your billing dashboard.

{
  "url": "https://billing.stripe.com/p/session/YMal3..."
}

Make sure to insert your payment method.

Check available GPUs

Check for available GPUs using the List Availabilities and List Specs endpoints.

List Availabilities

Retrieves the available GPUs per region.

GET /v0.1/projects/{project_id}/availabilities?product_name=l40s-48gb.2x&location=us-east1-a HTTP/1.1
Host: api.mkinf.io
Authorization: Bearer {{access_token}}
{
  "items": [
    {
        "type": "l40s-48gb.2x",
        "location": "us-east1-a",
        "available": true
    },
    ...
  ]
}

List Specs

Retrieves the available node specs.

GET /v0.1/projects/{project_id}/specs HTTP/1.1
Host: api.mkinf.io
Authorization: Bearer {{access_token}}
{
  "items": [
    {
        "product_name": "l40s-48gb.2x",
        "description": "NVIDIA L40S",
        "cpu_cores": 16,
        "cpu_type": "vCPU",
        "memory_gb": 294,
        "memory_type": "ram",
        "disk_gb": 256,
        "disk_type": "SSD",
        "num_gpu": 2,
        "gpu_type": "L40S-48GB"
    },
    ...
  ]
}

Launch a VM

You can create a new VM using the type field to specify the model and amount of GPU. You need also to pass the location where you want to launch the VM, you can find all the available locations using the List Availabilities or List Locations endpoints. Finally you have to pass your ssh_public_key.

1. Generate SSH Key

ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

This will create a public-private key pair in the .ssh directory.

2. List Images

List and choose your preferred OS image.

GET /v0.1/projects/{project_id}/images HTTP/1.1
Host: api.mkinf.io
Authorization: Bearer {{access_token}}

Response:

{
  "items": [
    {
      "id": "9abde4b7-15e8-4abd-891c-42242eb3567e",
      "name": "ubuntu22.04-nvidia-pcie-docker",
      "description": "Ubuntu 22.04, NVIDIA Driver 535.x, CUDA 12.0, nvidia-docker",
      "tags": [
        "2023-11-16"
      ],
      "created_at": "2023-11-16T22:02:00Z",
      "locations": [
        "us-northcentral1-a",
        "us-east1-a"
      ]
    }
  ]
}

3. Create a VM

Specify the name, type, location, image and your ssh_public_key

POST /v0.1/projects/{project_id}/vms HTTP/1.1
Host: api.mkinf.io
Content-Type: application/json
Authorization: Bearer {{access_token}}

{
  "name": "mkinf-node-01",
  "type": "l40s-48gb.2x",
  "location": "us-southcentral1-a",
  "image": "ubuntu22.04-nvidia-pcie-docker"
  "ssh_public_key": "ssh-rsa AAAAB..."
}

You can also specify a startup_script as well as a shutdown_script.

Response: A successful response from this resource will contain the async operation.

{
  "operation": {
    "operation_id": "a8c24ef2-5b52-41b3-819c-f78f6c2fbff9",
    "state": "IN_PROGRESS",
    "metadata": { ... },
    "result": null,
    "started_at": "2024-06-16T20:12:16Z",
    "completed_at": ""
  }
}

4. Check VM Operation Status

Use the operation_id to check the VM operation status.

GET /v0.1/projects/{project_id}/vms/operations/{operation_id} HTTP/1.1
Host: api.mkinf.io
Authorization: Bearer {{access_token}}

Response: In a few seconds, the VM should be ready.

{
  "operation_id": "2d8fde0c-4115-462c-9bf3-547d6dae1555",
  "state": "SUCCEEDED",
  "metadata": {
    "operation_name": "CREATE",
    "id": "b3e571f6-c87d-4135-8081-ab219e92544e",
    "type": "vm",
    "request": { ... }
  },
  "result": { ... },
  "started_at": "2024-06-16T15:52:41Z",
  "completed_at": "2024-06-16T15:52:53Z"
}

5. Get VM

Use metadata.id to retrieve the instance you just created.

GET /v0.1/projects/{project_id}/vms/{vm_id} HTTP/1.1
Host: api.mkinf.io
Authorization: Bearer {{access_token}}

Response:

{
  "id": "b3e571f6-c87d-4135-8081-ab219e92544e",
  "project_id": "3291380a-19e9-4892-a139-2fa92aa740e2",
  "type": "l40s-48gb.1x",
  "state": "STATE_RUNNING",
  "ssh_destination": ":0",
  "created_at": "2024-06-16T15:52:41Z",
  "updated_at": "2024-06-16T15:52:53Z",
  "name": "mkinf-node",
  "location": "us-east1-a",
  "commitment_period": 0,
  "commitment_end": "",
  "disks": [
    {
      "id": "52822513-e425-4be9-8dd8-5c21d561ce11",
      "name": "OS-disk-b3e571f6-c87d-4135-8081-ab219e92544e",
      "type": "persistent-ssd",
      "size": "128GiB",
      "location": "vaeq-cu",
      "block_size": 0,
      "created_at": "2024-06-16T15:52:43Z",
      "updated_at": "2024-06-16T15:52:44Z",
      "serial_number": "B74EEFE8EFA0988490E",
      "attachment_type": "os",
      "mode": "read-write"
    }
  ],
  "network_interfaces": [
    {
      "id": "fdf58fb1-0185-40f2-aa20-b620e8a8562d",
      "name": "default-network-interface",
      "network": "695b751c-2eaa-4e8b-8eb2-84cb367a69fe",
      "subnet": "7ceecd34-2631-4857-ad82-ceb9dfd09425",
      "interface_type": "Ethernet",
      "mac_address": "2e:2f:ae:ef:ae:16",
      "ips": [
        {
          "private_ipv4": {
            "address": "172.27.23.237"
          },
          "public_ipv4": {
            "address": "204.52.24.84",
            "id": "e130674a-c05e-4345-b8a4-7928c6649574",
            "type": "dynamic"
          }
        }
      ]
    }
  ],
  "host_channel_adapters": [],
  "virtualization_features": {
    "nested_virtualization": false
  },
  "instance_template_id": "",
  "instance_group_id": "",
  "reservation_id": ""
}

6. SSH Connection

Use the IP address to connect to your instance via SSH.

ssh -i ~/.ssh/YOUR_PRIVATE_KEY user@INSTANCE_IP_ADDRESS

Replace YOUR_PRIVATE_KEY with the path to your private SSH key and INSTANCE_IP_ADDRESS with the IP address of your instance (public_ipv4.address).

7. Deallocate instances

When you don’t need an instance anymore you can terminate it.

Firewall Rules

Setup your VPC Firewall Rules to have desidered access to VMs.

POST /v0.1/projects/{project_id}/vpc/firewall-rules HTTP/1.1
Host: api.mkinf.io
Content-Type: application/json
Authorization: Bearer {{access_token}}

{
  "name": "mkinf-allow-tcp-udp",
  "action": "allow",
  "destinations": [
    {
      "resource_id": "75dbe735-17d6-4544-91f3-0f93c2c1c903"
    }
  ],
  "direction": "ingress",
  "protocols": [
    "tcp",
    "udp"
  ],
  "sources": [
    {
      "cidr": "0.0.0.0/0"
    }
  ],
  "vpc_network_id": "695b751c-2eaa-4e8b-8eb2-84cb367a69fe"
}

Use List Networks to retrieve your vpc_network_id and List VMs to retrieve your VM id and set it as resource_id.

Usage

You can use Usage to retreives the products usage. Usage is updated daily shortly after midnight UTC.

Additional Tips

  • API Documentation: Refer to the detailed API documentation for more advanced features and configurations.
  • Support: Contact mkinf support for any issues or questions regarding API usage at info@mkinf.io.