把 GPT-Image 2 裝進 Claude
能讓自己的 Claude Agent 擁有頂級的圖像生成能力,並且成本遠低於直接訂閱 ChatGPT Plus。
§1 概覽
概覽
這個 Playbook 將引導你將 GPT-Image 2.0 的強大圖像生成能力整合到你的 Claude Agent 中。這不僅能大幅提升 Claude 的創意表現力,更能在經濟效益上遠超直接訂閱其他繪圖服務。透過儲值 OpenAI API 帳戶、安全地管理 API Key,並完成必要的身份驗證,你將能夠在 Claude Code 中輕鬆啟用並測試這項功能。無論是內容創作者還是教育工作者,都能藉此為自己的工作流程注入高效且具成本效益的 AI 繪圖能力,實現從文字到視覺的無縫轉換。
整體架構
本 Playbook 的整體架構圍繞著「將外部 AI 繪圖能力安全且有效地引入 Claude Agent」的核心目標展開。首先,需要完成 OpenAI 平台端的準備工作,包括資金儲值、API Key 的生成與安全管理,以及個人身份驗證,確保 API 服務的正常運作。隨後,透過在 Claude Code 桌面版中導入特定的「懶人包」,將 GPT-Image 2.0 的功能封裝為一個可呼叫的 Skill。整個流程最終透過一個簡單的繪圖指令進行驗證,確保 Claude Agent 能夠成功調用 OpenAI 的圖像生成服務,並回傳所需的圖片。此架構強調了安全性(關閉自動儲值、身份驗證)與可操作性(懶人包導入、指令測試),為使用者提供一套清晰的實作路徑。
---en---
Overview
This Playbook will guide you through integrating the powerful image generation capabilities of GPT-Image 2.0 into your Claude Agent. This not only significantly enhances Claude’s creative potential but also offers a more cost-effective solution compared to direct subscriptions to other image generation services. By funding your OpenAI API account, securely managing your API Key, and completing necessary identity verification, you will be able to easily enable and test this feature within Claude Code. Content creators and educators alike can leverage this to inject efficient and cost-effective AI imaging into their workflows, achieving seamless text-to-visual conversion.
Overall Architecture
The overall architecture of this Playbook centers on the core objective of “securely and effectively integrating external AI image generation capabilities into the Claude Agent.” First, preparatory work on the OpenAI platform must be completed, including funding, secure generation and management of an API Key, and personal identity verification to ensure API service functionality. Subsequently, by importing a specific “lazy pack” into the Claude Code desktop version, GPT-Image 2.0’s features are encapsulated into a callable Skill. The entire process is ultimately verified through a simple drawing command, ensuring the Claude Agent can successfully invoke OpenAI’s image generation service and return the desired image. This architecture emphasizes security (disabling auto-recharge, identity verification) and operability (lazy pack import, command testing), providing users with a clear implementation path.
§2 前置準備
§3 Step-by-step
儲值 OpenAI API 帳戶
Do 為你的 OpenAI 帳戶儲值,這是使用 API 的第一步。
Why API 調用是按量計費的,需要帳戶有餘額。直接訂閱 ChatGPT Plus 無法用於 API。
登入 OpenAI 平台,進入「Settings」->「Billing」。
點擊「Add payment details」,綁定信用卡。
點擊「Add to credit balance」,建議首次儲值 5-10 美元。
Verify Billing 頁面顯示你的帳戶有 Credit balance。
關閉自動儲值並建立 API Key
Do 關閉自動加值功能,並生成一組專門給 Claude 使用的 API Key。
Why 極其重要! 關閉自動儲值可以防止 API Key 意外洩露時造成鉅額損失。
在 Billing 頁面,找到「Auto Recharge」選項,確認其為關閉狀態。
點擊左側選單的「API Keys」。
點擊「Create new secret key」,為其命名(例如 `claude-image-skill`),然後點擊「Create secret key」。
立即複製生成的 API Key (格式為 `sk-xxxx`) 並將其保存在安全的地方(如密碼管理器)。這個視窗關閉後就再也看不到了。
Verify 你已將一串 `sk-` 開頭的 API Key 複製並妥善保存。
完成 OpenAI 身份驗證
Do 根據 OpenAI 要求,完成個人身份驗證以啟用 API。
Why 這是 OpenAI 的安全措施,未驗證的帳戶可能無法使用 API。
前往 OpenAI 帳戶的「Settings」->「General」,選擇「Personal」。
找到身份驗證區塊,按指示掃描 QR Code。
使用手機上傳你的身分證正反面照片及進行自拍驗證。
Verify 帳戶設定顯示身份已驗證。
在 Claude Code 中安裝生圖技能
Do 使用懶人包,將 GPT-Image 2.0 的能力封裝成一個 Skill 安裝到 Claude Code 中。
Why 讓 Claude 知道遇到「畫圖」指令時,要去呼叫 OpenAI 的 API。
打開 Claude Code 桌面版。
下載「gpt image 2 生圖」懶人包 .md 檔,並拖曳到對話視窗。
AI 會引導你安裝「Draw」技能,並在過程中要求你輸入剛剛保存的 OpenAI API Key。
將你保存的 `sk-xxxx` 金鑰貼上並提交。
Verify 安裝成功後,AI 會提示技能已就緒。
測試你的新能力
Do 下達一個繪圖指令,看看 Claude 是否能成功生成圖片。
Why 驗證整個流程是否成功。
在 Claude Code 中輸入:「幫我畫一張圖,一隻戴著VR眼鏡的貓在寫程式,賽博龐克風格。」
等待幾秒鐘,Claude 應該會呼叫 Image 2 引擎並回傳一張圖片。
Verify 你能成功看到 AI 畫出的圖片。
§4 動手練習
動手練習
§5 自我檢核
§6 常見卡關
Claude 提示 API Key 無效或認證失敗。
1. 檢查 API Key 是否複製完整。 2. 檢查 OpenAI 帳戶是否已完成身份驗證。 3. 登入 OpenAI Billing 頁面,確認帳戶沒有被封鎖且仍有餘額。
API Key 弄丟了怎麼辦?
沒關係。登入 OpenAI 的 API Keys 頁面,刪除舊的 Key,然後重新建立一個新的即可。記得回來 Claude Code 更新 Skill 裡的設定。