Skip to content

1vanbui/proofmeter-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@proofmeter/sdk

Signed usage receipts for AI systems. Patent Pending.

ProofMeter signs what an AI system used (tokens, API calls, compute), then lets authorized parties apply the correct cost view — public estimates, private contract rates, usage-only mode, or future invoice reconciliation.

Install

npm install @proofmeter/sdk

Quick start

import { ProofMeter } from '@proofmeter/sdk';

const meter = new ProofMeter({
  apiKey: process.env.VS_API_KEY!,
  namespaceId: process.env.VS_NAMESPACE!,
});

// Record a usage event — get a signed receipt
const receipt = await meter.spend({
  provider: 'openai',
  model: 'gpt-4o',
  inputTokens: 1200,
  outputTokens: 300,
});

console.log(receipt.receipt_id);    // rcpt_7f3a...
console.log(receipt.proven_usage);  // { provider, model, units, ... }
console.log(receipt.event_hash);    // sha256:...

// Verify a receipt
const result = await meter.verify({ receiptId: receipt.receipt_id });
console.log(result.valid);          // true

What a receipt proves

  • Resource usage was recorded in a structured event
  • The receipt payload matches its hash and signature
  • The receipt chain and sequence are intact
  • The declared price book hash matches the valuation

What a receipt does not prove by default

  • The provider's internal bill (unless invoice data is reconciled)
  • The customer's private contract rates (unless an authorized price book is applied)
  • Actual billed cost (until reconciliation is connected)

API

new ProofMeter(options)

Option Type Required Description
apiKey string Yes VerifiedState API key
namespaceId string Yes Namespace to scope receipts
baseUrl string No API base URL (default: https://api.verifiedstate.com/v1)

meter.spend(options)

Record a usage event. Returns a signed SpendReceipt.

Option Type Required Description
provider string Yes Provider ID (e.g., openai, anthropic)
model string Yes Model name
inputTokens number No Input token count
outputTokens number No Output token count
units UsageUnit[] No Custom usage units (images, compute, etc.)
endpointClass string No Endpoint type (default: chat)
taskId string No Task/run ID for grouping
capabilityId string No Budget capability to debit
metadata object No Arbitrary metadata

meter.verify(options)

Verify a receipt's signature and chain integrity. Returns a VerifyResult.

meter.receipts(filters?)

List receipts for the namespace.

Links

License

MIT

About

Signed usage receipts for AI systems. TypeScript SDK for the ProofMeter protocol. Patent Pending.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors