# Send Stripemeter to your agent
Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.
## Fast path
- Download the package from Yavira.
- Extract it into a folder your agent can access.
- Paste one of the prompts below and point your agent at the extracted folder.
## Suggested prompts
### New install

```text
I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete.
```
### Upgrade existing

```text
I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run.
```
## Machine-readable fields
```json
{
  "schemaVersion": "1.0",
  "item": {
    "slug": "stripemeter",
    "name": "Stripemeter",
    "source": "tencent",
    "type": "skill",
    "category": "AI 智能",
    "sourceUrl": "https://clawhub.ai/geminimir/stripemeter",
    "canonicalUrl": "https://clawhub.ai/geminimir/stripemeter",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadUrl": "/downloads/stripemeter",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=stripemeter",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "packageFormat": "ZIP package",
    "primaryDoc": "SKILL.md",
    "includedAssets": [
      "RECONCILIATION.md",
      "SKILL.md",
      "docs/api/ingest.md",
      "docs/api/reconciliation-summary.md",
      "docs/api/usage-history.md",
      "docs/simulator-getting-started.md"
    ],
    "downloadMode": "redirect",
    "sourceHealth": {
      "source": "tencent",
      "slug": "stripemeter",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-05-03T22:48:22.285Z",
      "expiresAt": "2026-05-10T22:48:22.285Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=stripemeter",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=stripemeter",
        "contentDisposition": "attachment; filename=\"stripemeter-0.1.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null,
        "slug": "stripemeter"
      },
      "scope": "item",
      "summary": "Item download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this item.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/stripemeter"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    }
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/stripemeter",
    "downloadUrl": "https://openagent3.xyz/downloads/stripemeter",
    "agentUrl": "https://openagent3.xyz/skills/stripemeter/agent",
    "manifestUrl": "https://openagent3.xyz/skills/stripemeter/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/stripemeter/agent.md"
  }
}
```
## Documentation

### StripeMeter

StripeMeter is a Stripe-native usage metering system that ensures correct usage totals for usage-based billing. It dedupes retries, handles late events with watermarks, keeps running counters, and pushes only deltas to Stripe.

### Quick Start

git clone https://github.com/geminimir/stripemeter && cd stripemeter
cp .env.example .env && docker compose up -d && pnpm -r build
pnpm db:migrate && pnpm dev

### Events (Immutable Ledger)

Every usage event stored with deterministic idempotency key. Events are never deleted or modified.

### Counters (Materialized Aggregations)

Pre-computed aggregations (sum/max/last) by tenant, metric, customer, and period. Updated in near-real-time.

### Watermarks (Late Event Handling)

Each counter maintains a watermark timestamp. Events within lateness window (default 48h) trigger re-aggregation.

### Delta Push (Stripe Synchronization)

Tracks pushed_total per subscription item and only sends delta to Stripe.

### Ingest Events

curl -X POST http://localhost:3000/v1/events/ingest \\
  -H "Content-Type: application/json" \\
  -d '{
    "events": [{
      "tenantId": "your-tenant-id",
      "metric": "api_calls",
      "customerRef": "cus_ABC123",
      "quantity": 100,
      "ts": "2025-01-16T14:30:00Z"
    }]
  }'

### Get Cost Projection

curl -X POST http://localhost:3000/v1/usage/projection \\
  -H "Content-Type: application/json" \\
  -d '{"tenantId": "your-tenant-id", "customerRef": "cus_ABC123"}'

### Health & Metrics

Readiness: GET /health/ready
Metrics: GET /metrics
Events: GET /v1/events?tenantId=X&limit=10

### Node.js SDK

import { createClient } from '@stripemeter/sdk-node';

const client = createClient({
  apiUrl: 'http://localhost:3000',
  tenantId: 'your-tenant-id',
  customerId: 'cus_ABC123'
});

// Track usage
await client.track({
  metric: 'api_calls',
  customerRef: 'cus_ABC123',
  quantity: 100,
  meta: { endpoint: '/v1/search' }
});

// Get live usage
const usage = await client.getUsage('cus_ABC123');
const projection = await client.getProjection('cus_ABC123');

### Python SDK

from stripemeter import StripeMeterClient

