Skip to content

Usage-based billing & quota enforcement for x402 #82

Description

@Miracle656

Background

x402 enables per-call payment, but operators need metering, quotas, and billing to run it as a paid service.

What to build

Meter paid requests per API key, enforce configurable quotas/rate tiers, and expose a usage/billing summary endpoint. Build on the existing x402 middleware rather than replacing it.

Key files

  • src/x402/metering.ts (new)
  • src/api/usage.ts (new)

Acceptance criteria

  • Each paid call metered against the key's quota
  • Over-quota requests handled per policy (block / 402 / overage)
  • Usage summary endpoint + tests

Drips Wave · Complexity: Advanced · 200 points


Required: Before submitting, join the contributor Telegram so your work can be tracked and counted toward the Stellar Wave: https://t.me/+fxHXq8f1SwlkZDBk

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions