# Create Model

This operation costs **50 credits.**

#### Endpoint

```
POST /api/models
```

#### Parameters

<table><thead><tr><th width="230">Parameter</th><th>Type</th><th>Required</th><th>Description</th></tr></thead><tbody><tr><td><code>images</code></td><td>array[file]</td><td>Yes. Required if <code>image_urls</code> is not provided.</td><td>List of images representing the model's dataset. Must be a list on length 1 to 30. </td></tr><tr><td><code>image_urls</code></td><td>array[string]</td><td>Yes. Required if <code>images</code> is not provided.</td><td>List of image URLs representing the model's dataset. Must be a list on length 1 to 30. </td></tr><tr><td><code>gender</code></td><td>string</td><td>Yes</td><td>Possible values: <code>woman</code>, <code>man</code>. </td></tr><tr><td><code>model_type</code></td><td>string</td><td>Yes</td><td>Possible values: <code>professional</code>, <code>amateur</code>. </td></tr><tr><td><code>name</code></td><td>string</td><td>No</td><td>Name of the model</td></tr><tr><td><code>callback</code></td><td>string</td><td>No</td><td>A URL that will be called when the model is done training. If not provided, an email will be sent when it is trained.</td></tr></tbody></table>

**Sending Images for Training**

To create a new model, you need to send a list of images that will be used for training. You can send the images in two ways: by uploading the image files directly or by providing a list of image URLs.

1. **Uploading Image Files**

To upload image files, you need to send a `multipart/form-data` request with the image files attached.&#x20;

**Example Request**

Here's an example of how you can send a `multipart/form-data` request using `curl`:

```bash
curl -X POST \
  https://api.deepmode.ai/api/models \
  -H 'Authorization: Bearer YOUR_SECRET_API_KEY' \
  -H 'Content-Type: multipart/form-data' \
  -F 'images=@/path/to/image1.jpg' \
  -F 'images=@/path/to/image2.jpg' \
  -F 'images=@/path/to/image3.jpg' \
  -F 'gender=woman' \
  -F 'model_type=amateur'
```

2. **Providing Image URLs**

Alternatively, you can provide a list of image URLs instead of uploading the image files directly. The request body should contain `image_urls`. The image URLs should be publicly accessible.

**Example Request**

Here's an example of how you can send a JSON request with a list of image URLs:

```bash
curl -X POST \
  https://api.deepmode.ai/api/models \
  -H 'Authorization: Bearer YOUR_SECRET_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
        "image_urls": [
          "https://example.com/image1.jpg",
          "https://example.com/image2.jpg",
          "https://example.com/image3.jpg"
        ],
        "gender": "woman",
        "model_type": "amateur"
      }'
```

**Important Notes**

* The maximum number of images you can send is 30.
* The images should be in one of the following formats: jpg, jpeg, png, webp, or heic.
* The API will validate the images and return an error if any of the images are invalid or cannot be accessed.

#### Response

Upon successful creation, the API returns the following response:

```json
// Response for request
{"message": "Created model successfully"}

// Response for callback
{
  "id": "c6b8a9f7e5d1c3a2f91e3",
  "name": "My model",
  "gender": "woman",
  "active": true,
  "created_at": "2024-04-01T12:00:00Z",
  "expire_at": "2024-05-01T12:00:00Z"
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://deepmode.gitbook.io/docs/api-endpoints/handling-models/create-model.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
