Socket
Book a DemoInstallSign in
Socket

@x402tools/client

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

@x402tools/client

Official Stakefy JavaScript/TypeScript client for usage-based billing

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

@stakefy/client

Official JavaScript/TypeScript SDK for Stakefy - Usage-based billing infrastructure.

Installation

npm install @stakefy/client

Quick Start

const { StakefyClient } = require('@stakefy/client');

const stakefy = new StakefyClient('sk_pro_xxxxx');

// Create an envelope
const envelope = await stakefy.createEnvelope({
  name: 'API Calls - November',
  timeWindow: 'MONTHLY',
  capacity: 10000,
  currency: 'USD',
  ownerAccountId: 'org_123'
});

// Record usage
const result = await stakefy.recordUsage({
  envelopeId: envelope.id,
  amount: 5,
  identity: 'user@company.com',
  identityType: 'EMAIL'
});

console.log(`Remaining: ${result.remaining}`);

API Reference

new StakefyClient(apiKey, baseURL?)

Creates a new Stakefy client.

  • apiKey (string, required) - Your API key from the dashboard
  • baseURL (string, optional) - Custom API URL (defaults to production)

createEnvelope(data)

Create a new envelope for tracking usage.

await stakefy.createEnvelope({
  name: string,
  timeWindow: 'HOURLY' | 'DAILY' | 'WEEKLY' | 'MONTHLY',
  capacity: number,
  currency: string,
  ownerAccountId: string
});

getEnvelope(id)

Get envelope details.

const envelope = await stakefy.getEnvelope('envelope_id');

recordUsage(data)

Record usage against an envelope.

await stakefy.recordUsage({
  envelopeId: string,
  amount: number,
  identity: string,
  identityType: string,
  metadata?: object
});

TypeScript Support

Full TypeScript support included:

import { StakefyClient } from '@stakefy/client';

const stakefy = new StakefyClient('sk_pro_xxxxx');
// Fully typed!
  • Documentation
  • API Reference
  • GitHub
  • Support

License

MIT

Keywords

["stakefy","usage","billing","api","envelope","metering"]

FAQs

Package last updated on 05 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