Payment Plans give AI Builders the ability to control how and when users can use an AI agent or service. They are entirely controlled and managed by the AI Builder that creates them with no interference from Nevermined.Nevermined Payment Plans enable the setup of time-based or request-based gating of a Builder’s AI.
Request-Based or Credits-Based: Provides user access with request-gating. Builders can set the target price per request by configuring how many credits each API call consumes. This allows you to control costs based on computational complexity - for example, a simple query might cost 1 credit while a complex analysis could cost 5 credits. When adding services to a Payment Plan, you define the number of credits required per request. Each time a request is made, Nevermined will redeem the specified number of credits. If the user does not have enough credits, they will be prompted to purchase more and denied access until they do.
Time-Based: Provides user access with time-gating. Builders can set the time period that a user is allowed access to the AI (e.g., 1 year, 1 month, 1 week, 1 day, 1 hour, etc.). When a user makes a request, the corresponding access credit is redeemed, granting access for the designated period. Once the time period has elapsed, the user will no longer have access and will need to redeem another credit for continued access.
const USDC_ERC20_TESTING = '0x036CbD53842c5426634e7929541eC2318f3dCF7e' // This is the USDC ERC20 address in the test network (sandbox)const planMetadata = { name: 'My Credits Plan', tags: ['test']}// The price is 20 USDC (20_000_000) in the sandbox networkconst priceConfig = getERC20PriceConfig(20_000_000n, USDC_ERC20_TESTING, builderAddress)// The subscriber receives 100 credits upon purchasing the planconst creditsConfig = getFixedCreditsConfig(100n)// Register the planconst { planId } = await payments.plans.registerCreditsPlan( planMetadata, priceConfig, creditsConfig)
Copy
# This is the USDC ERC20 address in the test network (sandbox)USDC_ERC20_TESTING = "0x036CbD53842c5426634e7929541eC2318f3dCF7e"# Plan metadataplan_metadata = PlanMetadata( name="My Credits Plan", tags=["test"])# The price is 20 USDC (20_000_000) in the sandbox networkprice_config = get_erc20_price_config(20_000_000, USDC_ERC20_TESTING, builder_address)# The subscriber receives 100 credits upon purchasing the plancredits_config = get_fixed_credits_config(100)# Register the planresponse = payments_builder.plans.register_credits_plan( plan_metadata, price_config, credits_config)plan_id = response.get("planId")
// The price is 5 USDC (5_000_000) in the sandbox networkconst priceConfig = getERC20PriceConfig(5_000_000n, ERC20_ADDRESS, builderAddress)// The plan is valid for 1 dayconst oneDayPlanConfig = getExpirableDurationConfig(ONE_DAY_DURATION)// Register the planconst { planId } = await payments.plans.registerTimePlan( planMetadata, priceConfig, oneDayPlanConfig)
Copy
# The price is 5 USDC (5_000_000) in the sandbox networkprice_config = get_erc20_price_config(5_000_000, ERC20_ADDRESS, builder_address)# The plan is valid for 1 dayone_day_plan_config = get_expirable_duration_config(ONE_DAY_DURATION)# Register the planresponse = payments_builder.plans.register_time_plan( plan_metadata, price_config, one_day_plan_config)plan_id = response.get("planId")
A Trial Plan is a special type of Payment Plan that allows users to try out an AI Agent for a limited time (typically for free). A Trial Plan can only be obtained once by each user.
TypeScript
Python
Copy
const trialPlanMetadata: PlanMetadata = { name: 'Try it for one day before you buy it',}// The price is freeconst freeConfig = getFreePriceConfig()// The plan is valid for 1 dayconst oneDayPlanConfig = getExpirableDurationConfig(ONE_DAY_DURATION)// Register the trial planconst { planId } = await payments.plans.registerTimeTrialPlan( trialPlanMetadata, freeConfig, oneDayPlanConfig)
Copy
# Plan metadata for the trial plantrial_plan_metadata = PlanMetadata( name="Try it for one day before you buy it")# The price is freefree_config = get_free_price_config()# The plan is valid for 1 dayone_day_plan_config = get_expirable_duration_config(ONE_DAY_DURATION)# Register the trial planresponse = payments_builder.plans.register_time_trial_plan( trial_plan_metadata, free_config, one_day_plan_config)plan_id = response.get("planId")