> ## 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.

# 放大 Runway 视频

> 通过 CometAPI 使用 Magnific 放大视频，可选择从 720p 到 4k 的输出分辨率，并可选地控制细节。

使用 `magnific_video_upscaler_creative` 放大源视频。该请求
会返回任务 `id`，用于获取完成后的输出。

## 准备请求

* 使用你的 CometAPI API 密钥进行身份验证。
* 将 `model` 设置为 `magnific_video_upscaler_creative`，并提供 `videoUri`
  用于最长 30 秒的视频。
* 将示例视频 URL 替换为可访问的 HTTPS URL。`videoUri`
  也接受编码大小最大为 5 MB 的 Base64 视频数据 URI。
* 选择 `resolution`：`720p`、`1k`、`2k` 或 `4k`。省略该字段可使用 `2k`。

## 调整增强效果

| 字段 | 使用方法 |
| - | - |
| `creativity` | 要添加的生成细节量，范围从 `1` 到 `100`. |
| `sharpen` | 锐化强度，范围从 `1` 到 `100`. |
| `smartGrain` | 颗粒和纹理增强强度，范围从 `1` 到 `100`. |
| `flavor` | `vivid` 会强调色彩和细节；`natural` 更倾向于忠实还原。 |
| `fpsBoost` | 将 `true` 设置为请求提高输出帧率。 |

省略数值控制项可使用模型默认值。值 `0` 会被视为
省略，因此不会明确选择零强度。同样，
`fpsBoost: false` 会被视为省略，且不会明确禁用
帧率增强。请省略可选字段，而不要发送 `null`。

## 获取结果

