# Codex

> 在 Codex 中安裝 WayinVideo Skill，直接從 coding workspace 將影片 URL 轉成短片、摘要、時間戳與可發布的社群內容。

## Codex 集成

Codex 可以使用 **WayinVideo Skill** 作為 workspace assistant，協助你進行影片理解、AI 剪輯與短影音內容準備。

你不必在 coding environment 和獨立影片工具之間切換。當你正在處理 scripts、內容 pipeline、社群發布工具或自動化邏輯時，可以直接請 Codex 執行 WayinVideo workflow。Skill 提供影片操作能力，WayinVideo API 則在背後完成影片處理。

這特別適合由開發者主導的工作流程，例如：

- 建立內容自動化 script，
- 測試 YouTube-to-clips pipeline，
- 為社群媒體發布流程準備短片，
- 為 editorial tool 擷取時間戳，
- 將影片 URL 轉成 app 或 CMS 可用的 structured data。

---

## 設定概覽

設定分為三個部分：

1. 從 ClawHub 下載 WayinVideo Skill package。
2. 請 Codex 安裝下載好的 ZIP 檔案。
3. 在 Codex 要求時提供你的 WayinVideo API key。

在執行影片任務前，請確認你的 WayinVideo 帳戶有可用的 API Units。你可以在 [WayinVideo API Dashboard](https://wayin.ai/wayinvideo/api-dashboard) 建立 API key 並購買 API Units。

> 請將 API key 視為 secret。不要將它 commit 到 repository、貼到 shared logs，或暴露在 client-side code 中。

---

## 在 Codex 中安裝

### 1. 下載 Skill ZIP

開啟 WayinVideo Skill 頁面：

[https://clawhub.ai/wayinvideo/video-understanding-and-ai-clipping](https://clawhub.ai/wayinvideo/video-understanding-and-ai-clipping)

將 package 下載到你的電腦。請記下 ZIP 檔案路徑，因為 Codex 安裝時會需要這個路徑。

### 2. 請 Codex 安裝

在 Codex 中，帶上下載檔案路徑送出安裝提示詞：

```text
Please install the WayinVideo skill package located at [the path of downloaded zip file].
```

例如：

```text
Please install the WayinVideo skill package located at /Users/example/Downloads/wayinvideo-video-understanding-and-ai-clipping.zip.
```

### 3. 連接你的 API Key

當 Skill setup 要求 credentials 時，輸入來自以下頁面的 WayinVideo API key：

[https://wayin.ai/wayinvideo/api-dashboard](https://wayin.ai/wayinvideo/api-dashboard)

如果你的 API Units 餘額為空，請先購買 API Units Package，再執行第一個影片任務。

### 4. 視需要重新載入 Codex

部分 Codex environment 可能會在安裝新 Skill 後要求 reload 或 restart。如果看到提示，請依照提示操作，然後使用 `/wayinvideo` 開始新的 request。

---

## 第一個 Codex Request

完成設定後，可以先用一個簡短 request，給 Codex 明確的影片 URL 和輸出目標：

```text
/wayinvideo Generate 6 clip candidates from this YouTube video for TikTok and YouTube Shorts. Include start/end timestamps, a short title, why each clip works, and suggested hashtags: [a youtube video link]
```

將 `[a youtube video link]` 替換為你的來源影片 URL。

Codex 會透過 WayinVideo Skill 路由這個 request，並依照你的 prompt 和帳戶設定，回傳需要的剪輯想法、時間戳或生成的短片輸出。

---

## Codex Prompt Patterns

建議在 prompt 中清楚描述來源影片、目標渠道，以及你想要的精確輸出。

### 建立剪輯佇列

```text
/wayinvideo Use AI Clipping on this video and return the strongest short clips. For each clip, include the start time, end time, title, description, and score: https://www.youtube.com/watch?v=example
```

### 擷取產品頁可用片段

```text
/wayinvideo Use Find Moments to locate every part where the speaker discusses product benefits or customer objections. Return timestamps and a one-sentence reason for each match: https://www.youtube.com/watch?v=example
```

### 準備社群文案

```text
/wayinvideo Clip this video into vertical short-form ideas for social posting. Prioritize moments with a strong hook, clear takeaway, or surprising statement: https://www.youtube.com/watch?v=example
```

### 為 CMS 建立摘要

```text
/wayinvideo Find the best educational moments in this video and summarize each one with its timestamp, topic, and recommended clip title: https://www.youtube.com/watch?v=example
```

---

## Codex Workflow Ideas

| Workflow | Codex 如何使用 Skill |
| -------- | -------------------- |
| Content automation | 生成可複製到 scripts、queues 或 CMS records 的 clip metadata。 |
| Social publishing | 準備 clip titles、descriptions、hashtags 與可交給帳號發布的內容計劃。 |
| Editorial review | 在匯出或發布短片前，找出值得 review 的 timestamps。 |
| Product research | 定位 speaker 討論 features、comparisons、objections 或 use cases 的片段。 |
| Documentation work | 將 video walkthroughs 轉成 summaries、highlights 與 structured notes。 |

---

## 有用的 API 參考

在 Codex 中，Skill 是最容易開始的方式；當你想建立或 debug 自訂 workflow 時，以下 API 參考會很有幫助：

| 需求 | API 文件 |
| ---- | -------- |
| 從長影片生成短片 | [AI 剪輯 API](https://wayin.ai/zh-tw/api-docs/ai-clipping/) |
| 使用 prompt 搜尋精確片段 | [時刻搜尋 API](https://wayin.ai/zh-tw/api-docs/find-moments/) |
| 建立 structured summaries 與 timeline highlights | [影片摘要 API](https://wayin.ai/zh-tw/api-docs/video-summarization/) |
| 提取含時間與 speaker labels 的 transcripts | [影片轉錄 API](https://wayin.ai/zh-tw/api-docs/video-transcription/) |
| 使用 render settings 匯出選定短片 | [Clips Export API](https://wayin.ai/zh-tw/api-docs/clips-export/) |
| 將短片發布到已連接的社群帳號 | [社群媒體發布 API](https://wayin.ai/zh-tw/api-docs/social-media-publishing/) |
| 查看 API Units 與計費行為 | [Pricing](https://wayin.ai/zh-tw/api-docs/pricing/) |

完整 Skill 參考請見 [影片理解與 AI 剪輯 Skill](https://wayin.ai/zh-tw/api-docs/skills-video-understanding-and-ai-clipping/)。

---

## Troubleshooting

### `/wayinvideo` 無法使用

請確認 ZIP 安裝已成功完成。如果 Codex 要求 reload 或 restart，請先完成後再重試。

### Codex 再次要求 API Key

請輸入目前有效的 WayinVideo API key，可在 [API Dashboard](https://wayin.ai/wayinvideo/api-dashboard) 取得。如果你曾 rotate 或刪除 key，請使用最新的 active key。

### Request 因 API Units 失敗

請在 [WayinVideo API Dashboard](https://wayin.ai/wayinvideo/api-dashboard) 檢查 API Units 餘額。如果餘額為空，請先新增 API Units Package，再提交下一個影片任務。
