npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

lyf-image-gen

v1.0.4

Published

AI 图片生成工具 - 支持智谱AI、OpenAI、自定义API

Downloads

97

Readme

lyf-image-gen

AI 图片生成工具 - 内置智谱AI,支持自定义 API,默认使用cogview-3-flash免费图片生成模型

npm License: MIT

特性

  • 🎨 支持多种 AI 图片生成服务
  • 🚀 零运行时依赖(仅使用 Node.js 内置 fetch)
  • 🔌 提供 CLI 工具和 MCP 服务器
  • 📦 TypeScript 原生支持

支持的模型

| 服务 | 模型 | | ------ | ------------------------------------------- | | 智谱AI | cogview-3-flash, cogview-4, glm-image | | 自定义 | 兼容 OpenAI 格式的 API |

安装

npm install -g lyf-image-gen

CLI 使用

# 生成图片
ccm-image-gen generate "beautiful landscape" --model cogview-3-flash

# 指定 API Key
ccm-image-gen generate "风景" -k YOUR_API_KEY

# 指定尺寸
ccm-image-gen generate "a cat" -s 1024x1024

# 查看支持的模型
ccm-image-gen models

环境变量

export IMAGE_GEN_API_KEY="your-api-key"
export IMAGE_GEN_MODEL="cogview-3-flash"
export IMAGE_GEN_API_URL="https://..."

MCP 服务器

claude_desktop_config.json 中配置:

{
  "mcpServers": {
    "image-gen": {
      "command": "ccm-image-gen-mcp",
      "env": {
        "IMAGE_GEN_API_KEY": "your-api-key"
      }
    }
  }
}

编程使用

import { ZhipuGenerator } from "lyf-image-gen";

const generator = new ZhipuGenerator("your-api-key", "cogview-3-flash");

const result = await generator.generate("beautiful landscape", {
  size: "1440x720",
});

console.log(result);
// { success: true, imageUrl: '...', localPath: '...' }

支持的图片尺寸

  • 智谱 AI: 1024x1024, 768x1344, 864x1152, 1344x768, 1152x864, 1440x720, 720x1440

模型技术文档

可以自行阅读网页查询使用方式

模型价格

  • glm-image:0.1元人民币/次
  • CogView-4:0.06元人民币/次
  • CogView-3-flash:免费

License

MIT