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

torque-assistant

v0.1.0

Published

Official Torque Assistant SDK — server-side chat and SSE streaming for Platform API v1

Readme

torque-assistant

Official server-side client for Torque Assistant (Platform API v1).

Uses the same business API key as Checkout (sk_live_…). Targets BFF / backend integrators — not in-app browser sessions.

Install

yarn add torque-assistant @torquefi/types

Quick start

import { createTorqueAssistantFromEnv } from 'torque-assistant'

const assistant = createTorqueAssistantFromEnv()

const reply = await assistant.chat({
  messages: [{ role: 'user', content: 'Summarize my BTC exposure' }],
  context: { walletAddress: '0x…', chainId: 8453 },
})

console.log(reply.content, reply.functionResults)

Streaming (SSE)

for await (const event of assistant.chatStream({
  messages: [{ role: 'user', content: 'What moved today?' }],
  context: { walletAddress: '0x…', chainId: 8453 },
})) {
  if (event.type === 'delta') process.stdout.write(event.text)
  if (event.type === 'done') console.log(event.functionResults)
  if (event.type === 'error') throw new Error(event.message)
}

Pass signal via the second argument to cancel:

const controller = new AbortController()
const stream = assistant.chatStream(request, { signal: controller.signal })

Configuration

import { createTorqueAssistant } from 'torque-assistant'

const assistant = createTorqueAssistant({
  apiKey: process.env.TORQUE_API_KEY!,
  baseUrl: 'https://app.torque.fi', // optional
  timeout: 180_000, // optional — Gemini tool rounds can be slow
})

Environment variables: TORQUE_API_KEY, optional TORQUE_BASE_URL.

Endpoint

| Method | SDK | HTTP | |--------|-----|------| | chat | JSON response | POST /api/v1/assistant/chat | | chatStream | Async iterator over SSE | POST /api/v1/assistant/chat?stream=true |

Errors

| Status | Code | Class | |--------|------|-------| | 402 | assistant_credits_exhausted | TorqueAssistantCreditsError | | v1 JSON | { error: { code, message } } | TorqueAssistantError |

import {
  TorqueAssistantCreditsError,
  TorqueAssistantError,
  ASSISTANT_CREDITS_ERROR_CODE,
} from 'torque-assistant'

try {
  await assistant.chat({ messages, context })
} catch (e) {
  if (e instanceof TorqueAssistantCreditsError) {
    console.log(e.remaining, '/', e.limit, 'messages left')
  }
}

Actions / signing

functionResults may include confirmable swap, transfer, lend, or borrow payloads. This SDK does not sign or submit transactions — implement confirmation in your client (same contract as in-app AssistantTransactionHandler).

Docs

License

MIT