Skip to main content

豆包AI绘图插件,支持文生图和以图生图

Project description

nonebot-plugin-doubao-draw

基于豆包 Seedream API 的 NoneBot2 AI 绘图插件,支持文生图和以图生图。

功能特性

  • 文生图:根据提示词生成图片
  • 以图生图:基于参考图片生成新图
  • 多图参考:支持最多 9 张参考图片
  • 引用图片:回复图片消息即可使用该图片作为参考
  • Token 统计:显示每次生成的 token 消耗和费用
  • 群组控制:支持配置只在指定群启用

安装

使用 nb-cli 安装

nb plugin install nonebot-plugin-doubao-draw

使用 pip 安装

pip install nonebot-plugin-doubao-draw

配置

在 NoneBot2 项目的 .env 文件中添加以下配置:

DOUBAO_DRAW_API_KEY=your_api_key_here
DOUBAO_DRAW_ENABLED=true
DOUBAO_DRAW_SIZE=2K
DOUBAO_DRAW_GROUPS=[]

配置项说明

配置项 类型 默认值 说明
DOUBAO_DRAW_API_KEY str "" 豆包 API 密钥(必填)
DOUBAO_DRAW_ENABLED bool true 是否启用插件
DOUBAO_DRAW_SIZE str "2K" 图片尺寸
DOUBAO_DRAW_GROUPS list[int] [] 启用的群号列表,为空表示所有群启用

使用方法

文生图

/绘图 一只可爱的猫咪

以图生图(附图)

发送命令时附带图片:

/绘图 将这张图片变成油画风格 [附图]

支持同时附带多张图片(最多 9 张)。

以图生图(引用)

回复一张图片消息:

/绘图 将这张图片变成水彩画风格

查看帮助

/绘图帮助

获取 API Key

  1. 访问 火山引擎方舟
  2. 注册并登录账号
  3. 开通 Seedream 模型服务
  4. 获取 API Key

支持的模型

模型 输入价格 输出价格
doubao-seedream-5-0-260128 ¥0.008/千tokens ¥0.08/千tokens
doubao-seedream-4-5-251128 ¥0.015/千tokens ¥0.15/千tokens
doubao-seedream-4-0-250828 ¥0.008/千tokens ¥0.08/千tokens

注意事项

  • 确保已正确配置 API Key
  • 图片生成需要一定时间,请耐心等待
  • 生成的图片通过 Base64 编码直接发送,无需额外存储

许可证

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nonebot_plugin_doubao_draw-0.1.4.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nonebot_plugin_doubao_draw-0.1.4-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file nonebot_plugin_doubao_draw-0.1.4.tar.gz.

File metadata

  • Download URL: nonebot_plugin_doubao_draw-0.1.4.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.3 CPython/3.13.1 Windows/10

File hashes

Hashes for nonebot_plugin_doubao_draw-0.1.4.tar.gz
Algorithm Hash digest
SHA256 3933e0c8990361d609171f2131c7723d5cb43596818da904464ddfbd07e9f6b2
MD5 e3ea57cd6f5baf31f0250c2e1538f43f
BLAKE2b-256 aadd941e8fe59cb9458b11aab2cdb2293ceb70ce9b886e280726112de1c2f66a

See more details on using hashes here.

File details

Details for the file nonebot_plugin_doubao_draw-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for nonebot_plugin_doubao_draw-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 80d9543dacc653ac3c880c23744eed9cd27548a9feb7df6eae656a42812b0af6
MD5 f680efff0803f1eec552a07af5e6a9f6
BLAKE2b-256 eb0377b0d92f121121ee318dc7d1d41b9001f983c1aa99c64fd6f5cb36f6a4ca

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page