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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@ezijing/ai-core

v1.0.37

Published

Core AI SDK for Tongyi Qianwen, DeepSeek, and Silicon Flow APIs

Readme

SiliconFlow Adapter

SiliconFlow 适配器,支持文本生成、图像生成和视频生成功能。

功能特性

  • 🤖 文本生成和对话
  • 🖼️ 图像生成
  • 🎥 视频生成(支持轮询获取结果)

视频生成

SiliconFlow 的视频生成是异步的,包含以下步骤:

  1. 提交视频生成请求,获得 requestId
  2. 自动轮询获取视频生成状态
  3. 返回最终的视频链接

使用方法

import { createSiliconflowAdapter } from '@ezijing/ai-core'

const adapter = createSiliconflowAdapter()

// 生成视频
const videoResponse = await adapter.generateVideo({
  prompt: '一只可爱的小猫在花园里玩耍',
  model: 'Wan-AI/Wan2.2-T2V-A14B',
  image_size: '1280x720',
})

console.log('Video URL:', videoResponse.url)
console.log('Raw response:', videoResponse.raw)

支持的模型

  • Wan-AI/Wan2.2-T2V-A14B - 文本到视频生成(默认)
  • HunyuanVideo - 混元视频生成

支持的视频尺寸

  • 1280x720 (16:9) - 默认
  • 1024x1024 (1:1)

轮询配置

轮询功能默认配置:

  • 最大尝试次数:60 次
  • 轮询间隔:2 秒
  • 总超时时间:2 分钟

错误处理

  • 网络错误:自动重试
  • 生成失败:抛出错误信息
  • 超时:抛出超时错误

图像生成

const imageResponse = await adapter.generateImage({
  prompt: '一只可爱的小猫',
  model: 'Kwai-Kolors/Kolors',
  image_size: '1024x1024',
})

console.log('Image URL:', imageResponse.url)

文本生成

const textResponse = await adapter.generateText({
  prompt: '你好,请介绍一下自己',
  model: 'Pro/deepseek-ai/DeepSeek-V3',
})

console.log('Response:', textResponse.text)

流式文本生成

const streamResponse = await adapter.generateStreamText(
  {
    prompt: '请写一个故事',
    model: 'Pro/deepseek-ai/DeepSeek-V3',
  },
  {
    onUpdate: (chunk) => {
      console.log('Chunk:', chunk.text)
    },
  }
)

注意事项

  1. API 密钥:请确保在环境变量中设置正确的 SiliconFlow API 密钥
  2. 视频有效期:生成的视频链接有效期为 10 分钟,请及时使用
  3. 轮询机制:视频生成会自动轮询,无需手动处理
  4. 错误处理:建议在生产环境中添加适当的错误处理和重试机制