# Seedance Pro

{% hint style="info" %}
Чтобы отправлять авторизованные запросы нужно получить API ключ, как это сделать написано в разделе [**С чего начать?**](https://docs.gptunnel.ru/)
{% endhint %}

## Запрос

<mark style="color:green;">`POST`</mark> `https://gptunnel.ru/v1/media/create`

Асинхронный запрос вернёт задачу и её идентификатор — сохраните его для последующего получения ссылки на результат.

## Пример запроса /create

{% tabs %}
{% tab title="NodeJS" %}

```typescript
import axios from 'axios'

const request = axios({
  method: 'POST',
  url: 'https://gptunnel.ru/v1/media/create',
  headers: {
    // use your API key here
    Authorization: 'YOUR_API_KEY',
  },
  data: {
    model:"seedance-1-pro-1080P-5s",
    ar: "1:1",
    prompt: "The camera not moving and filming a large stack of vintage televisions all showing different programs — 1950s sci-fi movies, horror movies, news, static, a 1970s sitcom, etc, set inside a large New York warehouse."
  },
})

request.then((result) => {
  console.log(result)
}).catch((error) => {
  console.error(error)
})
```

{% endtab %}

{% tab title="Curl" %}

```bash
curl --request POST \
  --url https://gptunnel.ru/v1/media/create \
  --header 'Authorization: YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "model":"seedance-1-pro-1080P-5s",
    "ar": "1:1",
    "prompt": "The camera not moving and filming a large stack of vintage televisions all showing different programs — 1950s sci-fi movies, horror movies, news, static, a 1970s sitcom, etc, set inside a large New York warehouse."
}'
```

{% endtab %}
{% endtabs %}

#### Request Body

| Name                                     | Type           | Description                                                                              |
| ---------------------------------------- | -------------- | ---------------------------------------------------------------------------------------- |
| model<mark style="color:red;">\*</mark>  | string         | Уникальный ID модели                                                                     |
| prompt<mark style="color:red;">\*</mark> | string         | Промпт запроса                                                                           |
| images                                   | Array\<string> | Массив ссылок на изображения для контекста, принимает только 1 изображение (первый кадр) |
| ar                                       | string         | Соотношение сторон, допустимые значения '1:1', '16:9', '9:16'                            |

#### Headers

| Name                                            | Type   | Description |
| ----------------------------------------------- | ------ | ----------- |
| Authorization<mark style="color:red;">\*</mark> | string | API ключ    |

## Пример ответа /create

```jsonp
{
	"code": 0,
	"id": "687fbd658a5526000178d729",
	"model": "seedance-1-pro-1080P-5s",
	"prompt": "The camera not moving and filming a large stack of vintage televisions all showing different programs — 1950s sci-fi movies, horror movies, news, static, a 1970s sitcom, etc, set inside a large New York warehouse. --ar 1:1",
	"created_at": 1753202021,
	"status": "idle",
	"url": null
}
```

После получения 24-значного идентификатора задачи вы можете вызвать метод для получения результата.

<mark style="color:green;">`POST`</mark> `https://gptunnel.ru/v1/media/result`

Запрос можно вызвать как **POST** так и **GET** методом передав `task_id` в query либо в body. Результатом выполнения запроса будет json объект с ссылкой на изображение.

## Пример запроса /result

{% tabs %}
{% tab title="NodeJS" %}

```typescript
import axios from 'axios'

const request = axios({
  method: 'POST',
  url: 'https://gptunnel.ru/v1/media/result',
  headers: {
    // use your API key here
    Authorization: 'YOUR_API_KEY',
  },
  data: {
    task_id:"687fbd658a5526000178d729"
  },
})

request.then((result) => {
  console.log(result)
}).catch((error) => {
  console.error(error)
})
```

{% endtab %}

{% tab title="Curl" %}

```bash
curl --request POST \
  --url https://gptunnel.ru/v1/media/result \
  --header 'Authorization: YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "task_id":"687fbd658a5526000178d729"
  }'
```

{% endtab %}
{% endtabs %}

## Пример ответа /result

```jsonp
{
	"code": 0,
	"id": "687fbd658a5526000178d729",
	"model": "seedance-1-pro-1080P-5s",
	"prompt": "The camera not moving and filming a large stack of vintage televisions all showing different programs — 1950s sci-fi movies, horror movies, news, static, a 1970s sitcom, etc, set inside a large New York warehouse. --ar 1:1",
	"created_at": 1753202021,
	"status": "done",
	"url": "https://timenote.storage.yandexcloud.net/predication/687fbd658a5526000178d729_result.mp4"
}
```

{% file src="<https://1859504775-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPKoICCojZs9hCiX1hcZe%2Fuploads%2FhJs4KTOekFyeLxDTcHxi%2F687fbd658a5526000178d729_result.mp4?alt=media&token=6b066623-52af-46f7-a238-b29716102c5a>" %}

{% hint style="warning" %}
Ссылка на файл доступна в течение 48 часов. Если вы планируете получить доступ к сгенерированному файлу позже, рекомендуется сохранить его на вашем ресурсе.
{% endhint %}
