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

@lingxinai/psychology

v1.0.5

Published

TypeScript SDK for LingxinAI Psychology Open APIs

Readme

LingxinAI Psychology NPM SDK

TypeScript SDK for LingxinAI Psychology Open APIs.

Install

npm install @lingxinai/psychology

Quick Start

import { PsychologyClient } from "@lingxinai/psychology";

const client = PsychologyClient.builder()
  .admin("your-api-key", "your-api-secret")
  .build();

const students = await client.openApi().student().list({
  orgCode: "school001",
  pageNum: 0,
  pageSize: 20
});

console.log(students.content);

Client Identity

Create one client per identity. Do not mix admin, user, student, or parent calls on the same client.

const adminClient = PsychologyClient.builder()
  .admin("your-api-key", "your-api-secret")
  .build();

const userClient = PsychologyClient.builder()
  .user("your-api-key", "your-api-secret", "external-user-001")
  .build();

const studentClient = PsychologyClient.builder()
  .student("your-api-key", "your-api-secret", 10001)
  .build();

For parent login or other flows that already return a platform access token:

const parentClient = PsychologyClient.builder()
  .accessToken(parentLoginResponse.token)
  .build();

API Groups

  • auth() - login helpers
  • org() - organization APIs
  • dept() - department/class APIs
  • student() - student APIs
  • orgUser() - organization staff APIs
  • device() - device APIs
  • bot() - bot APIs
  • chat() - chat APIs
  • course() - micro course APIs
  • algo() - HTTP ASR/TTS and realtime ASR/TTS WebSocket APIs
  • crisis() - crisis warning APIs
  • meditation() - meditation APIs
  • overview() - dashboard/statistics APIs
  • parent() - parent-side APIs
  • quickInterview() - quick interview APIs
  • activity() - activity APIs
  • scale() - scale/interview runtime APIs

Realtime ASR

Realtime ASR returns a Promise<WebSocket> because the SDK prepares the authenticated connection first.

const ws = await studentClient.openApi().algo().realtimeAsr({
  voiceFormat: 1,
  inputSampleRate: 16000
});

ws.on("open", () => {
  ws.send(JSON.stringify({ type: "start" }));
  ws.send(audioChunk);
  ws.send(JSON.stringify({ type: "end" }));
});

ws.on("message", (message) => {
  console.log(message.toString());
});

Bidirectional TTS

Use bidirectionalTts when text arrives in chunks and audio must be streamed back at the same time.

const ws = await studentClient.openApi().algo().bidirectionalTts();

ws.on("open", () => {
  ws.send(JSON.stringify({ type: "start", voiceCode: "zh_female_linjianvhai_moon_bigtts", format: "mp3" }));
  ws.send(JSON.stringify({ type: "text", text: "我们先做一次简单的" }));
  ws.send(JSON.stringify({ type: "text", text: "放松练习。" }));
  ws.send(JSON.stringify({ type: "end" }));
});

ws.on("message", (message) => {
  console.log(Buffer.isBuffer(message) ? message.length : message.toString());
});

Verification

npm run verify
npm audit --omit=dev
npm pack --dry-run