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 🙏

© 2025 – Pkg Stats / Ryan Hefner

vcl-sdk

v0.1.0

Published

VCL TypeScript SDK - Verified Compute Ledger for AI inference

Readme

VCL TypeScript SDK

A drop-in replacement for OpenAI and Anthropic clients that generates cryptographically signed receipts for every AI inference request.

Installation

npm install vcl-sdk
# or
yarn add vcl-sdk
# or
pnpm add vcl-sdk

Quick Start

import { VCLClient } from 'vcl-sdk';

const client = new VCLClient({
  apiKey: 'vcl_your_api_key',
  baseUrl: 'https://your-vcl-server.com'
});

// OpenAI-compatible usage
const response = await client.chat.completions.create({
  model: 'gpt-4',
  messages: [{ role: 'user', content: 'Hello!' }]
});

console.log(response.choices[0].message.content);

// Get the receipt for this request
const receipt = await client.getLastReceipt();
console.log('Receipt ID:', receipt?.receipt_id);
console.log('Input tokens:', receipt?.execution.input.token_count);
console.log('Output tokens:', receipt?.execution.output.token_count);
console.log('Compute units:', receipt?.execution.compute_units);

Anthropic-Compatible Usage

import { VCLClient } from 'vcl-sdk';

const client = new VCLClient({
  apiKey: 'vcl_your_api_key',
  baseUrl: 'https://your-vcl-server.com'
});

const response = await client.messages.create({
  model: 'claude-3-sonnet-20240229',
  messages: [{ role: 'user', content: 'Hello!' }],
  max_tokens: 1024
});

console.log(response.content[0].text);

Streaming

// OpenAI streaming
for await (const chunk of client.chat.completions.create({
  model: 'gpt-4',
  messages: [{ role: 'user', content: 'Tell me a story' }],
  stream: true
})) {
  const content = chunk.choices?.[0]?.delta?.content;
  if (content) process.stdout.write(content);
}

// Anthropic streaming
for await (const chunk of client.messages.create({
  model: 'claude-3-sonnet-20240229',
  messages: [{ role: 'user', content: 'Tell me a story' }],
  max_tokens: 1024,
  stream: true
})) {
  if (chunk.type === 'content_block_delta') {
    process.stdout.write(chunk.delta.text);
  }
}

Receipt Verification

import { VCLClient, ReceiptNotFoundError } from 'vcl-sdk';

const client = new VCLClient({
  apiKey: 'vcl_...',
  baseUrl: 'https://...'
});

// Make a request
await client.chat.completions.create({
  model: 'gpt-4',
  messages: [{ role: 'user', content: 'Hello!' }]
});

// Verify the receipt
const receiptId = client.getLastReceiptId();
if (receiptId) {
  try {
    const result = await client.verifyReceipt(receiptId);
    console.log('Valid:', result.valid);
    console.log('Model:', result.model);
    console.log('Timestamp:', result.timestamp);
  } catch (e) {
    if (e instanceof ReceiptNotFoundError) {
      console.log('Receipt not found');
    }
  }
}

Receipt Details

const receipt = await client.getLastReceipt();

if (receipt) {
  // Basic info
  console.log('Receipt ID:', receipt.receipt_id);
  console.log('Timestamp:', receipt.timestamp);
  console.log('Provider:', receipt.provider.name);

  // Execution details
  console.log('Model:', receipt.execution.model_name);
  console.log('Input tokens:', receipt.execution.input.token_count);
  console.log('Output tokens:', receipt.execution.output.token_count);
  console.log('Compute units:', receipt.execution.compute_units);

  // Verification
  console.log('Receipt hash:', receipt.verification.receipt_hash);
  console.log('Signature:', receipt.verification.signature);

  // On-chain anchor (if available)
  if (receipt.verification.anchor?.tx_hash) {
    const anchor = receipt.verification.anchor;
    console.log('Chain:', anchor.chain);
    console.log('TX Hash:', anchor.tx_hash);
    console.log('Block:', anchor.block_num);
    console.log('Merkle Root:', anchor.merkle_root);
  }

  // TEE attestation (if available)
  if (receipt.tee_attestation?.type) {
    const tee = receipt.tee_attestation;
    console.log('TEE Type:', tee.type);
    console.log('MR Enclave:', tee.mr_enclave);
  }
}

API Key Management

// List your API keys
const { keys } = await client.listApiKeys();
for (const key of keys) {
  console.log(`${key.name}: ${key.key_prefix}...`);
}

// Create a new key
const newKey = await client.createApiKey('Production');
console.log('New key:', newKey.key); // Save this!

// Delete a key
await client.deleteApiKey('key-id-here');

Usage Statistics

const stats = await client.getStats();
console.log('Total receipts:', stats.total_receipts);
console.log('Total compute units:', stats.total_compute_units);

Error Handling

import {
  VCLClient,
  VCLError,
  AuthenticationError,
  RateLimitError
} from 'vcl-sdk';

const client = new VCLClient({
  apiKey: 'vcl_...',
  baseUrl: 'https://...'
});

try {
  const response = await client.chat.completions.create({
    model: 'gpt-4',
    messages: [{ role: 'user', content: 'Hello!' }]
  });
} catch (e) {
  if (e instanceof AuthenticationError) {
    console.log('Invalid API key');
  } else if (e instanceof RateLimitError) {
    console.log('Rate limit exceeded, try again later');
  } else if (e instanceof VCLError) {
    console.log(`Error: ${e.message} (status: ${e.statusCode})`);
  }
}

TypeScript Types

The SDK exports all types for TypeScript users:

import type {
  VCLClientOptions,
  Message,
  ChatCompletionRequest,
  AnthropicMessageRequest,
  Receipt,
  Anchor,
  TEEAttestation,
  Verification,
  Execution,
  VerificationResult,
  Stats,
  APIKey,
  Health
} from 'vcl-sdk';

License

MIT