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

aliyun-qwen-sdk

v1.0.5

Published

Alibaba Cloud Qwen SDK based on Vercel AI SDK

Readme

aliyun-qwen-sdk

Alibaba Cloud Qwen SDK based on Vercel AI SDK.

安装

npm install aliyun-qwen-sdk

环境配置

在使用之前,需要设置阿里云 DashScope API Key:

export DASHSCOPE_API_KEY=your-api-key

或者在代码中设置:

process.env.DASHSCOPE_API_KEY = 'your-api-key';

获取 API Key: https://dashscope.console.aliyun.com/

快速开始

基础文本调用

import { callAI } from 'aliyun-qwen-sdk';

const result = await callAI('你好,请介绍一下你自己');
console.log(result.text);
console.log(result.meta);

指定模型

import { callAI, textModels } from 'aliyun-qwen-sdk';

const result = await callAI('你好', {
  model: 'qwen-max',
  temperature: 0.7,
});

多模态输入(图片)

import { callAI } from 'aliyun-qwen-sdk';

const result = await callAI({
  prompt: '描述这张图片的内容',
  images: ['https://example.com/image.jpg'],
});
console.log(result.text);

结构化 JSON 输出

import { callAIJSON } from 'aliyun-qwen-sdk';
import { z } from 'zod';

const schema = z.object({
  name: z.string(),
  age: z.number(),
  skills: z.array(z.string()),
});

const result = await callAIJSON(
  schema,
  '请生成一个名为张三、25岁、擅长 TypeScript 和 Python 的人物信息'
);

console.log(result.text.name);    // "张三"
console.log(result.text.age);     // 25
console.log(result.text.skills);  // ["TypeScript", "Python"]

API

callAI

纯文本或多模态调用。

function callAI<T extends AIInput = string>(
  input: T,
  options?: CallOptions
): Promise<CallResult<string>>

参数:

  • input: 字符串或 { prompt: string; images: string[] }
  • options: 可选配置
    • model: 指定模型
    • temperature: 温度参数 (0-1)
    • maxTokens: 最大 token 数

返回:

{
  text: string;
  meta: {
    model: string;
    finishReason: string;
    usage?: {
      promptTokens: number;
      completionTokens: number;
      totalTokens: number;
    };
  };
}

callAIJSON

结构化 JSON 输出。

function callAIJSON<T extends z.ZodType>(
  schema: T,
  input: AIInput,
  options?: CallOptions
): Promise<CallResult<z.infer<T>>>

可用模型

文本模型

| 模型 | 描述 | |------|------| | qwen-turbo | 快速响应 | | qwen-plus | 平衡性能 | | qwen-max | 最强性能 | | qwen-max-longcontext | 长文本 | | qwen3.6-plus | Qwen3 平衡性能 (默认) | | qwen3.6-max | Qwen3 最强性能 |

多模态模型

| 模型 | 描述 | |------|------| | qwen-vl-plus | 视觉理解 | | qwen-vl-max | 最强视觉 | | qwen3-vl-plus | Qwen3 视觉理解 (默认) | | qwen3-vl-max | Qwen3 最强视觉 |

类型导出

import {
  callAI,
  callAIJSON,
  textModels,
  multimodalModels,
  defaults,
  type TextModel,
  type MultimodalModel,
  type ModelName,
  type CallOptions,
  type CallResult,
  type AIInput,
} from 'aliyun-qwen-sdk';

许可证

MIT