Skip to main content

Payment Plans

Payment plans define how subscribers access your AI agents. The Nevermined Payments Library provides a flexible Plans API for registering different types of plans with various pricing and credit configurations.

Overview of Payment Plans API

The Plans API (payments.plans) allows AI builders to:
  • Define pricing structures (fiat, crypto, ERC20 tokens, or free)
  • Configure credit allocation (fixed, dynamic, time-based)
  • Register plans with the Nevermined protocol
  • Retrieve and manage existing plans
  • Associate plans with agents

Types of Payment Plans

Credits Plans

Grant subscribers a specific number of credits to use across multiple requests. Each agent request burns a defined number of credits. Use cases: API calls, LLM queries, data processing tasks

Time Plans

Provide unlimited access for a fixed duration. No per-request credit deduction during the validity period. Use cases: Subscriptions, unlimited access periods, trial memberships

Trial Plans

Free plans with time limitations, perfect for demos and user onboarding. Use cases: Free trials, demonstrations, testing

Pay-As-You-Go Plans

Dynamic pricing where subscribers pay per request without pre-purchasing credits. Use cases: Variable usage patterns, enterprise integrations

Price Configuration

The library provides helper functions for different payment methods:

Crypto Payment (Native Token)

ERC20 Token Payment

EURC Token Payment (Euro Stablecoin)

Fiat Payment (Stripe)

Free Plans

Pay-As-You-Go Pricing

Credits Configuration

Fixed Credits

Grants a specific number of credits with a fixed burn rate per request.

Dynamic Credits

Allows variable credit consumption per request within a range.

Time-Based Credits (Expirable)

Provides unlimited access for a fixed duration.

Non-Expirable Duration

Registering Plans

Register a Credits Plan

Register a Time Plan

Register a Trial Plan

Retrieving Plans

Get a Specific Plan

Get All Published Plans

Get Plans for an Agent

To find plans associated with an agent, use the agents API:

Duration Constants

The library provides convenient duration constants:

Complete Example: Multi-Tier Plans


Source References:
  • src/plans.ts (helper functions, duration constants)
  • src/api/plans-api.ts (Plans API methods)
  • tests/e2e/test_payments_e2e.test.ts (lines 277-369)