# AI Model


<style>
  span[class^="pill-"] {
    color: white;
    padding: 2px 12px;
    border-radius: 12px;
    font-size: 0.6em;
    vertical-align: middle;
    margin-right: 12px;
    font-family: sans-serif;
    font-weight: bold;
    display: inline-block;
    line-height: 1;
  }
  span.pill-GET { background-color: #61affe; }
  span.pill-POST { background-color: #49cc90; }
  span.pill-PUT { background-color: #fca130; }
  span.pill-DELETE { background-color: #f93e3e; }
  span.pill-PATCH { background-color: #50e3c2; }
  span[class^="pill-"]:after {
    content: attr(data-label);
    font-size: 0.9rem;
  }
</style>

Lifecycle of AI Models.

[Read more](https://www.exoscale.com/ai-cloud-infrastructure/dedicated-inference/)

## <span data-label="POST" class="pill-POST"></span>create-model

Create Model

```
POST /ai/model
```

Model files will be downloaded from Huggingface.

Name must be the exact name of the model on huggingface (ex: openai/gpt-oss-120b or ggml-org/gpt-oss-120b-GGUF).

If the model is under a license then you must provide a Huggingface access token for an account that signed the license agreement

### Request body

Content-Type: `application/json`

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | **yes** | Model name |
| `huggingface-token` | string | no | Huggingface Token |

<details>
<summary>Example</summary>

```json
{
  "huggingface-token": "string",
  "name": "string"
}
```
</details>


### Responses

**`200`**: 200

Content-Type: `application/json`

| Property | Type | Description |
| --- | --- | --- |
| `id` | string | Operation ID |
| `message` | string | Operation message |
| `reason` | string | Operation failure reason<br/><br/>Allowed values: `incorrect`, `unknown`, `unavailable`, `forbidden`, `busy`, `fault`, `partial`, `not-found`, `interrupted`, `unsupported`, `conflict`. |
| `reference` | [Reference](/reference/api/_schemas/operation/#reference) | Related resource reference |
| `state` | string | Operation status<br/><br/>Allowed values: `failure`, `pending`, `success`, `timeout`. |

<details>
<summary>Example output</summary>

```json
{
  "id": "string",
  "message": "string",
  "reason": "incorrect",
  "reference": {
    "command": "string",
    "id": "string",
    "link": "string"
  },
  "state": "failure"
}
```
</details>

**`403`**: 403

Content-Type: `application/json`

| Property | Type | Description |
| --- | --- | --- |
| `code` | string | Machine-readable forbidden error code<br/><br/>Allowed values: `forbidden_operation`. |
| `error` | string | Forbidden error message |

<details>
<summary>Example output</summary>

```json
{
  "code": "forbidden_operation",
  "error": "string"
}
```
</details>


SDK reference for `create-model`: [golang](https://pkg.go.dev/github.com/exoscale/egoscale/v3#Client.CreateModel) | [Python](https://exoscale.github.io/python-exoscale/v2.html#exoscale.api.v2.Client.create_model) | [Java](https://exoscale.github.io/exoscale-sdk-java/com/exoscale/sdk/api/ExoscaleApi.html#createModel(com.exoscale.sdk.model.CreateModelRequest))

[CLI](https://community.exoscale.com/tools/command-line-interface/): `exo api create-model`

## <span data-label="GET" class="pill-GET"></span>get-model

Get Model

```
GET /ai/model/{id}
```

Get Model details

### Path parameters

| Name | In | Description |
| --- | --- | --- |
| `id` | `path` |  |

### Responses

**`200`**: 200

Content-Type: `application/json`

| Property | Type | Description |
| --- | --- | --- |
| `created-at` | string | Creation time |
| `id` | string | Model ID |
| `model-size` | integer | Model size (nullable) |
| `name` | string | Model name |
| `state` | string | Model state<br/><br/>Allowed values: `ready`, `creating`, `downloading`, `error`, `created`. |
| `updated-at` | string | Update time |

<details>
<summary>Example output</summary>

```json
{
  "created-at": "2024-01-01T12:00:00Z",
  "id": "string",
  "model-size": 0,
  "name": "string",
  "state": "ready",
  "updated-at": "2024-01-01T12:00:00Z"
}
```
</details>

**`404`**: 404

Content-Type: `application/json`

| Property | Type | Description |
| --- | --- | --- |
| `detail` | string |  |
| `errors` | array of [Errors](/reference/api/_schemas/error-response/#errors) |  |
| `instance` | string |  |
| `status` | integer |  |
| `title` | string |  |
| `type` | string |  |

<details>
<summary>Example output</summary>

```json
{
  "detail": "string",
  "errors": [
    {
      "detail": "string",
      "location": "string",
      "path": "string",
      "pointer": "string"
    }
  ],
  "instance": "string",
  "status": 0,
  "title": "string",
  "type": "string"
}
```
</details>


SDK reference for `get-model`: [golang](https://pkg.go.dev/github.com/exoscale/egoscale/v3#Client.GetModel) | [Python](https://exoscale.github.io/python-exoscale/v2.html#exoscale.api.v2.Client.get_model) | [Java](https://exoscale.github.io/exoscale-sdk-java/com/exoscale/sdk/api/ExoscaleApi.html#getModel(java.util.UUID))

[CLI](https://community.exoscale.com/tools/command-line-interface/): `exo api get-model`

## <span data-label="DELETE" class="pill-DELETE"></span>delete-model

Delete Model

```
DELETE /ai/model/{id}
```

Delete Model

### Path parameters

| Name | In | Description |
| --- | --- | --- |
| `id` | `path` |  |

### Responses

**`200`**: 200

Content-Type: `application/json`

| Property | Type | Description |
| --- | --- | --- |
| `id` | string | Operation ID |
| `message` | string | Operation message |
| `reason` | string | Operation failure reason<br/><br/>Allowed values: `incorrect`, `unknown`, `unavailable`, `forbidden`, `busy`, `fault`, `partial`, `not-found`, `interrupted`, `unsupported`, `conflict`. |
| `reference` | [Reference](/reference/api/_schemas/operation/#reference) | Related resource reference |
| `state` | string | Operation status<br/><br/>Allowed values: `failure`, `pending`, `success`, `timeout`. |

<details>
<summary>Example output</summary>

```json
{
  "id": "string",
  "message": "string",
  "reason": "incorrect",
  "reference": {
    "command": "string",
    "id": "string",
    "link": "string"
  },
  "state": "failure"
}
```
</details>

**`403`**: 403

Content-Type: `application/json`

| Property | Type | Description |
| --- | --- | --- |
| `code` | string | Machine-readable forbidden error code<br/><br/>Allowed values: `forbidden_operation`. |
| `error` | string | Forbidden error message |

<details>
<summary>Example output</summary>

```json
{
  "code": "forbidden_operation",
  "error": "string"
}
```
</details>

**`404`**: 404

Content-Type: `application/json`

| Property | Type | Description |
| --- | --- | --- |
| `detail` | string |  |
| `errors` | array of [Errors](/reference/api/_schemas/error-response/#errors) |  |
| `instance` | string |  |
| `status` | integer |  |
| `title` | string |  |
| `type` | string |  |

<details>
<summary>Example output</summary>

```json
{
  "detail": "string",
  "errors": [
    {
      "detail": "string",
      "location": "string",
      "path": "string",
      "pointer": "string"
    }
  ],
  "instance": "string",
  "status": 0,
  "title": "string",
  "type": "string"
}
```
</details>

**`412`**: 412

Content-Type: `application/json`

| Property | Type | Description |
| --- | --- | --- |
| `deployments` | array[string] | Deployments using models |

<details>
<summary>Example output</summary>

```json
{
  "deployments": [
    "string"
  ]
}
```
</details>


SDK reference for `delete-model`: [golang](https://pkg.go.dev/github.com/exoscale/egoscale/v3#Client.DeleteModel) | [Python](https://exoscale.github.io/python-exoscale/v2.html#exoscale.api.v2.Client.delete_model) | [Java](https://exoscale.github.io/exoscale-sdk-java/com/exoscale/sdk/api/ExoscaleApi.html#deleteModel(java.util.UUID))

[CLI](https://community.exoscale.com/tools/command-line-interface/): `exo api delete-model`


---

## Other Operations

## <span data-label="GET" class="pill-GET"></span>list-models

List Models

```
GET /ai/model
```

List Models

### Query parameters

| Name | In | Required | Description |
| --- | --- | --- | --- |
| `visibility` | `query` | no |  |

### Responses

Status: `200` - 200

Content-Type: `application/json`

| Property | Type | Description |
| --- | --- | --- |
| `models` | array of [AI model](/reference/api/_schemas/list-models-response-entry/) |  |

<details>
<summary>Example output</summary>

```json
{
  "models": [
    {
      "created-at": "2024-01-01T12:00:00Z",
      "id": "string",
      "model-size": 0,
      "name": "string",
      "state": "ready",
      "updated-at": "2024-01-01T12:00:00Z"
    }
  ]
}
```
</details>


SDK reference for `list-models`: [golang](https://pkg.go.dev/github.com/exoscale/egoscale/v3#Client.ListModels) | [Python](https://exoscale.github.io/python-exoscale/v2.html#exoscale.api.v2.Client.list_models) | [Java](https://exoscale.github.io/exoscale-sdk-java/com/exoscale/sdk/api/ExoscaleApi.html#listModels(java.lang.String))

[CLI](https://community.exoscale.com/tools/command-line-interface/): `exo api list-models`


