New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

asrm

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

asrm

Unify Automatic Speech Recognitio (ASR) SDK / 通用语音转写 SDK

latest
Source
npmnpm
Version
0.0.2
Version published
Maintainers
1
Created
Source

asrm

CI

Automatic Speech Recognitio (ASR) 录音转写多平台通用 SDK.

  • ifasr_new: 科大讯飞 录音文件转写 标准版
  • ifasr_llm: 科大讯飞 录音文件转写 大模型

Installation

npm i -g asrm

使用 CLI 前, 请确认 ffmpeg 已经安装在 PATH 中.

CLI Usage

科大讯飞 录音文件转写 标准版

asrm --provider=ifasr_new <filepath>
asrm --provider=ifasr_new task <id>

环境变量:

  • XFYUN_APP_ID: 应用 ID
  • XFYUN_IFASR_NEW_SECRET_KEY: SecretKey

科大讯飞 录音文件转写 大模型

asrm --provider=ifasr_llm <filepath>
asrm --provider=ifasr_new task <id> --signature=<signature>

环境变量:

  • XFYUN_APP_ID: 应用 ID
  • XFYUN_IFASR_LLM_KEY_ID: API Key
  • XFYUN_IFASR_LLM_KEY_SECRET: API Secret

SDK Usage

import { AsrClient, Provider } from 'asrm';

// 1. 指定 provider
const provider = 'ifasr_new' // or 'ifasr_llm', ...

// 2. 初始化 client, 配置所有相关 secret, 配置所有默认配置
const client = new AsrClient(
  provider,
  {
    [Provider.ifasr_new]: {
      appId: process.env.XFYUN_APP_ID!,
      secretKey: process.env.XFYUN_IFASR_NEW_SECRET_KEY!
    },
    [Provider.ifasr_llm]: {
      appId: process.env.XFYUN_APP_ID!,
      accessKeyId: process.env.XFYUN_IFASR_LLM_KEY_ID!,
      accessKeySecret: process.env.XFYUN_IFASR_LLM_KEY_SECRET!
    }
  },
  {
    upload: {
      [Provider.ifasr_new]: {},
      [Provider.ifasr_llm]: {}
    },
    recognize: {
      [Provider.ifasr_new]: {
        language: options.language || 'cn',
        roleType: 1,
        roleNum: 0
      },
      [Provider.ifasr_llm]: {
        language: options.language || 'autodialect'
      }
    }
  }
);

// 3. 创建 ASR 任务
const task = client.createTask()

// 4. 开始转写
await client.recognize({
  file: {
    name: '',
    data: <...>,
    size: <...>,
    duration: <...>
  }
})

// 5. 轮询结果
await client.getStatus()

恢复任务状态.

const client = new AsrClient(...)

const task = client.createTask()

task.id = '...'
task.signature = '...'

await task.getStatus()

License

MIT License © 2025 XLor

Keywords

asr

FAQs

Package last updated on 22 Nov 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts