Skip to content
Back to search

awesome-openclaw-tutorial

OpenClaw 中文教程(4500+ Star · 已出版纸质书):安装、配置、Skills、飞书接入与避坑|作者的 GPT-6 / Codex / Claude Code 新项目见 README 顶部

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/xianyu110--awesome-openclaw-tutorial/badge.svg)](/listings/xianyu110--awesome-openclaw-tutorial)

HTML

<a href="/listings/xianyu110--awesome-openclaw-tutorial"><img src="/api/listings/xianyu110--awesome-openclaw-tutorial/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 425 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # 🦞 Awesome OpenClaw Tutorial
  2. # 🦞 一本书玩转OpenClaw:超级个体实战指南
  3. > 从零开始打造你的AI工作助手:最全面的中文教程,涵盖安装、配置、实战案例和避坑指南
  4. [![GitHub stars](https://img.shields.io/github/stars/xianyu110/awesome-openclaw-tutorial?style=social)](https://github.com/xianyu110/awesome-openclaw-tutorial)
  5. [![GitHub forks](https://img.shields.io/github/forks/xianyu110/awesome-openclaw-tutorial?style=social)](https://github.com/xianyu110/awesome-openclaw-tutorial)
  6. [![License](https://img.shields.io/badge/license-GPL--3.0-blue.svg)](LICENSE)
  7. [![Version](https://img.shields.io/badge/version-v2026.9.3-green.svg)](https://github.com/xianyu110/awesome-openclaw-tutorial)
  8. [![Status](https://img.shields.io/badge/status-完成-success.svg)](reports/PROJECT-SUMMARY.md)
  9. [![CSDN](https://img.shields.io/badge/CSDN-博客-c32136?style=for-the-badge&logo=csdn)](https://blog.csdn.net/xianyu120)
  10. [![Bilibili](https://img.shields.io/badge/Bilibili-B站-fb7299?style=for-the-badge&logo=bilibili)](https://space.bilibili.com/399102586)
  11. [![微信公众号](https://img.shields.io/badge/微信公众号-MaynorAI-07C160?style=for-the-badge&logo=wechat)](https://upload.may.maynor1024.live/file/1773461955906_qrcode_for_gh_c749803541de_1280.jpg)
  12. [![YouTube](https://img.shields.io/badge/YouTube-Profile-red?style=for-the-badge&logo=youtube)](https://www.youtube.com/@buguniao537)
  13. [![X](https://img.shields.io/badge/X-Profile-000000?style=for-the-badge&logo=x&logoColor=white)](https://x.com/Nikitka_aktikiN)
  14. ## 🔥 2026 年 10 月 · 作者正在更新的新项目
  15. > OpenClaw 教程继续保留在下方 👇。这里先列出作者近期正在维护的新仓库,内容方向相近,欢迎顺手看看、点个 Star。
  16. | 预览 | 项目 | 一句话介绍 | Stars |
  17. |:---:|---|---|:---:|
  18. | <img src="https://raw.githubusercontent.com/xianyu110/awesome-gpt-6-astra/main/sources/martin/website/public/previews/cheerself-001.jpg" width="120" alt="GPT-6 Astra"> | [**awesome-gpt-6-astra**](https://github.com/xianyu110/awesome-gpt-6-astra) · [在线站](https://gpt-6-astra.cc/) | GPT-6 Astra 社区案例合集:游戏、3D、网页、Computer Use 等可玩 Demo,每条附作者与原帖 | [![Stars](https://img.shields.io/github/stars/xianyu110/awesome-gpt-6-astra?style=flat-square&logo=github&label=Stars)](https://github.com/xianyu110/awesome-gpt-6-astra) |
  19. | <img src="https://raw.githubusercontent.com/xianyu110/awesome-gpt-image2.5/main/assets/og-cover.png" width="120" alt="GPT Image 2.5"> | [**awesome-gpt-image2.5**](https://github.com/xianyu110/awesome-gpt-image2.5) · [画廊](https://xianyu110.github.io/awesome-gpt-image2.5/) | ChatGPT Images 2.5(Flare · Sunburst · Sketch)好玩用法画廊,可直接抄的 prompt 与评测 | [![Stars](https://img.shields.io/github/stars/xianyu110/awesome-gpt-image2.5?style=flat-square&logo=github&label=Stars)](https://github.com/xianyu110/awesome-gpt-image2.5) |
  20. | <img src="https://raw.githubusercontent.com/xianyu110/awesome-minimax-h3-prompts/main/assets/previews/cmsboram6001z04kzkda7f0i4.webp" width="120" alt="MiniMax H3"> | [**awesome-minimax-h3-prompts**](https://github.com/xianyu110/awesome-minimax-h3-prompts) · [在线浏览](https://tryminimax.asia/zh/minimax-h3-prompts) | MiniMax H3(海螺 3.0)视频提示词精选,每条配生成片段与作者署名 | [![Stars](https://img.shields.io/github/stars/xianyu110/awesome-minimax-h3-prompts?style=flat-square&logo=github&label=Stars)](https://github.com/xianyu110/awesome-minimax-h3-prompts) |
  21. | <img src="https://upload.maynor1024.live/file/1776480570690_img_048.png" width="120" alt="GPT Image 2"> | [**awesome-gptimage2**](https://github.com/xianyu110/awesome-gptimage2) · [在线站](https://awesome.gptimage2.asia/) | GPT Image 2 中文提示词实战手册:电商、海报、产品图等可复制的商业场景 prompt | [![Stars](https://img.shields.io/github/stars/xianyu110/awesome-gptimage2?style=flat-square&logo=github&label=Stars)](https://github.com/xianyu110/awesome-gptimage2) |
  22. | | [**gpt-codex**](https://github.com/xianyu110/gpt-codex) · [教程站](https://codex.maynorai.top/) | 写给小白的 OpenAI Codex 中文教程:从 0 到 1 把 Codex 真正用起来 | [![Stars](https://img.shields.io/github/stars/xianyu110/gpt-codex?style=flat-square&logo=github&label=Stars)](https://github.com/xianyu110/gpt-codex) |
  23. | | [**awesome-codex-tutorial**](https://github.com/xianyu110/awesome-codex-tutorial) · [在线版](https://xianyu110.github.io/awesome-codex-tutorial/) | Codex 中文教程库:入门教程、系列图文教程、实战案例库与速查资料 | [![Stars](https://img.shields.io/github/stars/xianyu110/awesome-codex-tutorial?style=flat-square&logo=github&label=Stars)](https://github.com/xianyu110/awesome-codex-tutorial) |
  24. | | [**awesome-claudcode-tutorial**](https://github.com/xianyu110/awesome-claudcode-tutorial) · [在线阅读](https://awesome.claude-opus.top/zh/) | 最全面的 Claude Code 中文教程,从零基础到企业级应用 | [![Stars](https://img.shields.io/github/stars/xianyu110/awesome-claudcode-tutorial?style=flat-square&logo=github&label=Stars)](https://github.com/xianyu110/awesome-claudcode-tutorial) |
  25. > 🦞 以下为 OpenClaw 中文教程原有内容,持续保留并按版本校对。
  26. ---
  27. > 📖 **纸质书《OpenClaw超级个体实操手册》已上市!** 清华大学出版社出版,在开源教程基础上全面重写+逐条验证。🛒 [京东专属购买链接(¥42,原价¥59.8)](https://item.jd.com/14669463.html)
  28. > 🔄 **2026-09-10 更新说明**:本仓库当前按 **OpenClaw v2026.9.3(稳定版,2026-09-08 发布)** 校对;第 `1/2/5/7/8/10~15` 章已同步到 2026.9 主线。跨版本请先读 [`updates/2026-09-10-v2026.9.3.md`](updates/2026-09-10-v2026.9.3.md),升级后执行 `openclaw doctor --fix`。
  29. ## 📌 本教程与 OpenClaw 最新版差异说明
  30. 为了避免你把旧章节当成最新版官方教程,先看这 4 点:
  31. - **当前教程基线**:本仓库目前按 `v2026.9.3` 稳定版校对;如果 GitHub Releases 或 npm 出现更高版本,请以官方 Release Notes 和官方文档为准
  32. - **已优先更新的章节**:`README`、更新说明与第 `1/2/5/7/8/10~15` 章已按 `2026.9` 主线修订(含 2026.8 Breaking 迁移提示)
  33. - **仍含历史内容的章节**:第 `3/4/6/9` 章及部分 `tutorials/` 一键部署文仍可能含旧截图/旧渠道步骤,适合作为思路参考,不建议直接复制执行
  34. - **当前应优先使用的官方主线**:`openclaw onboard`、`openclaw models auth login --provider openai|…`、`openclaw doctor --fix`、`openclaw infer ...`、`openclaw skills …`、`Task Flow`、`Webhooks`、`/usage`
  35. | 类型 | 本教程当前状态 | 阅读建议 |
  36. |------|----------------|----------|
  37. | 版本基线 | 已对齐 `v2026.9.3` | 新手优先按这个版本跑通 |
  38. | 运行时 | Node **24.16+** 或 **26.1+**(推荐 26) | 先升 Node 再升 OpenClaw |
  39. | 跨版本迁移 | 强调 `openclaw doctor --fix` | 处理 `openai/*` 路由、OpenProse 清理、会话 SQLite |
  40. | 安装/配置主线 | 已补 2026.9 入口 | 优先看第 `2` 章和第 `11` 章 |
  41. | 媒体/创意能力 | 保留 `infer` / 媒体生成 / `ComfyUI` 主线 | 优先看第 `10` 章和第 `14` 章 |
  42. | 旧 Skill 生态 | 明确标为历史参考 | 用 `openclaw skills`,不要默认 `clawhub install …` |
  43. > ⚠️ **一句话判断**:如果你看到 `openai-codex/*`、`codex/*`、`/prose`、`local-anthropic`、`bananapro-image-gen`、整串 `clawhub install ...`,请先把它理解为“历史参考或需迁移项”,不要默认当成 `2026.9` 官方推荐步骤。
  44. ---
  45. ## 🚀 30秒快速选择:哪种部署方式适合你?
  46. | 你的情况 | 推荐方案 | 为什么 | 开始时间 |
  47. |---------|---------|------|---------|
  48. | **完全小白,想最快体验** | [**飞书妙搭**](tutorials/Openclaw史上最简单教程,小白一键部署.md#1飞书妙搭-openclaw--强烈推荐) ⭐ | **免费** + **1分钟完成** + **每日100万Tokens** | → 立即开始 |
  49. | **有服务器,想可视化管理** | [**宝塔面板**](tutorials/Openclaw史上最简单教程,小白一键部署.md#11宝塔面板-openclaw) | **免费插件** + **面板管理** + **一键安装** | → 3分钟搞定 |
  50. | **企业级,需要高安全性** | [**JVSClaw**](tutorials/Openclaw史上最简单教程,小白一键部署.md#10jvsclaw阿里云无影) | **14天免费** + **6核12GB** + **端到端加密** | → 需邀请码 |
  51. | **想用浏览器操控** | [Kimi Claw](tutorials/Openclaw史上最简单教程,小白一键部署.md#3kimi-openclaw) | **Kimi K2.5** + **浏览器控制** | → 200元/月 |
  52. | **量化交易/多IM** | [腾讯 WorkBuddy](tutorials/Openclaw史上最简单教程,小白一键部署.md#4腾讯-openclawworkbuddy) | **桌面端Agent** + **多IM支持** | → 送5000积分 |
  53. | **macOS原生体验** | [QClaw](tutorials/Openclaw史上最简单教程,小白一键部署.md#5qclaw) | **腾讯官方桌面客户端** + **全量公测** | → 免费 |
  54. | **Agent生态丰富** | [扣子 OpenClaw](tutorials/Openclaw史上最简单教程,小白一键部署.md#2扣子-openclaw) | **1800+Skills** | → 99元/月起 |
  55. 📖 **[查看完整一键部署教程 →](tutorials/Openclaw史上最简单教程,小白一键部署.md)**
  56. ---
  57. ## 📊 教程导航(按学习路径)
  58. ### 🎯 零基础入门(必读)
  59. - 📖 [第1章:认识OpenClaw](docs/01-basics/01-introduction.md) - 5分钟了解核心价值
  60. - 🚀 [第2章:快速部署](docs/01-basics/02-installation.md) - 选择适合你的部署方式
  61. - 💬 [第3章:快速上手](docs/01-basics/03-quick-start.md) - 发送第一条消息
  62. ### 🔥 核心功能(实战)
  63. - 📁 [第4章:文件管理](docs/02-core-features/04-file-management.md) - 效率提升81%
  64. - 🧠 [第5章:知识库](docs/02-core-features/05-knowledge-management.md) - 第二大脑系统 + Active Memory / Dreaming 补充
  65. - 📅 [第6章:日程管理](docs/02-core-features/06-schedule-management.md) - AI自动创建日程
  66. - ⚙️ [第7章:自动化](docs/02-core-features/07-automation-workflow.md) - 定时任务 + Task Flow / Webhooks 更新
  67. ### 💎 进阶技能(提升)
  68. - 🔌 [第8章:Skills扩展](docs/03-advanced/08-skills-extension.md) - 1800+技能
  69. - 🤖 [第9章:多平台集成](docs/03-advanced/09-multi-platform-integration.md) - 飞书/企微/钉钉/QQ/微信
  70. - 🔗 [第10章:API 与外部能力集成](docs/03-advanced/10-api-integration.md) - infer / webhooks / 媒体工作流
  71. - ⚙️ [第11章:高级配置](docs/03-advanced/11-advanced-configuration.md) - 模型 / 记忆 / 审批 / 性能
  72. ### 🎯 实战案例(直接套用)
  73. - 👔 [第12章:个人效率实战](docs/04-practical-cases/12-personal-productivity.md) - 知识工作 / 编程 / 创作 / 学习 / 个人运营
  74. - 🔗 [第13章:高级自动化](docs/04-practical-cases/13-advanced-automation.md) - cron / tasks / Task Flow / hooks / standing orders
  75. - 🎨 [第14章:创意应用](docs/04-practical-cases/14-creative-applications.md) - 图片 / 视频 / 音乐 / TTS / ComfyUI
  76. - 🚀 [第15章:一人公司实战](docs/04-practical-cases/15-solo-entrepreneur-cases.md) - 选题 / 交付 / 分发 / 复盘
  77. ### 📚 附录工具(速查)
  78. - [命令速查表](appendix/A-command-reference.md) | [必装Skills](appendix/B-skills-catalog.md)
  79. - [常见问题](appendix/E-common-problems.md) | [API对比](appendix/C-api-comparison.md)
  80. - [配置模板](appendix/H-config-templates.md) | [避坑指南](appendix/F-best-practices.md)
  81. ---
  82. ## 🆘 遇到问题?快速解决
  83. <details>
  84. <summary><b>🔧 常见问题速查(点击展开)</b></summary>
  85. ### 安装配置问题
  86. - [安装失败怎么办?](appendix/E-common-problems.md#安装配置问题)
  87. - [API连接失败?](appendix/E-common-problems.md#api连接问题)
  88. - [飞书Bot不回复?](docs/03-advanced/09-multi-platform-integration.md#常见问题)
  89. ### 使用问题
  90. - [AI变"哑巴"了?](#🔧-202632-版本ai变哑巴了) → 切换到 `full` profile
  91. - [Gateway启动失败?](appendix/E-common-problems.md#gateway问题) → 检查认证配置
  92. ### 成本优化
  93. - [API费用太高?](docs/03-advanced/11-advanced-configuration.md)
  94. - [如何省钱?](appendix/F-best-practices.md) - 使用国产模型节省95%
  95. </details>
  96. **找不到答案?**
  97. - 📖 [完整FAQ](appendix/E-common-problems.md)
  98. - 💬 [提交问题](https://github.com/xianyu110/awesome-openclaw-tutorial/issues)
  99. ---
  100. ## 🚨 重要版本提示
  101. ### ⚠️ 2026.3.7版本:Gateway认证要求(Breaking Change)
  102. Gateway认证现在**必须显式设置** `gateway.auth.mode`(`token` 或 `password`)
  103. **快速修复**:
  104. ```bash
  105. openclaw config set gateway.auth.mode token
  106. openclaw config set gateway.auth.token "your-secret-token"
  107. openclaw gateway restart
  108. ```
  109. ### 🔧 2026.3.2版本:AI变"哑巴"了?
  110. **症状**:只能聊天不能干活(文件管理、命令执行失效)
  111. **原因**:默认profile改为 `messaging`(纯聊天模式)
  112. **修复**:切换到 `full` profile
  113. ```bash
  114. openclaw config set tools.profile full
  115. openclaw gateway restart
  116. ```
  117. **5种Profile说明**:
  118. | Profile | 功能说明 |
  119. |---------|---------|
  120. | `messaging` | 只能发布消息、管理会话 |
  121. | `default` | 默认工具集(不含命令执行) |
  122. | `coding` | 编程相关工具 |
  123. | **`full`** | **完整工具集,包含命令执行(推荐)** |
  124. | `all` | 所有工具全开 |
  125. ---
  126. ### 🆕 v2026.3.12 重大更新(2026年3月)
  127. > 建议所有用户升级,包含大量安全修复
  128. **新功能**
  129. - **Control UI 全面重设计**:模块化 Dashboard,含概览/聊天/配置/Agent/Session 视图,支持命令面板、移动端底部 Tab、slash 命令、消息导出和消息置顶
  130. - **`/fast` 快速模式开关**:支持切换 OpenAI / Anthropic 的 fast tier,更省钱更快
  131. - **Kubernetes 支持**:新增 K8s 安装路径(支持 Kind 和 raw manifests)
  132. - **`sessions_yield` 工具**:Agent 可立即结束当前轮次并携带后续载荷,流程控制更灵活
  133. - **Slack Block Kit**:Slack 频道消息支持 Block Kit 富文本格式
  134. **重要安全修复**(建议立即升级)
  135. - 修复跨站 WebSocket 劫持路径
  136. - 修复 workspace plugin 隐式自动加载(防止恶意代码执行)
  137. - 修复 `/config`、`/debug` 权限绕过
  138. - 修复共享 token 范围自我提权
  139. - 多处 exec 审批绕过修复
  140. ---
  141. ### 🆕 v2026.3.13 更新(2026年3月中旬)
  142. **新功能**
  143. - **Chrome DevTools MCP attach 模式**:可直接连接已登录的 Chrome 浏览器进行自动化操作,无需重新登录
  144. - **Ollama 一键安装引导**:支持 Local 和 Cloud+Local 混合模式,本地模型更好用
  145. - **多模态记忆索引**:图片/音频内容可用 Gemini Embedding 进行语义检索
  146. - **Docker 时区支持**:新增 `OPENCLAW_TZ` 环境变量
  147. - **iOS 首次运行引导页**:新用户体验大幅提升
  148. **Bug 修复**
  149. - 修复工具密集型运行时 Dashboard UI 卡死/重渲染风暴
  150. - 修复 Windows 下 gateway 重启时弹出控制台黑窗口
  151. - 修复 setup code 可被重放攻击的安全漏洞
  152. - 插件 SDK 去重,修复约 2 倍内存膨胀问题
  153. ---
  154. ### 🆕 v2026.9.3 稳定版更新(2026年9月8日)
  155. **当前基线**
  156. - **稳定版**:`v2026.9.3`
  157. - **推荐运行时**:`Node 26`(或 `Node 24.16+`);**不再支持 Node 22**
  158. - **校验方式**:`npm view openclaw version` 应返回 `2026.9.3`
  159. - **完整跳变说明**:[`updates/2026-09-10-v2026.9.3.md`](updates/2026-09-10-v2026.9.3.md)
  160. **从 2026.6.8 跳到 2026.9.3,教学上最关键的变化**
  161. - **OpenClaw 2.0(2026.8.1)**:会话/转录迁入 SQLite;Control UI / onboarding 大改;升级前务必备份
  162. - **OpenAI 路由迁移**:`codex/*`、`openai-codex/*` → `openai/*`(`openclaw doctor --fix`)
  163. - **OpenProse 移除**:内置插件与 `/prose` 下线;清配置用 Doctor,需要时再装上游 Agent Skill
  164. - **Skills / Workshop**:优先 `openclaw skills`;Workshop 按 Agent 持久化;`clawhub install …` 降为历史参考
  165. - **更新恢复(2026.9.x)**:更新可预演、失败恢复更干净;关注 `openclaw update status`
  166. - **仍沿用的 2026.6 主线**:Active Memory / Memory Wiki、`infer`、Task Flow / Webhooks、媒体生成、`/usage`
  167. **升级命令**:
  168. ```bash
  169. # 先确认 Node
  170. node -v # 需要 24.16+ 或 26.1+
  171. openclaw update --tag 2026.9.3 --yes
  172. openclaw update repair
  173. openclaw doctor --fix
  174. openclaw --version # 确认版本为 2026.9.3
  175. ```
  176. > ⚠️ **新手建议**:目标是“按教程稳定跑通”就用 `v2026.9.3`。若 `openclaw update` 失败,可用 `npm install -g openclaw@2026.9.3 --allow-scripts=openclaw` 兜底。升级后先跑 `openclaw doctor --fix`、`openclaw models status --probe` 和 `openclaw channels status`。
  177. ### 📎 历史基线:v2026.6.8(2026年6月16日)
  178. > 以下内容保留为历史对照,**不再作为当前推荐基线**。
  179. - 当时推荐运行时多为 Node 24 / 兼容 Node 22.19+
  180. - 确立了 Active Memory、Dreaming、Memory Wiki、Task Flow、Webhooks、`openclaw infer`、内建媒体与 `/usage` footer 等主线
  181. - 若你的笔记/脚本仍写着 `openai-codex/*` 或整串 `clawhub install …`,请按上文迁移到 2026.9 主线
  182. ---
  183. ## 📖 纸质书:《OpenClaw超级个体实操手册》
  184. ⚠️ **当前说明**:开源教程的第 `1/2/5/7/8/10~15` 章已按 `v2026.9.3` 主线修订;纸质书仍然是更系统的重写版,适合需要完整、稳定、逐条验证内容的读者。
  185. **纸质书已全面修正,现已上市!**
  186. 清华大学出版社出版《OpenClaw超级个体实操手册》,在开源教程基础上做了**全面重写+逐条验证**:
  187. - 🔍 **144条CLI命令**对照官方文档逐条核对(教程中约60%已删除或修正)
  188. - ✅ **9套配置模板**全部在v2026.3.7+实际跑通
  189. - 🛡️ **新增安全防护指南** + 国产Claw全景指南
  190. - 📦 **7份随书附赠**电子资料
  191. 🛒 **购买链接**:[京东专属链接(¥42,原价¥59.8)](https://item.jd.com/14669463.html)
  192. 📦 **本地一键部署安装包**:[https://tryopenclaw.asia/](https://tryopenclaw.asia/)
  193. ---
  194. ### 📖 关于本教程
  195. ### 🎯 教程特色
  196. 1. **超级个体定位** - 一个人+OpenClaw=无限可能,效率提升10倍
  197. 2. **云端部署优先** - 降低技术门槛,手机随时使用
  198. 3. **国产模型为主** - 成本低、速度快、中文友好
  199. 4. **实战案例丰富** - 70+完整工作流,可直接应用
  200. 5. **中国本土化** - 企业微信/钉钉/飞书深度集成
  201. 6. **完整资源导航** - 官方资源、社区资源、学习路径
  202. ### 📊 教程规模
  203. - ✅ **15章节正文**:约267,000字
  204. - ✅ **15个附录**:约141,000字
  205. - ✅ **总字数**:408,000字
  206. - ✅ **70+实战案例**:可直接应用
  207. - ✅ **完整配图**:50+张配置截图
  208. ### 🎯 适合人群
  209. - 🚀 **超级个体**:想要一个人顶一个团队,实现个人价值最大化
  210. - 🔰 **完全新手**:从零开始,手把手教你安装配置
  211. - 💼 **知识工作者**:学习如何用OpenClaw提升10倍个人效率
  212. - 👨‍💻 **开发者**:深入了解Skills开发和API集成
  213. - ✍️ **内容创作者**:探索自动化工作流和高级应用
  214. ---
  215. ## 📚 完整教程目录
  216. ### 第一部分:零基础入门(3章节)
  217. - [第1章:OpenClaw是什么?](docs/01-basics/01-introduction.md)
  218. - [第2章:5分钟完成部署](docs/01-basics/02-installation.md)
  219. - [第3章:发送第一条消息](docs/01-basics/03-quick-start.md)
  220. ### 第二部分:核心功能(4章节)
  221. - [第4章:本地文件管理](docs/02-core-features/04-file-management.md)
  222. - [第5章:个人知识库](docs/02-core-features/05-knowledge-management.md)
  223. - [第6章:日程管理](docs/02-core-features/06-schedule-management.md)
  224. - [第7章:自动化工作流](docs/02-core-features/07-automation-workflow.md)
  225. ### 第三部分:进阶技能(4章节)
  226. - [第8章:Skills扩展](docs/03-advanced/08-skills-extension.md)
  227. - [第9章:多平台集成](docs/03-advanced/09-multi-platform-integration.md)
  228. - [第10章:API 与外部能力集成](docs/03-advanced/10-api-integration.md)
  229. - [第11章:高级配置(模型、记忆、审批与性能)](docs/03-advanced/11-advanced-configuration.md)
  230. ### 第四部分:实战案例(4章节)
  231. - [第12章:个人效率实战](docs/04-practical-cases/12-personal-productivity.md)
  232. - [第13章:高级自动化工作流](docs/04-practical-cases/13-advanced-automation.md)
  233. - [第14章:创意应用实战](docs/04-practical-cases/14-creative-applications.md)
  234. - [第15章:一人公司实战](docs/04-practical-cases/15-solo-entrepreneur-cases.md)
  235. ---
  236. ## 🔗 官方资源
  237. - **OpenClaw官方网站**:https://openclaw.ai
  238. - **OpenClaw官方文档**:https://docs.openclaw.ai
  239. - **GitHub仓库**:https://github.com/openclaw/openclaw
  240. - **ClawHub技能广场**:https://clawhub.ai
  241. - **Awesome Skills合集**:https://github.com/VoltAgent/awesome-openclaw-skills
  242. ## 💡 实战案例精选
  243. ### 📦 配置示例(开箱即用)
  244. - [基础配置](examples/configs/basic-config.json)
  245. - [多模型配置](examples/configs/multi-model-config.json)
  246. - [多Agent配置](examples/configs/multi-agent-config.json)
  247. - [飞书Bot配置](examples/configs/feishu-config.json)
  248. ### 🎬 实战场景
  249. - [文件管理:找发票](docs/02-core-features/04-file-management.md)
  250. - [知识管理:网页存档](docs/02-core-features/05-knowledge-management.md)
  251. - [日程管理:截图识别](docs/02-core-features/06-schedule-management.md)
  252. - [自动化:网站监控](docs/02-core-features/07-automation-workflow.md)
  253. ---
  254. ## 📊 成本对比
  255. | 方案 | 月费用 | 适用场景 |
  256. |------|--------|----------|
  257. | 飞书妙搭 | **免费** | 新手推荐(限时) |
  258. | 云端部署 | 20-50元 | 无Mac/24小时运行 |
  259. | 本地部署 | 0元 | 有Mac电脑 |
  260. | API费用(DeepSeek) | 5-30元 | 日常使用 |
  261. | API费用(Kimi) | 10-50元 | 长文档处理 |
  262. 💡 **省钱技巧**:使用国产大模型(DeepSeek、Kimi)节省**50%-70%**成本
  263. ---
  264. ## 🤝 贡献指南
  265. 欢迎贡献你的经验和案例!
  266. 1. Fork本仓库
  267. 2. 创建你的分支 (`git checkout -b feature/AmazingFeature`)
  268. 3. 提交你的修改 (`git commit -m 'Add some AmazingFeature'`)
  269. 4. 推送到分支 (`git push origin feature/AmazingFeature`)
  270. 5. 提交Pull Request
  271. ## 📮 联系方式
  272. ### 社交媒体
  273. - **GitHub**: [@xianyu110](https://github.com/xianyu110)
  274. - **CSDN专栏**: [OpenClaw从入门到精通](https://blog.csdn.net/xianyu120)
  275. - **B站**: [@MaynorAI](https://space.bilibili.com/399102586)
  276. - **YouTube**: [@buguniao537](https://www.youtube.com/@buguniao537)
  277. - **X (Twitter)**: [@Nikitka_aktikiN](https://x.com/Nikitka_aktikiN)
  278. ### 项目链接
  279. - **Clawbot项目**: [700+ Stars](https://github.com/xianyu110/clawbot)
  280. - **两万人AI社区主理人**
  281. ---
  282. ## 📈 项目进度
  283. - ✅ **v1.12**(2026-09-10):同步 OpenClaw `v2026.9.3`,覆盖 README / 安装升级 / 模型路由迁移 / Doctor / 关键章节基线,并新增 `updates/2026-09-10-v2026.9.3.md`
  284. - ✅ **v1.11**(2026-06-18):同步 OpenClaw `v2026.6.8` 稳定版,更新安装升级命令、版本基线、模型/渠道/usage/search 说明
  285. - ✅ **v1.10**(2026-04-16):第 `10~15` 章按 OpenClaw `v2026.4.14` 稳定版主线重写,并同步 README / 章节入口 / 纸书推荐文案
  286. - ✅ **v1.9**(2026-04-04):同步橙皮书 v1.3~v1.4 更新——新增微信ClawBot、腾讯全家桶、浏览器渠道、GLM-5-Turbo、安全漏洞统计
  287. - ✅ **v1.6**(2026-03-18):新增一键部署教程(8个平台)
  288. - 🔄 **后续**:继续清理第 `3/4/6/9` 章与 `tutorials/` 中的旧截图、旧渠道步骤
  289. ---
  290. ## 📄 许可证
  291. 本项目采用 [GPL-3.0 License](LICENSE)
  292. ![star](https://atomgit.com/xianyu120/awesome-openclaw-tutorial/star/badge.svg)
  293. ### ⚠️ 重要声明:禁止倒卖
  294. - ❌ **严禁倒卖**:禁止将本教程打包后进行商业售卖
  295. - ❌ **严禁闭源商用**:任何基于本项目的衍生作品必须同样开源
  296. - ✅ **允许学习**:欢迎个人学习和使用
  297. - ✅ **允许分享**:欢迎分享给更多需要的人
  298. - ✅ **允许修改**:可以修改并分享,但必须保持开源
  299. ---
  300. <div align="center">
  301. **最后更新**:2026年9月10日
  302. **教程版本**:v1.12
  303. **总字数**:408,000字(15章节 + 15附录)
  304. **适用OpenClaw版本**:2026.9.3(稳定版)
  305. 🎉 **教程已完成 | 支持续优化 | 完全免费** 🎉
  306. 🚀 **一个人 + OpenClaw = 无限可能** 🚀
  307. ⭐ **如果觉得有用,请给个Star支持一下** ⭐
  308. </div>
.claude/.skills/bananapro-image-gen/prepare-upload.sh · Bundled script · 182 lines · 1 finding marked
  1. #!/bin/bash
  2. # Banana Pro Image Gen Skill - 准备上传脚本
  3. set -e
  4. echo "🚀 准备上传 Banana Pro Image Generation Skill 到 skills.sh"
  5. echo "=================================================="
  6. echo ""
  7. # 1. 检查必需文件
  8. echo "📋 检查必需文件..."
  9. required_files=(
  10. "skill.json"
  11. "README.md"
  12. "SKILL.md"
  13. "requirements.txt"
  14. "scripts/generate_image.py"
  15. )
  16. for file in "${required_files[@]}"; do
  17. if [ -f "$file" ]; then
  18. echo " ✅ $file"
  19. else
  20. echo " ❌ $file - 缺失!"
  21. exit 1
  22. fi
  23. done
  24. echo ""
  25. # 2. 检查敏感信息
  26. echo "🔒 检查敏感信息..."
  27. if grep -r "sk-HoyC9xe8aB0CRC6j4EvuM0zRcN9TTYnIMjACMCeGvd95tuhQ" scripts/ 2>/dev/null; then
    • Dismissed after review: Contains what looks like a hardcoded OpenAI API key
    • Line 34 on GitHub
  28. echo " ⚠️ 警告:发现硬编码的 API Key!"
  29. echo " 请移除敏感信息后再上传"
  30. exit 1
  31. else
  32. echo " ✅ 未发现硬编码的敏感信息"
  33. fi
  34. echo ""
  35. # 3. 创建发布包
  36. echo "📦 创建发布包..."
  37. RELEASE_DIR="release"
  38. SKILL_NAME="bananapro-image-gen"
  39. # 清理旧的发布目录
  40. rm -rf "$RELEASE_DIR"
  41. mkdir -p "$RELEASE_DIR/$SKILL_NAME"
  42. # 复制文件
  43. cp -r scripts "$RELEASE_DIR/$SKILL_NAME/"
  44. cp skill.json "$RELEASE_DIR/$SKILL_NAME/"
  45. cp README.md "$RELEASE_DIR/$SKILL_NAME/"
  46. cp SKILL.md "$RELEASE_DIR/$SKILL_NAME/"
  47. cp requirements.txt "$RELEASE_DIR/$SKILL_NAME/"
  48. cp .gitignore "$RELEASE_DIR/$SKILL_NAME/"
  49. # 创建 LICENSE
  50. cat > "$RELEASE_DIR/$SKILL_NAME/LICENSE" << 'EOF'
  51. MIT License
  52. Copyright (c) 2026 xianyu110
  53. Permission is hereby granted, free of charge, to any person obtaining a copy
  54. of this software and associated documentation files (the "Software"), to deal
  55. in the Software without restriction, including without limitation the rights
  56. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  57. copies of the Software, and to permit persons to whom the Software is
  58. furnished to do so, subject to the following conditions:
  59. The above copyright notice and this permission notice shall be included in all
  60. copies or substantial portions of the Software.
  61. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  62. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  63. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  64. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  65. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  66. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  67. SOFTWARE.
  68. EOF
  69. echo " ✅ 发布包已创建:$RELEASE_DIR/$SKILL_NAME"
  70. echo ""
  71. # 4. 创建压缩包
  72. echo "📦 创建压缩包..."
  73. cd "$RELEASE_DIR"
  74. tar -czf "${SKILL_NAME}.tar.gz" "$SKILL_NAME"
  75. zip -r "${SKILL_NAME}.zip" "$SKILL_NAME" > /dev/null
  76. cd ..
  77. echo " ✅ ${SKILL_NAME}.tar.gz"
  78. echo " ✅ ${SKILL_NAME}.zip"
  79. echo ""
  80. # 5. 显示文件大小
  81. echo "📊 文件大小:"
  82. du -sh "$RELEASE_DIR/${SKILL_NAME}.tar.gz"
  83. du -sh "$RELEASE_DIR/${SKILL_NAME}.zip"
  84. echo ""
  85. # 6. 生成上传信息
  86. echo "📝 生成上传信息..."
  87. cat > "$RELEASE_DIR/UPLOAD_INFO.txt" << EOF
  88. Banana Pro Image Generation Skill - 上传信息
  89. ================================================
  90. Skill 名称: bananapro-image-gen
  91. 显示名称: Banana Pro Image Generation
  92. 版本: 1.0.0
  93. 作者: xianyu110
  94. 分类: Creativity
  95. 描述:
  96. 使用 Gemini 3 Pro Image 生成图片的 OpenClaw Skill,支持白板图、Logo设计、社交媒体配图等多种场景。
  97. 特点:
  98. - 支持中文提示词
  99. - 多种分辨率(1K/2K/4K)
  100. - 快速响应(10-30秒)
  101. - 成本低廉(\$0.04-0.16/张)
  102. 标签:
  103. ai, image-generation, gemini, creative, whiteboard, logo-design, text-to-image
  104. GitHub 仓库:
  105. https://github.com/xianyu110/awesome-openclaw-tutorial
  106. 文档链接:
  107. https://github.com/xianyu110/awesome-openclaw-tutorial/tree/main/.claude/.skills/bananapro-image-gen
  108. ================================================
  109. 上传步骤:
  110. 1. 访问 https://skills.sh/
  111. 2. 点击 "Submit a Skill" 或 "Add Skill"
  112. 3. 填写上述信息
  113. 4. 上传压缩包或提供 GitHub 链接
  114. 5. 提交审核
  115. 或者:
  116. 创建独立 GitHub 仓库:
  117. 1. 在 GitHub 创建新仓库:bananapro-image-gen-skill
  118. 2. 上传 release/$SKILL_NAME/ 目录下的所有文件
  119. 3. 在 skills.sh 提交 GitHub 链接
  120. ================================================
  121. EOF
  122. echo " ✅ UPLOAD_INFO.txt"
  123. echo ""
  124. # 7. 显示下一步
  125. echo "✅ 准备完成!"
  126. echo ""
  127. echo "📁 发布文件位置:"
  128. echo " $RELEASE_DIR/$SKILL_NAME/"
  129. echo ""
  130. echo "📦 压缩包:"
  131. echo " $RELEASE_DIR/${SKILL_NAME}.tar.gz"
  132. echo " $RELEASE_DIR/${SKILL_NAME}.zip"
  133. echo ""
  134. echo "📝 上传信息:"
  135. echo " $RELEASE_DIR/UPLOAD_INFO.txt"
  136. echo ""
  137. echo "🚀 下一步:"
  138. echo " 1. 查看 UPLOAD_GUIDE.md 了解详细上传步骤"
  139. echo " 2. 查看 $RELEASE_DIR/UPLOAD_INFO.txt 获取上传信息"
  140. echo " 3. 访问 https://skills.sh/ 提交你的 Skill"
  141. echo ""
  142. echo "💡 提示:"
  143. echo " - 可以直接上传压缩包"
  144. echo " - 或创建独立 GitHub 仓库后提交链接"
  145. echo " - 建议先在本地测试确保一切正常"
  146. echo ""
  147. echo "🎉 祝你的 Skill 发布成功!"
.claude/.skills/bananapro-image-gen/release/bananapro-image-gen/scripts/generate_image.py · Bundled script · 323 lines · 1 finding marked
  1. #!/usr/bin/env python3
  2. """
  3. 使用 Chat Completions 格式生成图片
  4. 适配 nextaicore API
  5. """
  6. import os
  7. import sys
  8. import json
  9. import base64
  10. import argparse
  11. import requests
  12. from pathlib import Path
  13. from datetime import datetime
  14. import re
  15. # API 配置
  16. # 请通过环境变量或命令行参数提供 API Key
  17. # export NEXTAI_API_KEY="your-api-key-here"
  18. DEFAULT_API_KEY = "" # 不要在代码中硬编码 API Key
  19. DEFAULT_BASE_URL = "https://tryallapi.com"
  20. DEFAULT_MODEL = "gemini-3-pro-image-preview"
  21. DEFAULT_API_FORMAT = "openai" # "openai" 或 "gemini"
  22. SUPPORTED_RESOLUTIONS = ["1K", "2K", "4K"]
  23. SUPPORTED_API_FORMATS = ["openai", "gemini"]
  24. def get_api_key(args_key=None):
  25. """获取API密钥"""
  26. if args_key:
  27. return args_key
  28. api_key = os.environ.get("NEXTAI_API_KEY")
  29. if api_key:
  30. return api_key
  31. # 如果没有提供 API Key,提示用户
  32. print("❌ 错误:未找到 API Key")
  33. print("请通过以下方式之一提供 API Key:")
  34. print(" 1. 环境变量:export NEXTAI_API_KEY='your-api-key'")
  35. print(" 2. 命令行参数:--api-key 'your-api-key'")
  36. sys.exit(1)
  37. def generate_filename(prompt):
  38. """根据提示词生成带时间戳的文件名"""
  39. timestamp = datetime.now().strftime("%Y-%m-%d-%H-%M-%S")
  40. keywords = prompt.split()[:3]
  41. keyword_str = "-".join(keywords)
  42. keyword_str = "".join(c if c.isalnum() or c in "-_." else "-" for c in keyword_str)
  43. keyword_str = keyword_str.lower()[:30]
  44. return f"{timestamp}-{keyword_str}.png"
  45. def extract_image_from_markdown(text):
  46. """从 Markdown 文本中提取图片 URL 或 base64"""
  47. # 匹配 ![](url) 格式
  48. url_pattern = r'!\[.*?\]\((https?://[^\)]+)\)'
  49. urls = re.findall(url_pattern, text)
  50. if urls:
  51. return urls[0], 'url'
  52. # 匹配 base64 格式
  53. base64_pattern = r'data:image/[^;]+;base64,([A-Za-z0-9+/=]+)'
  54. base64_matches = re.findall(base64_pattern, text)
  55. if base64_matches:
  56. return base64_matches[0], 'base64'
  57. return None, None
  58. def generate_image_with_chat(
  59. prompt,
  60. filename,
  61. resolution=None,
  62. model=None,
  63. api_key=None,
  64. base_url=None,
  65. api_format=None,
  66. ):
  67. """
  68. 使用 Chat Completions 格式生成图片
  69. 支持两种 API 格式:
  70. - openai: /v1/chat/completions
  71. - gemini: /v1beta/models/gemini-3-pro-image-preview:generateContent
  72. """
  73. api_key = get_api_key(api_key)
  74. base_url = base_url or DEFAULT_BASE_URL
  75. model = model or DEFAULT_MODEL
  76. api_format = api_format or DEFAULT_API_FORMAT
  77. # 根据 API 格式选择端点
  78. if api_format == "gemini":
  79. url = f"{base_url}/v1beta/models/{model}:generateContent"
  80. else: # openai
  81. url = f"{base_url}/v1/chat/completions"
  82. headers = {
  83. "Authorization": f"Bearer {api_key}",
  84. "Content-Type": "application/json",
  85. "Accept": "application/json"
  86. }
  87. # 构建提示词(添加分辨率要求)
  88. full_prompt = prompt
  89. if resolution:
  90. full_prompt = f"{prompt},分辨率:{resolution}"
  91. # 根据 API 格式构建 payload
  92. if api_format == "gemini":
  93. # Gemini 原生格式
  94. payload = {
  95. "contents": [
  96. {
  97. "parts": [
  98. {"text": full_prompt}
  99. ]
  100. }
  101. ],
  102. "generationConfig": {
  103. "responseModalities": ["IMAGE"]
  104. }
  105. }
  106. if resolution:
  107. payload["generationConfig"]["imageConfig"] = {
  108. "imageSize": resolution
  109. }
  110. else:
  111. # OpenAI 兼容格式
  112. payload = {
  113. "model": model,
  114. "messages": [
  115. {
  116. "role": "user",
  117. "content": full_prompt
  118. }
  119. ],
  120. "stream": False
  121. }
  122. print(f"正在生成图片...")
  123. print(f"提示词: {prompt}")
  124. if resolution:
  125. print(f"分辨率: {resolution}")
  126. print(f"模型: {model}")
  127. print(f"API 格式: {api_format}")
  128. print(f"API: {url}")
  129. print()
  130. try:
  131. response = requests.post(url, headers=headers, json=payload, timeout=120)
  132. print(f"响应状态码: {response.status_code}")
  133. if response.status_code != 200:
  134. print(f"错误响应: {response.text[:500]}")
  135. sys.exit(1)
  136. data = response.json()
  137. # 根据 API 格式解析响应
  138. if api_format == "gemini":
  139. # Gemini 格式:从 candidates 中提取图片
  140. if "candidates" in data and len(data["candidates"]) > 0:
  141. parts = data["candidates"][0].get("content", {}).get("parts", [])
  142. for part in parts:
  143. if "inlineData" in part:
  144. image_data = part["inlineData"].get("data")
  145. if image_data:
  146. print(f"解码 Gemini base64 图片数据")
  147. image_bytes = base64.b64decode(image_data)
  148. # 保存图片
  149. output_file = Path(filename)
  150. output_file.parent.mkdir(parents=True, exist_ok=True)
  151. with open(output_file, "wb") as f:
  152. f.write(image_bytes)
  153. print(f"✅ 图片已成功生成并保存到: {filename}")
  154. print(f"文件大小: {len(image_bytes) / 1024:.2f} KB")
  155. return filename
  156. print("⚠️ 未在 Gemini 响应中找到图片数据")
  157. print(f"完整响应: {json.dumps(data, indent=2, ensure_ascii=False)[:500]}")
  158. return None
  159. else:
  160. # OpenAI 格式:从 choices 中提取图片
  161. if "choices" in data and len(data["choices"]) > 0:
  162. content = data["choices"][0]["message"]["content"]
  163. print(f"模型回复长度: {len(content)} 字符")
  164. print(f"回复内容(前200字符): {content[:200]}")
  165. print()
  166. # 尝试从回复中提取图片
  167. image_data, data_type = extract_image_from_markdown(content)
  168. if image_data:
  169. if data_type == 'url':
  170. # 下载图片
  171. print(f"下载图片: {image_data}")
  172. img_response = requests.get(image_data, timeout=30)
  173. img_response.raise_for_status()
  174. image_bytes = img_response.content
  175. elif data_type == 'base64':
  176. # 解码 base64
  177. print(f"解码 base64 图片数据")
  178. image_bytes = base64.b64decode(image_data)
  179. # 保存图片
  180. output_file = Path(filename)
  181. output_file.parent.mkdir(parents=True, exist_ok=True)
  182. with open(output_file, "wb") as f:
  183. f.write(image_bytes)
  184. print(f"✅ 图片已成功生成并保存到: {filename}")
  185. print(f"文件大小: {len(image_bytes) / 1024:.2f} KB")
  186. return filename
  187. else:
  188. print("⚠️ 未在回复中找到图片数据")
  189. print(f"完整回复: {content}")
  190. # 保存回复到文本文件
  191. text_file = filename.replace('.png', '.txt')
  192. output_file = Path(text_file)
  193. output_file.parent.mkdir(parents=True, exist_ok=True)
  194. with open(text_file, 'w', encoding='utf-8') as f:
  195. f.write(content)
  196. print(f"回复已保存到: {text_file}")
  197. return None
  198. else:
  199. print("错误: 响应格式不正确")
  200. print(f"完整响应: {json.dumps(data, indent=2, ensure_ascii=False)}")
  201. sys.exit(1)
  202. except requests.exceptions.Timeout:
  203. print("错误: 请求超时,请稍后重试")
  204. sys.exit(1)
  205. except requests.exceptions.RequestException as e:
  206. print(f"错误: 请求失败 - {e}")
  207. if hasattr(e, "response") and e.response is not None:
  208. print(f"状态码: {e.response.status_code}")
  209. print(f"响应内容: {e.response.text[:500]}")
  210. sys.exit(1)
  211. except Exception as e:
  212. print(f"错误: {e}")
  213. import traceback
  214. traceback.print_exc()
  215. sys.exit(1)
  216. def main():
  217. parser = argparse.ArgumentParser(
  218. description="使用 Chat Completions 格式生成图片",
  219. formatter_class=argparse.RawDescriptionHelpFormatter,
  220. epilog="""
  221. 使用示例:
  222. 【生成图片】
  223. python generate_image_chat.py -p "画一只可爱的橙色猫咪"
  224. python generate_image_chat.py -p "生成一张日落山脉的图片" -r 2K
  225. python generate_image_chat.py -p "创建一个科技感的 Logo" -f logo.png
  226. 【指定模型】
  227. python generate_image_chat.py -p "画只猫" -m gpt-4o-image
  228. python generate_image_chat.py -p "画只猫" -m gemini-3-pro-image-preview
  229. 【API 配置】
  230. 默认 API: https://api.nextaicore.com
  231. 默认 Key: sk-WY9Rx5caemo39xIMN2OCNQ4cD3L0RDtKmC9Q1rot9rcKxgow
  232. 默认模型: gemini-3-pro-image-preview
  233. 可通过环境变量覆盖:
  234. export NEXTAI_API_KEY="your-key"
  235. """,
  236. )
  237. parser.add_argument("--prompt", "-p", required=True, help="图片描述")
  238. parser.add_argument("--filename", "-f", default=None, help="输出图片路径")
  239. parser.add_argument(
  240. "--resolution", "-r",
  241. default=None,
  242. choices=SUPPORTED_RESOLUTIONS,
  243. help="图片分辨率 (1K, 2K, 4K)"
  244. )
  245. parser.add_argument(
  246. "--model", "-m",
  247. default=DEFAULT_MODEL,
  248. help="模型名称 (默认: gemini-3-pro-image-preview)"
  249. )
  250. parser.add_argument(
  251. "--api-format", "-a",
  252. default=DEFAULT_API_FORMAT,
  253. choices=SUPPORTED_API_FORMATS,
  254. help="API 格式: openai 或 gemini (默认: openai)"
  255. )
  256. parser.add_argument("--api-key", "-k", default=None, help="API 密钥")
  257. parser.add_argument("--base-url", "-u", default=None, help="API 基础 URL")
  258. args = parser.parse_args()
  259. # 生成文件名
  260. if args.filename is None:
  261. args.filename = generate_filename(args.prompt)
  262. # 生成图片
  263. generate_image_with_chat(
  264. prompt=args.prompt,
  265. filename=args.filename,
  266. resolution=args.resolution,
  267. model=args.model,
  268. api_key=args.api_key,
  269. base_url=args.base_url,
  270. api_format=args.api_format,
  271. )
  272. if __name__ == "__main__":
  273. main()

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.