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

@ezijing/ai-core

v2.0.0

Published

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

Readme

@ezijing/ai-core

@ezijing/ai-core 提供按模型路由的多 provider client。

安装

npm install @ezijing/ai-core

创建 Provider

import {
  createDeepSeekProvider,
  createQianfanProvider,
  createVolcengineProvider,
} from '@ezijing/ai-core'

const deepseek = createDeepSeekProvider({ apiKey: 'your-deepseek-key' })
const volcengine = createVolcengineProvider({ apiKey: 'your-volcengine-key' })
const qianfan = createQianfanProvider({ apiKey: 'your-qianfan-key' })

创建 Client

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

const client = createClient({
  providers: {
    deepseek,
    volcengine,
    qianfan,
  },
})

获取模型列表

const models = client.getModels()

模型结构:

type AIModel = {
  label: string
  provider: string
  model: string
  value: string
  capabilities: ('text' | 'image' | 'video')[]
  disabled?: boolean
}

其中 disabled: true 的模型不会出现在 client.getModels() 里。

示例:

[
  {
    label: 'DeepSeek-V3',
    provider: 'deepseek',
    model: 'deepseek-chat',
    value: 'deepseek:deepseek-chat',
    capabilities: ['text'],
  },
]

文本生成

const response = await client.generateText({
  model: 'deepseek:deepseek-chat',
  prompt: '你好,请介绍一下自己',
})

console.log(response.content)
console.log(response.reasoning)
console.log(response.references)

流式文本

const result = client.streamText({
  model: 'volcengine:deepseek-v3-2-251201',
  prompt: '请写一个故事',
})

for await (const chunk of result.textStream) {
  console.log(chunk)
}

const finalText = await result.text
const response = await result.response

消费完整流:

for await (const chunk of result.fullStream) {
  console.log(chunk.content)
  console.log(chunk.contentDelta)
  console.log(chunk.reasoning)
}

图片生成

const image = await client.generateImage({
  model: 'volcengine:doubao-seedream-4-5-251128',
  prompt: '一只可爱的小猫',
})

console.log(image.images)

视频生成

const result = client.streamVideo({
  model: 'volcengine:doubao-seedance-1-5-pro-251215',
  prompt: '一只可爱的小猫在花园里玩耍',
})

for await (const update of result.statusStream) {
  console.log(update.status)
}

const video = await result.response
console.log(video.url)
console.log(video.duration)
console.log(video.ratio)
console.log(video.resolution)

取消视频任务:

result.cancel()

RequestOptions

所有方法都支持统一的第二个参数:

type RequestOptions = AxiosRequestConfig

最常用的是 signal

const controller = new AbortController()

const result = client.streamText(
  {
    model: 'deepseek:deepseek-chat',
    prompt: '你好',
  },
  {
    signal: controller.signal,
  },
)

controller.abort()

路由规则

  • 使用 provider:model 作为唯一模型值
  • client 只负责注册 provider 和按模型路由
  • provider 自己负责创建和请求适配

注意事项

  • 浏览器直连时,provider key 仍然会暴露给最终用户