Skip to main content
logo

✨ 即梦绘画 ✨

LICENSE pypi python uv
ruff pre-commit

📖 介绍

一个基于 NoneBot2 的 AI 创作插件,通过调用 即梦(Jimeng) 的 OpenAPI 实现图片生成和视频生成功能。

  • 文生图:根据文本描述生成图片。
  • 图生图:结合图片和文本描述生成新的图片。
  • 文生视频:根据文本描述生成视频。
  • 图生视频:根据图片描述生成视频。
  • 多账号支持:内置简单的多账号轮询和积分管理机制。

💿 安装

使用 nb-cli 安装 (推荐) 在 nonebot2 项目的根目录下打开命令行, 输入以下指令即可安装
nb plugin install nonebot-plugin-jimeng --upgrade
使用包管理器安装 在 nonebot2 项目的插件目录下, 打开命令行, 根据你使用的包管理器, 输入相应的安装命令
pip
pip install nonebot-plugin-jimeng
pdm
pdm add nonebot-plugin-jimeng
poetry
poetry add nonebot-plugin-jimeng
uv
uv pip install nonebot-plugin-jimeng

安装后,请打开 nonebot2 项目根目录下的 pyproject.toml 文件, 在 [tool.nonebot] 部分的 plugins 列表中添加 nonebot_plugin_jimeng 以加载插件。

[tool.nonebot]
plugins = [
    # ... other plugins
    "nonebot_plugin_jimeng"
]

⚙️ 配置

在您的 nonebot2 项目的 .env 或 .env.prod 文件中添加以下配置项。

配置项 必填 默认值 说明
JIMENG__ACCOUNTS 否 [] 即梦账号(目前主要是国际服支持账密登录)列表。当 JIMENG_USE_ACCOUNT=true 时需要填写。格式为 '[{"account": "user1@example.com", "password": "password1"}, ...]'
JIMENG__USE_ACCOUNT 否 True 是否通过账号自动获取密钥。如果设为 False,则需要提供 JIMENG_SECRET_KEY。
JIMENG__OPEN_API_URL 否 '' 逆向 API 的地址或官方API地址。
JIMENG__DEFAULT_IMAGE_MODEL 否 jimeng-4.5 默认使用的图像生成模型。
JIMENG__DEFAULT_VIDEO_MODEL 否 jimeng-video-3.0 默认使用的视频生成模型。
JIMENG__RESOLUTION 否 2k 图像模型生成分辨率。
JIMENG__MAX_CONCURRENT_TASKS_PER_USER 否 2 每个用户的最大并发任务数。
JIMENG__MAX_RETRIES 否 3 请求失败时的最大重试次数,一般是上传图片出现问题重试。
JIMENG__RETRY_DELAY 否 1 每次重试的间隔时间(秒)。
JIMENG__TIMEOUT 否 600 发送API请求的超时时间(秒)。如果为-1则不会有超时设置
JIMENG__SECRET_KEY 否 "" API 密钥。当 JIMENG_USE_ACCOUNT=false 时生效。
JIMENG__PROXY_TYPE 否 None 代理类型可选: "http", "socks5", None(在.env文件中直接填入JIMENG__PROXY_TYPE=即可)
JIMENG__PROXY_HOST 否 "127.0.0.1" 代理服务器地址
JIMENG__PROXY_PORT 否 7890 代理服务器端口
JIMENG__PROXY_USERNAME 否 None 代理用户名 (可选)
JIMENG__PROXY_PASSWORD 否 None 代理密码 (可选)

JIMENG_ACCOUNTS 格式说明

这是一个 JSON 字符串数组,每个对象代表一个即梦账号。插件启动时会根据此配置初始化 session_id。

配置示例: JIMENG__ACCOUNTS配置示例

# .env.prod
JIMENG_ACCOUNTS='[{"email": "your_email1@example.com", "password": "12234" , "region": "hk"}, {"email": "your_email1@example.com", "password": "12234" , "region": "jp"}]'

💡 注意事项

如果使用图生图功能,请确保你的图片可以被正确访问 有时候国际服积分可能没有自动刷新成功,比如说凌晨的时候,如果遇到积分还是没刷新为0的情况,可能需要等一段时间

🎉 使用

指令表

指令 说明
即梦绘画 <关键词> 文生图。根据提供的关键词进行创作。
即梦绘画 <关键词> (回复图片) 图生图。回复一张图片,并附上关键词,将在原图基础上进行创作。
即梦积分 查询可用账号的积分
即梦视频 文/图生视频。启动交互式向导设置参数然后生成视频。

🎨 效果图

文生图

即梦绘画 画一个二次元狐娘给我

img_1.png

图生图 (回复一张图片)

即梦绘画 让她躺在一个洁白的床

img.png

文生视频

即梦视频 一个苹果摔落在地上

img_2.png img_3.png

图生视频

即梦视频 (在交互式向导中提供图片)

img_4.png img_5.png

TODO

  • 完成文生图功能 (text-to-image)
  • 完成图生图功能 (image-to-image)
  • 完成交互式自定义参数生成图片功能 (text/image-to-image)
  • 完成图生视频功能 (image-to-video)
  • 完成文生视频功能 (text-to-video)
  • 完成图生视频功能 (image-to-video)
  • 完成交互式自定义参数生成视频功能 (text/image-to-video)
  • 多账号轮询与积分管理
  • 更友好的用户错误提示

🙏 致谢

感谢 https://github.com/iptag/jimeng-api 提供的 OpenAPI 支持。

Metadata

Release files for nonebot-plugin-jimeng 0.4.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nonebot-plugin-jimeng 0.4.5
File Size Uploaded Provenance Actions
nonebot_plugin_jimeng-0.4.5.tar.gz 16.0 kB Without provenance Details for nonebot_plugin_jimeng-0.4.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nonebot-plugin-jimeng 0.4.5
File Interpreter ABI Platform Actions
nonebot_plugin_jimeng-0.4.5-py3-none-any.whl Python 3 none any Details for nonebot_plugin_jimeng-0.4.5-py3-none-any.whl

Total release size: 34.1 kB

Release files / nonebot_plugin_jimeng-0.4.5.tar.gz

Download URL nonebot_plugin_jimeng-0.4.5.tar.gz
Size 16.0 kB
Tags Source
SHA-256 checksum
How to use checksums
9d9431eac559b4c94fb20dbc0b3f9d4b541126a17a87b633e293c825c3f02a71
BLAKE2b-256 checksum
How to use checksums
b0b788ddf823020ac4bd265cd9119cd0e8f98fb06d9a350ffda3ed6c90ddb444
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / nonebot_plugin_jimeng-0.4.5-py3-none-any.whl

Download URL nonebot_plugin_jimeng-0.4.5-py3-none-any.whl
Size 18.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bd95caa13ebf354f92e8d43c3cb1c8e5c4207a7d0ea2a6ee0963e0aba5c4b48d
BLAKE2b-256 checksum
How to use checksums
ee7467751caac4758be704893db09be368a6d5c12867e4d80ef6dda14be06141
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for nonebot-plugin-jimeng 0.4.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page