Skip to main content
Before anyone can pay for your service, it has to exist on Nevermined: an agent (what you sell) linked to a plan (how it’s priced). An agent can do this for you in one call — the SDK builds the on-chain price and credits configuration, registers both, and returns the IDs you’ll reference everywhere else.

Useful for

  • Going to market: publishing a new AI agent or API and pricing access in one step.
  • Choosing a pricing model — fixed credits, time-based, pay-as-you-go, or a free trial — without learning the on-chain details.
  • Selling in fiat or crypto: priced in USD (Stripe / Braintree / Visa) or in USDC / EURC.

Try it yourself

You are my autonomous payments agent. Register a new AI agent and a payment plan on Nevermined sandbox using the @nevermined-io/payments SDK.

- Agent: "Weather Agent" — description "On-demand weather forecasts", endpoint POST https://my-agent.example.com/forecast
- Plan: "Weather Starter" — 100 credits for $10, paid by card (fiat, Stripe), 1 credit per request
- My builder wallet (receives payments): <your-builder-wallet>
- Environment: sandbox (NVM_API_KEY is set)

Use the SDK price/credits helpers to build the config, register the agent and plan together, then print the agentId and planId and confirm both are published. Follow the Nevermined `nevermined-payments` skill (https://github.com/nevermined-io/docs/tree/main/skills/nevermined-payments) for the method signatures.

How it works

1

Build the price and credits config

Pick one price helper and one credits helper — they produce the on-chain config so you don’t hand-build it:
// Price: fiat (Stripe/Braintree/Visa) — amount in 6-decimal units ($10.00)
const priceConfig = payments.plans.getFiatPriceConfig(10_000_000n, BUILDER_ADDRESS, 'USD')
// or crypto: getERC20PriceConfig(10_000_000n, USDC_ADDRESS, BUILDER_ADDRESS)

// Credits: 100 granted, 1 burned per request
const creditsConfig = payments.plans.getFixedCreditsConfig(100n, 1n)
// or getExpirableDurationConfig(...) (time-based) · getPayAsYouGoCreditsConfig() (per-call)
In TypeScript, plan config amounts are BigInt — always pass …n (e.g. 10_000_000n).
2

Register the agent and plan together

One call publishes both and links them:
const { agentId, planId } = await payments.agents.registerAgentAndPlan(
  { name: 'Weather Agent', description: 'On-demand forecasts', tags: ['weather'], dateCreated: new Date() },
  { endpoints: [{ POST: 'https://my-agent.example.com/forecast' }] },
  { name: 'Weather Starter', description: '100 requests for $10', dateCreated: new Date() },
  priceConfig,
  creditsConfig,
)
console.log({ agentId, planId })
The endpoints are optional — omit them for an open agent, or include them so the platform enforces route-level access on top of your own middleware.
3

Confirm it's published

List what you’ve published to verify the agent and plan are live:
GET {API_BASE}/protocol/agents
Authorization: Bearer <api-key>
Each item is the full record — read the name from metadata.main.name and the id from id. Then point buyers at your organization’s agentic-instructions.md, where published plans and agents appear automatically.
Prefer no code? You can register and price everything in the web app — see Register Agents.

Add payments to your agent

Gate the registered agent’s endpoints behind the plan.

Register Agents (App)

The no-code path to publishing agents and plans.

Check revenue

Track sales once buyers start arriving.

Order Plans

How buyers purchase the plan you just created.