# Vast.ai Integration via LowCodeAPI

## Overview

Decentralized GPU marketplace for AI model training and inference, offering cost-effective GPU rental solutions.

## Base Endpoint

```
https://api.lowcodeapi.com/vastai/
```

## Authentication

LowCodeAPI handles authentication automatically. You only need to:

1. **Sign up** at [Vast.ai](https://vast.ai)
2. **Get your credentials** from [credential page](https://vast.ai/console/account)
3. **Connect your account** in LowCodeAPI dashboard
4. **Use your `api_token`** in all requests

**Auth Type**: TOKEN

## API Categories

- **Account** - 1 endpoints
- **Bids** - 5 endpoints
- **Instances** - 7 endpoints
- **Invoices** - 2 endpoints
- **Machines** - 5 endpoints
- **Offers** - 2 endpoints
- **SSH Keys** - 3 endpoints
- **Templates** - 5 endpoints
- **Users** - 3 endpoints

## Common Endpoints

### Category: Account

#### Get account balance

**Method**: `GET` | **LowCodeAPI Path**: `/balance`

**Full URL**:
```
https://api.lowcodeapi.com/vastai/balance?api_token={api_token}
```

**Description**: Get your account balance

---

### Category: Bids

#### List bids

**Method**: `GET` | **LowCodeAPI Path**: `/bids`

**Full URL**:
```
https://api.lowcodeapi.com/vastai/bids?owner_id={owner_id}&limit={limit}&offset={offset}&api_token={api_token}
```

**Description**: List all bids you have created

**Query Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
|`owner_id` | string | No | Filter by owner ID |
|`limit` | number | No | Maximum number of results to return |
|`offset` | number | No | Offset for pagination |

---

#### Get bid details

**Method**: `GET` | **LowCodeAPI Path**: `/bids/bid_id`

**Full URL**:
```
https://api.lowcodeapi.com/vastai/bids/bid_id?bid_id={bid_id}&api_token={api_token}
```

**Description**: Get detailed information about a specific bid

**Path Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
|`bid_id` | string | Yes | The ID of the bid |

---

#### Create new bid

**Method**: `POST` | **LowCodeAPI Path**: `/bids`

**Full URL**:
```
https://api.lowcodeapi.com/vastai/bids?api_token={api_token}
```

**Description**: Create a new bid for GPU resources

**Request Body**:
```json
{
  "price": "<number>",
  "duration": "<number>",
  "num_gpus": "<number>"
}
```

---

#### Update bid

**Method**: `PUT` | **LowCodeAPI Path**: `/bids/bid_id`

**Full URL**:
```
https://api.lowcodeapi.com/vastai/bids/bid_id?bid_id={bid_id}&api_token={api_token}
```

**Description**: Update an existing bid

**Path Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
|`bid_id` | string | Yes | The ID of the bid |

**Request Body**:
```json
{
  "key": "value"
}
```

---

#### Delete bid

**Method**: `DELETE` | **LowCodeAPI Path**: `/bids/bid_id`

**Full URL**:
```
https://api.lowcodeapi.com/vastai/bids/bid_id?bid_id={bid_id}&api_token={api_token}
```

**Description**: Delete a bid

**Path Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
|`bid_id` | string | Yes | The ID of the bid |

---

### Category: Instances

#### List instances

**Method**: `GET` | **LowCodeAPI Path**: `/instances`

**Full URL**:
```
https://api.lowcodeapi.com/vastai/instances?owner_id={owner_id}&state={state}&limit={limit}&offset={offset}&api_token={api_token}
```

**Description**: List all instances you own or have access to

**Query Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
|`owner_id` | string | No | Filter by owner ID |
|`state` | string | No | Filter by instance state |
|`limit` | number | No | Maximum number of results to return |
|`offset` | number | No | Offset for pagination |

---

#### Get instance details

**Method**: `GET` | **LowCodeAPI Path**: `/instances/instance_id`

**Full URL**:
```
https://api.lowcodeapi.com/vastai/instances/instance_id?instance_id={instance_id}&api_token={api_token}
```

**Description**: Get detailed information about a specific instance

**Path Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
|`instance_id` | string | Yes | The ID of the instance |

---

#### Create new instance

**Method**: `POST` | **LowCodeAPI Path**: `/instances`

**Full URL**:
```
https://api.lowcodeapi.com/vastai/instances?api_token={api_token}
```

**Description**: Create a new instance from an offer

**Request Body**:
```json
{
  "offer_id": "<string>",
  "image": "<string>",
  "disk": "<number>"
}
```

---

#### Update instance

**Method**: `PUT` | **LowCodeAPI Path**: `/instances/instance_id`

**Full URL**:
```
https://api.lowcodeapi.com/vastai/instances/instance_id?instance_id={instance_id}&api_token={api_token}
```

**Description**: Update an existing instance

**Path Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
|`instance_id` | string | Yes | The ID of the instance |

**Request Body**:
```json
{
  "key": "value"
}
```

---

#### Stop instance

**Method**: `POST` | **LowCodeAPI Path**: `/instances/instance_id/stop`

**Full URL**:
```
https://api.lowcodeapi.com/vastai/instances/instance_id/stop?instance_id={instance_id}&api_token={api_token}
```

**Description**: Stop a running instance

**Path Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
|`instance_id` | string | Yes | The ID of the instance |

---

#### Start instance

**Method**: `POST` | **LowCodeAPI Path**: `/instances/instance_id/start`

**Full URL**:
```
https://api.lowcodeapi.com/vastai/instances/instance_id/start?instance_id={instance_id}&api_token={api_token}
```

**Description**: Start a stopped instance

**Path Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
|`instance_id` | string | Yes | The ID of the instance |

---

#### Delete instance

**Method**: `DELETE` | **LowCodeAPI Path**: `/instances/instance_id`

**Full URL**:
```
https://api.lowcodeapi.com/vastai/instances/instance_id?instance_id={instance_id}&api_token={api_token}
```

**Description**: Delete an instance

**Path Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
|`instance_id` | string | Yes | The ID of the instance |

---

### Category: Invoices

#### List invoices

**Method**: `GET` | **LowCodeAPI Path**: `/invoices`

**Full URL**:
```
https://api.lowcodeapi.com/vastai/invoices?limit={limit}&offset={offset}&api_token={api_token}
```

**Description**: List all invoices for your account

**Query Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
|`limit` | number | No | Maximum number of results to return |
|`offset` | number | No | Offset for pagination |

---

#### Get invoice details

**Method**: `GET` | **LowCodeAPI Path**: `/invoices/invoice_id`

**Full URL**:
```
https://api.lowcodeapi.com/vastai/invoices/invoice_id?invoice_id={invoice_id}&api_token={api_token}
```

**Description**: Get detailed information about a specific invoice

**Path Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
|`invoice_id` | string | Yes | The ID of the invoice |

---

### Category: Machines

#### List your machines

**Method**: `GET` | **LowCodeAPI Path**: `/machines`

**Full URL**:
```
https://api.lowcodeapi.com/vastai/machines?owner_id={owner_id}&limit={limit}&offset={offset}&api_token={api_token}
```

**Description**: List all machines you own or have access to

**Query Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
|`owner_id` | string | No | Filter by owner ID |
|`limit` | number | No | Maximum number of results to return |
|`offset` | number | No | Offset for pagination |

---

#### Get machine details

**Method**: `GET` | **LowCodeAPI Path**: `/machines/machine_id`

**Full URL**:
```
https://api.lowcodeapi.com/vastai/machines/machine_id?machine_id={machine_id}&api_token={api_token}
```

**Description**: Get detailed information about a specific machine

**Path Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
|`machine_id` | string | Yes | The ID of the machine |

---

#### Create a new machine offer

**Method**: `POST` | **LowCodeAPI Path**: `/machines`

**Full URL**:
```
https://api.lowcodeapi.com/vastai/machines?api_token={api_token}
```

**Description**: Create a new machine offer on the marketplace

**Request Body**:
```json
{
  "machine_id": "<string>",
  "price": "<number>"
}
```

---

#### Update machine offer

**Method**: `PUT` | **LowCodeAPI Path**: `/machines/machine_id`

**Full URL**:
```
https://api.lowcodeapi.com/vastai/machines/machine_id?machine_id={machine_id}&api_token={api_token}
```

**Description**: Update an existing machine offer

**Path Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
|`machine_id` | string | Yes | The ID of the machine |

**Request Body**:
```json
{
  "key": "value"
}
```

---

#### Delete machine offer

**Method**: `DELETE` | **LowCodeAPI Path**: `/machines/machine_id`

**Full URL**:
```
https://api.lowcodeapi.com/vastai/machines/machine_id?machine_id={machine_id}&api_token={api_token}
```

**Description**: Delete a machine offer from the marketplace

**Path Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
|`machine_id` | string | Yes | The ID of the machine |

---

### Category: Offers

#### List available GPU offers

**Method**: `GET` | **LowCodeAPI Path**: `/offers`

**Full URL**:
```
https://api.lowcodeapi.com/vastai/offers?type={type}&q={q}&sort_option={sort_option}&order={order}&limit={limit}&offset={offset}&api_token={api_token}
```

**Description**: List available GPU offers on the marketplace

**Query Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
|`type` | string | No | Filter by offer type |
|`q` | string | No | Search query for offers |
|`sort_option` | string | No | Sort option for offers |
|`order` | string | No | Sort order (asc or desc) |
|`limit` | number | No | Maximum number of results to return |
|`offset` | number | No | Offset for pagination |

---

#### Get specific offer details

**Method**: `GET` | **LowCodeAPI Path**: `/offers/offer_id`

**Full URL**:
```
https://api.lowcodeapi.com/vastai/offers/offer_id?offer_id={offer_id}&api_token={api_token}
```

**Description**: Get detailed information about a specific offer

**Path Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
|`offer_id` | string | Yes | The ID of the offer |

---

### Category: SSH Keys

#### List SSH keys

**Method**: `GET` | **LowCodeAPI Path**: `/ssh_keys`

**Full URL**:
```
https://api.lowcodeapi.com/vastai/ssh_keys?api_token={api_token}
```

**Description**: List all SSH keys for your account

---

#### Add SSH key

**Method**: `POST` | **LowCodeAPI Path**: `/ssh_keys`

**Full URL**:
```
https://api.lowcodeapi.com/vastai/ssh_keys?api_token={api_token}
```

**Description**: Add a new SSH key to your account

**Request Body**:
```json
{
  "name": "<string>",
  "public_key": "<string>"
}
```

---

#### Delete SSH key

**Method**: `DELETE` | **LowCodeAPI Path**: `/ssh_keys/ssh_key_id`

**Full URL**:
```
https://api.lowcodeapi.com/vastai/ssh_keys/ssh_key_id?ssh_key_id={ssh_key_id}&api_token={api_token}
```

**Description**: Delete an SSH key from your account

**Path Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
|`ssh_key_id` | string | Yes | The ID of the SSH key |

---

### Category: Templates

#### List templates

**Method**: `GET` | **LowCodeAPI Path**: `/templates`

**Full URL**:
```
https://api.lowcodeapi.com/vastai/templates?owner_id={owner_id}&limit={limit}&offset={offset}&api_token={api_token}
```

**Description**: List all templates you own or have access to

**Query Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
|`owner_id` | string | No | Filter by owner ID |
|`limit` | number | No | Maximum number of results to return |
|`offset` | number | No | Offset for pagination |

---

#### Get template details

**Method**: `GET` | **LowCodeAPI Path**: `/templates/template_id`

**Full URL**:
```
https://api.lowcodeapi.com/vastai/templates/template_id?template_id={template_id}&api_token={api_token}
```

**Description**: Get detailed information about a specific template

**Path Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
|`template_id` | string | Yes | The ID of the template |

---

#### Create template

**Method**: `POST` | **LowCodeAPI Path**: `/templates`

**Full URL**:
```
https://api.lowcodeapi.com/vastai/templates?api_token={api_token}
```

**Description**: Create a new template

**Request Body**:
```json
{
  "name": "<string>",
  "image": "<string>"
}
```

---

#### Update template

**Method**: `PUT` | **LowCodeAPI Path**: `/templates/template_id`

**Full URL**:
```
https://api.lowcodeapi.com/vastai/templates/template_id?template_id={template_id}&api_token={api_token}
```

**Description**: Update an existing template

**Path Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
|`template_id` | string | Yes | The ID of the template |

**Request Body**:
```json
{
  "key": "value"
}
```

---

#### Delete template

**Method**: `DELETE` | **LowCodeAPI Path**: `/templates/template_id`

**Full URL**:
```
https://api.lowcodeapi.com/vastai/templates/template_id?template_id={template_id}&api_token={api_token}
```

**Description**: Delete a template

**Path Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
|`template_id` | string | Yes | The ID of the template |

---

### Category: Users

#### Get current user information

**Method**: `GET` | **LowCodeAPI Path**: `/users/me`

**Full URL**:
```
https://api.lowcodeapi.com/vastai/users/me?api_token={api_token}
```

**Description**: Get information about the current authenticated user

---

#### Get user information

**Method**: `GET` | **LowCodeAPI Path**: `/users/user_id`

**Full URL**:
```
https://api.lowcodeapi.com/vastai/users/user_id?user_id={user_id}&api_token={api_token}
```

**Description**: Get information about a specific user

**Path Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
|`user_id` | string | Yes | The ID of the user |

---

#### Update current user

**Method**: `PUT` | **LowCodeAPI Path**: `/users/me`

**Full URL**:
```
https://api.lowcodeapi.com/vastai/users/me?api_token={api_token}
```

**Description**: Update current user information

**Request Body**:
```json
{
  "key": "value"
}
```

---

## Complete Endpoint Reference

For a complete list of all 33 endpoints, refer to:
- **OpenAPI Definition**: `https://backend.lowcodeapi.com/vastai/definition`
- **Official Provider Documentation**: https://vast.ai/docs