client = StripeMeterClient(
    api_url="http://localhost:3000",
    tenant_id="your-tenant-id",
    customer_id="cus_ABC123"
)

client.track(
    metric="api_calls",
    customer_ref="cus_ABC123",
    quantity=100
)

### Stripe Billing Driver

For direct Stripe integration, use the stripe-driver package:

import { StripeBillingDriverImpl } from '@stripemeter/stripe-driver';

const driver = new StripeBillingDriverImpl({
  liveKey: process.env.STRIPE_SECRET_KEY,
  testKey: process.env.STRIPE_TEST_SECRET_KEY
});

// Record usage to Stripe
await driver.recordUsage({
  mode: 'live',
  stripeAccount: 'default',
  subscriptionItemId: 'si_xxx',
  quantity: 100,
  periodStart: '2025-01-01',
  idempotencyKey: 'unique-key'
});

// Get usage summary
const summary = await driver.getUsageSummary(
  'si_xxx',
  '2025-01-01',
  'default'
);

### Shadow Mode

Test Stripe usage posting without affecting live invoices:

Set STRIPE_TEST_SECRET_KEY in environment
Mark price mapping with shadow=true
Provide shadowStripeAccount, shadowPriceId
Live invoices remain unaffected

### Pricing Simulator

import { InvoiceSimulator } from '@stripemeter/pricing-lib';

const simulator = new InvoiceSimulator();

const result = simulator.simulate({
  customerId: 'test',
  periodStart: '2024-01-01',
  periodEnd: '2024-02-01',
  usageItems: [{
    metric: 'api_calls',
    quantity: 25000,
    priceConfig: {
      model: 'tiered',
      currency: 'USD',
      tiers: [
        { upTo: 10000, unitPrice: 0.01 },
        { upTo: 50000, unitPrice: 0.008 },
        { upTo: null, unitPrice: 0.005 }
      ]
    }
  }]
});

### Project Structure

stripemeter/
├── packages/
│   ├── core/           # Shared types, schemas
│   ├── database/       # Drizzle ORM + Redis
│   ├── pricing-lib/    # Pricing calculator
│   ├── stripe-driver/  # Direct Stripe API driver
│   ├── sdk-node/       # Node.js SDK
│   └── sdk-python/     # Python SDK
├── apps/
│   ├── api/            # REST API (Fastify)
│   ├── workers/        # Background workers (BullMQ)
│   ├── admin-ui/       # Admin dashboard
│   └── customer-widget/# Embeddable widget

### Environment Variables

STRIPE_SECRET_KEY=sk_live_xxx       # Live Stripe key
STRIPE_TEST_SECRET_KEY=sk_test_xxx  # Test Stripe key (for shadow mode)
DATABASE_URL=postgres://...         # PostgreSQL connection
REDIS_URL=redis://...               # Redis connection

### Verify Idempotency

# Send same event twice - counts once
TENANT_ID=$(uuidgen) bash examples/api-calls/send.sh
curl http://localhost:3000/metrics | grep ingest

### Run Reconciliation

Check drift between local totals and Stripe:

Differences beyond 0.5% epsilon trigger investigation
See RECONCILIATION.md for runbook

### Replay Late Events

curl -X POST http://localhost:3000/v1/replay \\
  -H "Content-Type: application/json" \\
  -d '{"tenantId": "X", "dryRun": true}'

### Additional Resources

API Documentation
Simulator Guide
Reconciliation Runbook
Alert Configuration
## Trust
- Source: tencent
- Verification: Indexed source record
- Publisher: geminimir
- Version: 0.1.0
## Source health
- Status: healthy
- Item download looks usable.
- Yavira can redirect you to the upstream package for this item.
- Health scope: item
- Reason: direct_download_ok
- Checked at: 2026-05-03T22:48:22.285Z
- Expires at: 2026-05-10T22:48:22.285Z
- Recommended action: Download for OpenClaw
## Links
- [Detail page](https://openagent3.xyz/skills/stripemeter)
- [Send to Agent page](https://openagent3.xyz/skills/stripemeter/agent)
- [JSON manifest](https://openagent3.xyz/skills/stripemeter/agent.json)
- [Markdown brief](https://openagent3.xyz/skills/stripemeter/agent.md)
- [Download page](https://openagent3.xyz/downloads/stripemeter)