保存返回的 `id`，并使用
[获取 Runway 任务](https://apidoc.cometapi.com/zh-Hans/api/video/runway/official-format/runway-to-get-task-details.md) 以获取任务状态。
当 `status` 为 `SUCCEEDED` 时，从 `output` 读取结果 URL。如果任务
失败，请在存在时检查 `failure` 和 `failureCode`。


## OpenAPI

````yaml api/openapi/video/runway/official-format/post-upscale-a-video.openapi.json POST /runwayml/v1/video_upscale
openapi: 3.1.0
info:
  title: Upscale a Runway video
  version: 1.0.0
  description: Create an asynchronous Runway task through CometAPI.
servers:
  - url: https://api.cometapi.com
security:
  - bearerAuth: []
paths:
  /runwayml/v1/video_upscale:
    post:
      summary: Upscale a Runway video
      description: >-
        Submit the request and save the returned id. Retrieve task details to
        read the status and output URLs.
      operationId: upscale_a_video
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              description: Magnific video-upscaling request.
              properties:
                model:
                  type: string
                  description: Model ID for this request.
                  enum:
                    - magnific_video_upscaler_creative
                videoUri:
                  description: >-
                    Video to upscale, with a maximum duration of 30 seconds. Use
                    an accessible HTTPS URL or a Base64 data URI with an encoded
                    size of up to 5 MB.
                  oneOf:
                    - type: string
                      description: Accessible HTTPS URL of the video.
                      pattern: ^https://
                      maxLength: 2048
                      minLength: 13
                    - type: string
                      description: Base64-encoded video, including its data URI prefix.
                      pattern: ^data:video/[^;]+;base64,
                      maxLength: 5242880
                      minLength: 13
                resolution:
                  type: string
                  description: Target output resolution. Omit for 2k.
                  enum:
                    - 720p
                    - 1k
                    - 2k
                    - 4k
                creativity:
                  type: integer
                  description: >-
                    Amount of generated detail to add. Use 1 through 100 for an
                    explicit setting. Omit to use the model default; 0 is
                    treated as omission.
                  minimum: 0
                  maximum: 100
                sharpen:
                  type: integer
                  description: >-
                    Sharpness intensity. Use 1 through 100 for an explicit
                    setting. Omit to use the model default; 0 is treated as
                    omission.
                  minimum: 0
                  maximum: 100
                smartGrain:
                  type: integer
                  description: >-
                    Grain and texture enhancement intensity. Use 1 through 100
                    for an explicit setting. Omit to use the model default; 0 is
                    treated as omission.
                  minimum: 0
                  maximum: 100
                flavor:
                  type: string
                  description: >-
                    Processing style: vivid emphasizes color and detail; natural
                    favors faithful reproduction.
                  enum:
                    - vivid
                    - natural
                fpsBoost:
                  type: boolean
                  description: >-
                    Set true to request an increased output frame rate. Omit to
                    leave this option unspecified; false is treated as omission.
              required:
                - model
                - videoUri
              additionalProperties: false
            example:
              model: magnific_video_upscaler_creative
              videoUri: https://example.com/source-video.mp4
              resolution: 2k
      responses:
        '200':
          description: The task was created. Save its id for task retrieval.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: Task ID for GET /runwayml/v1/tasks/{id}.
                  status:
                    type: string
                    description: Task state, when returned.
                  createdAt:
                    type: string
                    description: Task submission timestamp, when returned.
                    format: date-time
                  output:
                    type: array
                    description: Result URLs, when returned.
                    items:
                      type: string
                      format: uri
                  failure:
                    type: string
                    description: Failure explanation, when returned.
                  failureCode:
                    type: string
                    description: Machine-readable failure code, when returned.
                  estimatedCost:
                    type: object
                    description: Task estimate metadata, when returned.
                    properties:
                      credits:
                        type: integer
                        description: Credit value reported with the task.
                    required:
                      - credits
                    additionalProperties: false
                  cost:
                    type: object
                    description: Task cost metadata, when returned.
                    properties:
                      credits:
                        type: integer
                        description: Credit value reported with the task.
                    required:
                      - credits
                    additionalProperties: false
                required:
                  - id
                additionalProperties: false
              example:
                id: 00000000-0000-4000-8000-000000000000
        '400':
          description: Invalid request or unavailable task ID.
          content:
            application/json:
              schema:
                oneOf:
                  - type: object
                    description: Task request error.
                    properties:
                      code:
                        type:
                          - string
                          - integer
                        description: Machine-readable task error code.
                      message:
                        type: string
                        description: Error explanation.
                      data:
                        description: Additional error details, when returned.
                    required:
                      - code
                      - message
                    additionalProperties: true
                  - type: object
                    description: Request authentication or validation error.
                    properties:
                      error:
                        type: object
                        description: Error details.
                        properties:
                          message:
                            type: string
                            description: Error explanation.
                          type:
                            type: string
                            description: Error category.
                          code:
                            type:
                              - string
                              - integer
                              - 'null'
                            description: Error code, when returned.
                        required:
                          - message
                        additionalProperties: true
                    required:
                      - error
                    additionalProperties: true
        '401':
          description: Authentication failed.
          content:
            application/json:
              schema:
                type: object
                description: Request authentication or validation error.
                properties:
                  error:
                    type: object
                    description: Error details.
                    properties:
                      message:
                        type: string
                        description: Error explanation.
                      type:
                        type: string
                        description: Error category.
                      code:
                        type:
                          - string
                          - integer
                          - 'null'
                        description: Error code, when returned.
                    required:
                      - message
                    additionalProperties: true
                required:
                  - error
                additionalProperties: true
      x-codeSamples:
        - lang: Shell
          source: |-
            curl --request POST \
              --url https://api.cometapi.com/runwayml/v1/video_upscale \
              --header "Authorization: Bearer $COMETAPI_KEY" \
              --header "Content-Type: application/json" \
              --data '{
              "model": "magnific_video_upscaler_creative",
              "videoUri": "https://example.com/source-video.mp4",
              "resolution": "2k"
            }'
        - lang: Python
          source: |-
            import os
            import requests

            response = requests.post(
                "https://api.cometapi.com/runwayml/v1/video_upscale",
                headers={"Authorization": f"Bearer {os.environ['COMETAPI_KEY']}"},
                json={
                  "model": "magnific_video_upscaler_creative",
                  "videoUri": "https://example.com/source-video.mp4",
                  "resolution": "2k"
                },
            )
            response.raise_for_status()
            print(response.json())
        - lang: JavaScript
          source: |-
            const response = await fetch(
              "https://api.cometapi.com/runwayml/v1/video_upscale",
              {
                method: "POST",
                headers: {
                  Authorization: `Bearer ${process.env.COMETAPI_KEY}`,
                  "Content-Type": "application/json",
                },
                body: JSON.stringify({
                  "model": "magnific_video_upscaler_creative",
                  "videoUri": "https://example.com/source-video.mp4",
                  "resolution": "2k"
                }),
              },
            );
            if (!response.ok) throw new Error(await response.text());
            console.log(await response.json());
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Your CometAPI API key.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.