Skip to main content
This section introduces the Nevermined Payments API — a TypeScript-first system for registering agents, configuring payment plans, handling subscriber access, and enforcing credit-based billing. All endpoints are available via direct function calls through the Payments client.

Overview

Nevermined provides a modular, programmable API that enables AI Builders to:
  • Register autonomous agents with metadata and HTTP endpoints
  • Create flexible fiat/crypto-based payment plans
  • Manage subscriptions using tokenized credits
  • Enforce usage-based access with secure metering and redemption
  • Enable agent-to-agent or human-to-agent transactions
The API is designed for high-frequency use, real-time authorization, and deep integration into backend agent logic or proxy infrastructure.

Setup

Supported environments:
  • local
  • testing (Base Sepolia)
  • production (Base Mainnet)
  • custom (any EVM-compatible network with manual config)
Initialize the Payments API:
import { Payments } from '@nevermined-io/payments'

const payments = Payments.getInstance({
  nvmApiKey: process.env.NVM_API_KEY,
  environment: 'production'
})

Core Capabilities

Register an Agent and Plan

const agentMetadata = {
  name: 'Legal Assistant',
  tags: ['legal', 'ai'],
  dateCreated: new Date()
}

const agentApi = {
  endpoints: [{ POST: 'https://yourdomain.com/api/query' }]
}

const price = getERC20PriceConfig(10_000_000n, USDC_ADDRESS, builderAddress)
const credits = getExpirablePlanCreditsConfig(86400n * 30n)

const { agentId, planId } = await payments.registerAgentAndPlan(
  agentMetadata,
  agentApi,
  price,
  credits
)

Enforce Access and Redeem Credits

When receiving a request to your agent:
const isValid = await payments.isValidRequest(
  planId,
  agentId,
  subscriberAddress,
  request.headers['x-nvm-query-signature']
)

if (!isValid) {
  const paymentCard = await payments.getAgentPaymentCard(agentId)
  return res.status(402).send(paymentCard)
}

// Run the AI logic and redeem usage
await payments.redeemCredits(planId, 5n, proof)

API Authentication

All API operations require an nvmApiKey, which you can generate from the Nevermined App. Authentication occurs at the time of instantiating Payments.getInstance() and is required for all calls to register, validate, or query.

Start Exploring

Next Steps

Nevermined lets you build composable, agent-native payment flows — with full control over billing, pricing, and enforcement.
Let me know if you’d like help wiring this up with an OpenAPI spec for Mintlify’s API Playground, or if you want MDX subpages scaffolded for /api-reference/register-agent, /query-agent, etc.