---
title: Topaz 影片超解析度 | RunAPI
description: 使用影片放大端點以建立非同步任務。
url: https://runapi.ai/zh-HK/docs/api/topaz/upscale-video.md
canonical: https://runapi.ai/zh-HK/docs/api/topaz/upscale-video
locale: zh-HK
---

> HTML 版本: https://runapi.ai/zh-HK/docs/api/topaz/upscale-video
> 智能代理網站索引: https://runapi.ai/llms.txt

# Topaz 影片超解析度

## 概覽

使用影片放大端點配合受支援的模型。使用返回的任務 ID 來檢索其狀態，或提供 callback_url 以接收以下記錄的推送通知。

### 快速入門

1. 建立 API 金鑰並將其設定為 RUNAPI_API_KEY。
2. 選擇支援的模型，並發送主體符合該模型結構的 POST 請求。
3. 儲存返回的任務 ID，然後輪詢直至達到終止狀態，或處理下方說明的回呼。

## 端點

POST /api/v1/topaz/upscale_video

基礎 URL: https://runapi.ai

API 版本: v1

身份驗證: Authorization: Bearer YOUR_API_TOKEN

## 支援的模型

開啟模型頁面以查看當前定價、速率限制及商業用途詳情。

- [topaz-upscale-video](https://runapi.ai/zh-HK/models/topaz/upscale-video)

## 請求結構

欄位及允許的值取決於所選模型。提供後，callback_url 將接收以下記錄的 Task 交付內容。

### topaz-upscale-video

```json
{
  "callback_url": {
    "description": "用於終端任務推送的 Webhook URL。",
    "type": "string"
  },
  "model": {
    "description": "模型標識符。",
    "required": true,
    "type": "string"
  },
  "source_video_url": {
    "description": "公開來源視訊 URL。",
    "required": true,
    "type": "string"
  },
  "upscale_factor": {
    "default": 2,
    "description": "影片放大倍數。",
    "enum": [
      1,
      2,
      4
    ],
    "type": "integer"
  }
}
```

## 建立接受

HTTP 202 - POST /api/v1/topaz/upscale_video

### 回應結構

```json
{
  "properties": {
    "billing": {
      "properties": {
        "refund": {
          "oneOf": [
            {
              "properties": {
                "refunded_at": {
                  "type": "string"
                }
              },
              "required": [
                "refunded_at"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "reservation": {
          "oneOf": [
            {
              "properties": {
                "amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "amount_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "settlement": {
          "oneOf": [
            {
              "properties": {
                "amount_micro_cents": {
                  "type": "integer"
                },
                "charged_amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "charged_amount_cents",
                "amount_micro_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        }
      },
      "required": [
        "reservation",
        "settlement",
        "refund"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "processing"
      ],
      "type": "string"
    },
    "task_replayed": {
      "type": "boolean"
    }
  },
  "required": [
    "id",
    "status",
    "billing"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### 回應範例

```json
{
  "billing": {
    "refund": null,
    "reservation": null,
    "settlement": null
  },
  "id": "tsk_reference_demo",
  "status": "processing"
}
```

## 輪詢處理中

HTTP 200 - GET /api/v1/topaz/upscale_video/:id

### 回應結構

```json
{
  "properties": {
    "billing": {
      "properties": {
        "refund": {
          "oneOf": [
            {
              "properties": {
                "refunded_at": {
                  "type": "string"
                }
              },
              "required": [
                "refunded_at"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "reservation": {
          "oneOf": [
            {
              "properties": {
                "amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "amount_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "settlement": {
          "oneOf": [
            {
              "properties": {
                "amount_micro_cents": {
                  "type": "integer"
                },
                "charged_amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "charged_amount_cents",
                "amount_micro_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        }
      },
      "required": [
        "reservation",
        "settlement",
        "refund"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "processing"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status",
    "billing"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### 回應範例

```json
{
  "billing": {
    "refund": null,
    "reservation": null,
    "settlement": null
  },
  "id": "tsk_reference_demo",
  "status": "processing"
}
```

## 輪詢已完成

HTTP 200 - GET /api/v1/topaz/upscale_video/:id

### 回應結構

```json
{
  "properties": {
    "billing": {
      "properties": {
        "refund": {
          "oneOf": [
            {
              "properties": {
                "refunded_at": {
                  "type": "string"
                }
              },
              "required": [
                "refunded_at"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "reservation": {
          "oneOf": [
            {
              "properties": {
                "amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "amount_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "settlement": {
          "oneOf": [
            {
              "properties": {
                "amount_micro_cents": {
                  "type": "integer"
                },
                "charged_amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "charged_amount_cents",
                "amount_micro_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        }
      },
      "required": [
        "reservation",
        "settlement",
        "refund"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "completed"
      ],
      "type": "string"
    },
    "videos": {
      "items": {
        "properties": {
          "url": {
            "type": "string",
            "x-runapi-generated-media": true
          }
        },
        "required": [
          "url"
        ],
        "type": "object",
        "unevaluatedProperties": false
      },
      "type": "array"
    }
  },
  "required": [
    "id",
    "status",
    "videos",
    "billing"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### 回應範例

```json
{
  "billing": {
    "refund": null,
    "reservation": null,
    "settlement": null
  },
  "id": "tsk_reference_demo",
  "status": "completed",
  "videos": [
    {
      "url": "https://file.runapi.ai/reference-video.mp4"
    }
  ]
}
```

## 輪詢失敗

HTTP 200 - GET /api/v1/topaz/upscale_video/:id

### 回應結構

```json
{
  "properties": {
    "billing": {
      "properties": {
        "refund": {
          "oneOf": [
            {
              "properties": {
                "refunded_at": {
                  "type": "string"
                }
              },
              "required": [
                "refunded_at"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "reservation": {
          "oneOf": [
            {
              "properties": {
                "amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "amount_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "settlement": {
          "oneOf": [
            {
              "properties": {
                "amount_micro_cents": {
                  "type": "integer"
                },
                "charged_amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "charged_amount_cents",
                "amount_micro_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        }
      },
      "required": [
        "reservation",
        "settlement",
        "refund"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "error": {
      "type": "string"
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "failed"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status",
    "error",
    "billing"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### 回應範例

```json
{
  "billing": {
    "refund": null,
    "reservation": null,
    "settlement": null
  },
  "error": "Task processing failed.",
  "id": "tsk_reference_demo",
  "status": "failed"
}
```

## 客戶回呼：已完成

HTTP 200 - POST callback_url

### 回應結構

```json
{
  "properties": {
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "completed"
      ],
      "type": "string"
    },
    "videos": {
      "items": {
        "properties": {
          "url": {
            "type": "string",
            "x-runapi-generated-media": true
          }
        },
        "required": [
          "url"
        ],
        "type": "object",
        "unevaluatedProperties": false
      },
      "type": "array"
    }
  },
  "required": [
    "id",
    "status",
    "videos"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### 回應範例

```json
{
  "id": "tsk_reference_demo",
  "status": "completed",
  "videos": [
    {
      "url": "https://file.runapi.ai/reference-video.mp4"
    }
  ]
}
```

## 客戶回呼：已失敗

HTTP 200 - POST callback_url

### 回應結構

```json
{
  "properties": {
    "error": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "properties": {
            "code": {
              "type": "string"
            },
            "limit_cents": {
              "type": "integer"
            },
            "message": {
              "type": "string"
            },
            "reset_at": {
              "format": "date-time",
              "type": [
                "string",
                "null"
              ]
            },
            "used_cents": {
              "type": "integer"
            },
            "window": {
              "enum": [
                "1h",
                "1d",
                "7d",
                "daily",
                "weekly",
                "monthly",
                "lifetime"
              ],
              "type": "string"
            }
          },
          "required": [
            "code",
            "message"
          ],
          "type": "object",
          "unevaluatedProperties": false
        }
      ]
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "failed"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status",
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### 回應範例

```json
{
  "error": {
    "code": "generation_failed",
    "message": "Task processing failed."
  },
  "id": "tsk_reference_demo",
  "status": "failed"
}
```

## 錯誤

HTTP 401 - POST /api/v1/topaz/upscale_video

### 回應結構

```json
{
  "properties": {
    "error": {
      "description": "人類可讀的錯誤訊息。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### 回應範例

```json
{
  "error": "Authentication required"
}
```

## 錯誤

HTTP 401 - GET /api/v1/topaz/upscale_video/:id

### 回應結構

```json
{
  "properties": {
    "error": {
      "description": "人類可讀的錯誤訊息。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### 回應範例

```json
{
  "error": "Authentication required"
}
```

## 錯誤

HTTP 400 - POST /api/v1/topaz/upscale_video

### 回應結構

```json
{
  "oneOf": [
    {
      "properties": {
        "error": {
          "description": "人類可讀的錯誤訊息。",
          "type": "string"
        }
      },
      "required": [
        "error"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    {
      "properties": {
        "error": {
          "description": "人類可讀的驗證摘要。",
          "type": "string"
        },
        "errors": {
          "additionalProperties": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "description": "以公開請求欄位為鍵的驗證訊息，每個欄位對應一組人類可讀的字串陣列。",
          "type": "object"
        }
      },
      "required": [
        "error",
        "errors"
      ],
      "type": "object",
      "unevaluatedProperties": false
    }
  ]
}
```

### 回應範例

```json
{
  "error": "model must be one of: topaz-upscale-video"
}
```

## 錯誤

HTTP 402 - POST /api/v1/topaz/upscale_video

### 回應結構

```json
{
  "properties": {
    "error": {
      "description": "人類可讀的錯誤訊息。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### 回應範例

```json
{
  "error": "Insufficient balance"
}
```

## 錯誤

HTTP 429 - POST /api/v1/topaz/upscale_video

### 回應結構

```json
{
  "properties": {
    "error": {
      "description": "人類可讀的錯誤訊息。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### 回應範例

```json
{
  "error": "API key credit limit exceeded"
}
```

## 錯誤

HTTP 409 - POST /api/v1/topaz/upscale_video

### 回應結構

```json
{
  "properties": {
    "error": {
      "description": "人類可讀的錯誤訊息。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### 回應範例

```json
{
  "error": "The request uses features that are not supported for the selected model"
}
```

## 錯誤

HTTP 429 - POST /api/v1/topaz/upscale_video

### 回應結構

```json
{
  "properties": {
    "error": {
      "description": "人類可讀的錯誤訊息。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### 回應範例

```json
{
  "error": "Rate limit reached. Please retry later."
}
```

## 錯誤

HTTP 503 - POST /api/v1/topaz/upscale_video

### 回應結構

```json
{
  "properties": {
    "error": {
      "description": "人類可讀的錯誤訊息。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### 回應範例

```json
{
  "error": "Service under maintenance, please try again later"
}
```

## 錯誤

HTTP 504 - POST /api/v1/topaz/upscale_video

### 回應結構

```json
{
  "properties": {
    "error": {
      "description": "人類可讀的錯誤訊息。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### 回應範例

```json
{
  "error": "The request timed out"
}
```

## 錯誤

HTTP 404 - GET /api/v1/topaz/upscale_video/:id

### 回應結構

```json
{
  "properties": {
    "error": {
      "description": "人類可讀的錯誤訊息。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### 回應範例

```json
{
  "error": "Task with id 'tsk_reference_demo' not found"
}
```

## 已生成的程式碼範例

直接使用 cURL，或為您的語言安裝 SDK。每個範例均提交本參考中所示的已驗證請求。

### curl

```curl
curl -X POST https://runapi.ai/api/v1/topaz/upscale_video \
  -H 'Authorization: Bearer YOUR_API_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"model":"topaz-upscale-video","source_video_url":"https://cdn.runapi.ai/public/samples/video-lowres.mp4"}'
```

### javascript

#### 安裝

```bash
npm install @runapi.ai/topaz
```

```javascript
import { TopazClient } from "@runapi.ai/topaz";

const client = new TopazClient({ apiKey: process.env.RUNAPI_API_KEY });
const task = await client.upscaleVideo.create({
  "model": "topaz-upscale-video",
  "source_video_url": "https://cdn.runapi.ai/public/samples/video-lowres.mp4"
});
```

### python

#### 安裝

```bash
pip install runapi-topaz
```

```python
import os
from runapi.topaz import TopazClient

client = TopazClient(api_key=os.environ["RUNAPI_API_KEY"])
task = client.upscale_video.create(
  model="topaz-upscale-video",
  source_video_url="https://cdn.runapi.ai/public/samples/video-lowres.mp4"
)
```

### go

#### 安裝

```bash
go get github.com/runapi-ai/topaz-sdk/go@latest
```

```go
package main

import (
  "context"
  "log"
  "os"

  "github.com/runapi-ai/core-sdk/go/option"
  topaz "github.com/runapi-ai/topaz-sdk/go/topaz"
)

func main() {
  client, err := topaz.NewClient(option.WithAPIKey(os.Getenv("RUNAPI_API_KEY")))
  if err != nil {
    log.Fatal(err)
  }

  task, err := client.UpscaleVideo.Create(context.Background(), topaz.UpscaleVideoParams{
    Model: "topaz-upscale-video",
    SourceVideoURL: "https://cdn.runapi.ai/public/samples/video-lowres.mp4",
  })
  if err != nil {
    log.Fatal(err)
  }
  _ = task
}
```

### ruby

#### 安裝

```bash
gem install runapi-topaz
```

```ruby
require "runapi/topaz"

client = RunApi::Topaz::Client.new(api_key: ENV.fetch("RUNAPI_API_KEY"))
task = client.upscale_video.create(
  model: "topaz-upscale-video",
  source_video_url: "https://cdn.runapi.ai/public/samples/video-lowres.mp4"
)
```

### java

#### 安裝

```kotlin
implementation("ai.runapi:runapi-topaz")
```

```java
import ai.runapi.topaz.TopazClient;
import ai.runapi.topaz.types.UpscaleVideoParams;
import ai.runapi.core.polling.TaskCreateResponse;

public final class Example {
  public static void main(String[] args) {
    TopazClient client = TopazClient.builder()
        .apiKey(System.getenv("RUNAPI_API_KEY"))
        .build();
    TaskCreateResponse task = client.upscaleVideo().create(
        UpscaleVideoParams.builder()
        .model("topaz-upscale-video")
        .sourceVideoUrl("https://cdn.runapi.ai/public/samples/video-lowres.mp4")
            .build()
    );
  }
}
```

### php

#### 安裝

```bash
composer require runapi-ai/topaz
```

```php
<?php

require __DIR__ . '/vendor/autoload.php';

use RunApi\Core\ClientOptions;
use RunApi\Topaz\TopazClient;

$client = new TopazClient(new ClientOptions(apiKey: getenv('RUNAPI_API_KEY')));
$task = $client->upscaleVideo->create([
  "model" => "topaz-upscale-video",
  "source_video_url" => "https://cdn.runapi.ai/public/samples/video-lowres.mp4"
]);
```

## 相關指南

- [身份驗證](https://runapi.ai/zh-HK/docs/guides/authentication.md)
- [快速入門](https://runapi.ai/zh-HK/docs/guides/task-api/quickstart.md)

---

## RunAPI 的更多內容

- [首頁](https://runapi.ai/zh-HK/.md)
- [模型目錄](https://runapi.ai/zh-HK/models.md)
- [收費](https://runapi.ai/zh-HK/pricing.md)
- [服務商](https://runapi.ai/zh-HK/models)
- [文件](https://runapi.ai/zh-HK/docs/guides)
- [SDK](https://runapi.ai/zh-HK/sdk.md)
- [CLI](https://runapi.ai/zh-HK/cli.md)
- [MCP Server](https://runapi.ai/zh-HK/mcp.md)
- [Claude Code 與 Cursor](https://runapi.ai/zh-HK/claude-code-vs-cursor.md)
- [Cursor API 設定](https://runapi.ai/zh-HK/cursor-api-setup.md)
- [RunAPI 與 OpenRouter](https://runapi.ai/zh-HK/openrouter-alternative.md)
- [企業版](https://runapi.ai/zh-HK/contact.md)
- [聯絡](https://runapi.ai/zh-HK/contact.md)
- [條款](https://runapi.ai/zh-HK/terms.md)
- [私隱](https://runapi.ai/zh-HK/privacy.md)
- [智能代理網站索引](https://runapi.ai/llms.txt)

聯絡我們: contact@runapi.ai

## 結構化資料

```json
[
  {
    "@context": "https://schema.org",
    "inLanguage": "zh-HK",
    "@type": "WebSite",
    "name": "RunAPI",
    "url": "https://runapi.ai/zh-HK",
    "potentialAction": {
      "@type": "SearchAction",
      "target": {
        "@type": "EntryPoint",
        "urlTemplate": "https://runapi.ai/zh-HK/models?q={search_term_string}"
      },
      "query-input": "required name=search_term_string"
    }
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "zh-HK",
    "@type": "Organization",
    "name": "RunAPI",
    "url": "https://runapi.ai/zh-HK",
    "logo": {
      "@type": "ImageObject",
      "url": "https://runapi.ai/zh-HKicon.svg"
    },
    "sameAs": [
      "https://github.com/runapi-ai"
    ]
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "zh-HK",
    "@type": "TechArticle",
    "headline": "Topaz 影片超解析度",
    "description": "使用影片放大端點以建立非同步任務。",
    "url": "https://runapi.ai/zh-HK/docs/api/topaz/upscale-video",
    "mainEntityOfPage": "https://runapi.ai/zh-HK/docs/api/topaz/upscale-video"
  }
]
```
