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

@cherryin/models

v0.0.5

Published

An database of AI models

Readme

@cherryin/models

AI 模型供应商数据库,包含 75+ 供应商信息和模型数据。

安装

pnpm add @cherryin/models

使用

Provider 数据

import { providers, providerIds, getProviderModels, getModelById } from '@cherryin/models'
import type { Provider, Model, ProviderId } from '@cherryin/models'

// 获取所有 provider IDs
console.log(providerIds)
// ['abacus', 'aihubmix', 'alibaba', 'anthropic', 'openai', ...]

// 获取单个 provider
const openai = providers['openai']
console.log(openai.name)  // 'OpenAI'
console.log(openai.api)   // 'https://api.openai.com/v1/'
console.log(openai.doc)   // 'https://platform.openai.com/docs'

// 获取 provider 的所有模型
const models = getProviderModels(openai)
console.log(models.length)

// 获取特定模型
const gpt4 = getModelById(openai, 'gpt-4o')
console.log(gpt4?.name)       // 'GPT-4o'
console.log(gpt4?.cost)       // { input: 2.5, output: 10, ... }
console.log(gpt4?.limit)      // { context: 128000, output: 16384 }

异步加载

import { getProviderAsync } from '@cherryin/models'

// 异步获取 provider(支持动态导入)
const anthropic = await getProviderAsync('anthropic')

ProviderLogo 组件

import { ProviderLogo, getProviderLogoUrl, getDefaultLogoUrl } from '@cherryin/models'

// React 组件(加载失败时显示默认 logo)
<ProviderLogo providerId="anthropic" size={24} className="rounded" />

// 获取 logo URL
const url = getProviderLogoUrl('openai')
// https://unpkg.com/@cherryin/models/static/logos/provider/openai.svg

// 获取默认 logo URL
const defaultUrl = getDefaultLogoUrl()
// https://unpkg.com/@cherryin/models/static/logos/provider/logo.svg

类型定义

interface Provider {
  id: string
  name: string
  env: string[]      // 环境变量名称
  npm: string        // npm 包名
  api?: string       // API 端点
  doc: string        // 文档链接
  models: Record<string, Model>
}

interface Model {
  id: string
  name: string
  family?: string
  attachment?: boolean
  reasoning?: boolean
  tool_call?: boolean
  temperature?: boolean
  knowledge?: string       // 知识截止日期
  release_date?: string
  modalities?: { input: string[]; output: string[] }
  open_weights?: boolean
  cost?: ModelCost
  limit?: ModelLimit
  status?: string          // 'deprecated' 等
}

interface ModelCost {
  input: number            // 每百万 token 价格
  output: number
  cache_read?: number
  cache_write?: number
}

interface ModelLimit {
  context: number          // 上下文窗口
  output: number           // 最大输出
}

更新数据

models.dev 获取最新数据:

pnpm --filter @cherryin/models build:providers

此命令会:

  1. 下载最新的 api.json
  2. 下载所有 provider logos
  3. 生成 TypeScript 代码文件

目录结构

packages/models/
├── scripts/
│   └── build-models-dev-providers.ts  # 构建脚本
├── src/
│   ├── index.ts                       # 主入口
│   ├── types.ts                       # 类型定义
│   ├── provider/
│   │   ├── index.ts                   # Provider 操作函数
│   │   ├── _providers.ts              # 自动生成 - 汇总导出
│   │   ├── anthropic.ts               # 自动生成 - Provider 数据
│   │   ├── openai.ts                  # 自动生成
│   │   └── ...                        # 75 个 provider 文件
│   └── components/
│       └── ProviderLogo.tsx           # Logo 组件
└── static/
    ├── logos/provider/                # SVG logos
    └── models.dev/api.json            # 原始数据

数据来源

  • Provider 和 Model 数据来自 models.dev
  • Logo 资源来自 https://models.dev/logos/{provider-id}.svg