> ## Documentation Index
> Fetch the complete documentation index at: https://apidoc.cometapi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Создать performance персонажа Runway

> Используйте CometAPI с API Runway Control a character, чтобы запускать задачи performance персонажа из эталонного видео, управляя мимикой и движениями тела.

Используйте этот endpoint, чтобы перенести performance из референсного клипа на изображение персонажа или видео персонажа.

## Перед вызовом

* Отправьте обязательный заголовок `X-Runway-Version`, например `2024-11-06`
* Используйте `model: act_two`
* Укажите один asset `character` и один asset `reference` в виде доступных HTTPS URL
* Начните с `bodyControl: true` и умеренного `expressionIntensity`, прежде чем настраивать стиль

## Соотношение сторон вывода

| Настройка | Поддерживаемые значения                                                                        | Стартовое значение по умолчанию | Поведение на границах                                                                     |
| --------- | ---------------------------------------------------------------------------------------------- | ------------------------------- | ----------------------------------------------------------------------------------------- |
| `ratio`   | `1280:720`, `720:1280` или другое соотношение, поддерживаемое выбранной моделью/версией Runway | `1280:720`                      | Старайтесь, чтобы assets `character` и `reference` были близки к запрошенной форме кадра. |

## Поток задачи

<Steps>
  <Step title="Отправьте запрос character-performance">
    Создайте задачу с вашим asset `character`, asset `reference` и настройками движения.
  </Step>

  <Step title="Сохраните возвращённый task id">
    Сохраните возвращённый `id`, потому что он понадобится для последующего опроса.
  </Step>

  <Step title="Опрашивайте статус задачи">
    Продолжайте с [Get a Runway task](./runway-to-get-task-details), пока задача не достигнет конечного состояния и metadata провайдера не будет включать готовый результат.
  </Step>
</Steps>

## Роли входных данных

* `character` — это объект, который вы хотите анимировать
* `reference` — это исходный клип, который задаёт мимику или движения тела
* `bodyControl` определяет, включает ли перенос движения движения тела в дополнение к переносу мимики
* `contentModeration` применяет пороги модерации провайдера к запросу


## OpenAPI

````yaml api/openapi/video/runway/official-format/post-control-a-character.openapi.json POST /runwayml/v1/character_performance
openapi: 3.1.0
info:
  title: Control a Character API
  version: 1.0.0
  description: >-
    Create a Runway character-performance task through the official-format
    CometAPI route.
servers:
  - url: https://api.cometapi.com
security:
  - bearerAuth: []
paths:
  /runwayml/v1/character_performance:
    post:
      summary: Create a Runway character-performance task
      description: >-
        Submit a character asset plus a reference performance clip and receive a
        task id for later polling.
      operationId: control_a_character
      parameters:
        - name: X-Runway-Version
          in: header
          required: true
          description: Runway version header, for example `2024-11-06`.
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - character
                - reference
                - bodyControl
                - expressionIntensity
                - seed
                - model
                - ratio
                - contentModeration
              properties:
                character:
                  type: object
                  description: >-
                    The character to control. You can either provide a video or
                    an image.
                  required:
                    - type
                    - uri
                  properties:
                    type:
                      type: string
                    uri:
                      type: string
                  default:
                    type: video
                    uri: https://your-video-host/source.mp4
                reference:
                  type: object
                  description: >-
                    Reference performance clip. Provide `type` (`video`) and
                    `uri` (HTTPS URL).
                  required:
                    - type
                    - uri
                  properties:
                    type:
                      type: string
                    uri:
                      type: string
                  default:
                    type: video
                    uri: https://your-video-host/source.mp4
                bodyControl:
                  type: boolean
                  description: Enable body control.
                  default: true
                expressionIntensity:
                  type: integer
                  description: >-
                    Intensity of the expression transfer. Higher values produce
                    more exaggerated expressions.
                  default: 1
                seed:
                  type: integer
                  description: Random seed for reproducible results.
                  default: 1
                model:
                  type: string
                  description: The model variant to use. Must be act_two.
                  default: act_two
                ratio:
                  type: string
                  description: >-
                    Requested output frame shape, for example 1280:720 or
                    720:1280. Keep the character and reference assets close to
                    the requested frame shape.
                  default: '1280:720'
                contentModeration:
                  type: object
                  required:
                    - publicFigureThreshold
                  properties:
                    publicFigureThreshold:
                      type: string
                      description: >-
                        Threshold for public-figure detection. Use `auto` for
                        default behavior.
                  default:
                    publicFigureThreshold: auto
              default:
                character:
                  type: video
                  uri: https://your-video-host/source.mp4
                reference:
                  type: video
                  uri: https://your-video-host/source.mp4
                bodyControl: true
                expressionIntensity: 1
                seed: 1
                model: act_two
                ratio: '1280:720'
                contentModeration:
                  publicFigureThreshold: auto
            examples:
              Default:
                summary: Default
                value:
                  character:
                    type: video
                    uri: https://your-video-host/source.mp4
                  reference:
                    type: video
                    uri: https://your-video-host/source.mp4
                  bodyControl: true
                  expressionIntensity: 3
                  seed: 4294967295
                  model: act_two
                  ratio: '1280:720'
                  contentModeration:
                    publicFigureThreshold: auto
      responses:
        '200':
          description: Task accepted.
          content:
            application/json:
              schema:
                type: object
                required:
                  - id
                properties:
                  id:
                    type: string
                example:
                  id: 5b91e444-c232-deaf-a4d7-8aef3e57336b
      x-codeSamples:
        - lang: Shell
          label: Default
          source: |
            curl https://api.cometapi.com/runwayml/v1/character_performance \
              -H "Authorization: Bearer $COMETAPI_KEY" \
              -H "Content-Type: application/json" \
              -d '{
                  "character": {
                    "type": "video",
                    "uri": "https://your-video-host/character.mp4"
                  },
                  "reference": {
                    "type": "video",
                    "uri": "https://your-video-host/performance.mp4"
                  },
                  "model": "act_two",
                  "ratio": "1280:720"
                }'
        - lang: Python
          label: Default
          source: >
            import os

            import requests


            response = requests.post(
                "https://api.cometapi.com/runwayml/v1/character_performance",
                headers={"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]},
                json={
                        "character": {
                                "type": "video",
                                "uri": "https://your-video-host/character.mp4"
                        },
                        "reference": {
                                "type": "video",
                                "uri": "https://your-video-host/performance.mp4"
                        },
                        "model": "act_two",
                        "ratio": "1280:720"
                },
            )


            task = response.json()

            print(task["id"])  # poll GET /runwayml/v1/tasks/{id} until the
            output array appears
        - lang: JavaScript
          label: Default
          source: >
            const response = await
            fetch("https://api.cometapi.com/runwayml/v1/character_performance",
            {
                method: "POST",
                headers: {
                    Authorization: `Bearer ${process.env.COMETAPI_KEY}`,
                    "Content-Type": "application/json",
                },
                body: JSON.stringify({
                        "character": {
                            "type": "video",
                            "uri": "https://your-video-host/character.mp4"
                        },
                        "reference": {
                            "type": "video",
                            "uri": "https://your-video-host/performance.mp4"
                        },
                        "model": "act_two",
                        "ratio": "1280:720"
                    }),
            });


            const task = await response.json();

            console.log(task.id); // poll GET /runwayml/v1/tasks/{id} until the
            output array appears
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Bearer token authentication. Use your CometAPI key.

````