Skip to main content
Welcome to the development guide section. Here you’ll find practical, step-by-step tutorials for building different types of monetized AI services using Nevermined. These guides are designed to take you from concept to a functional, monetized application, covering common use cases and integration patterns.

Prerequisites

Before starting, ensure you have:
1

Nevermined API Key

Get your API key from the Nevermined App
2

Development Environment

  • Node.js 16+ and npm/yarn
  • Python 3.8+ (for Python examples)
  • A code editor (VS Code recommended)
3

Blockchain Wallet

  • MetaMask or compatible wallet
  • Some test tokens for the testing environment

SDK Installation

npm install @nevermined-io/payments
# or
yarn add @nevermined-io/payments

Initialize the SDK

import { Payments } from '@nevermined-io/payments'

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

Development Guides

Key Concepts for Development

Agent Registration Flow

Subscriber Access Flow

Common Development Patterns

1. Direct Integration

Best for new services where you have full control:
  • Integrate SDK directly into your application
  • Handle validation in your code
  • Maximum flexibility and control

2. Proxy Integration

Best for existing services:
  • No code changes required
  • Nevermined Proxy handles payments
  • Quick to implement

3. Hybrid Approach

Combine both patterns:
  • Use proxy for standard endpoints
  • Direct integration for custom logic
  • Balance between control and convenience

Best Practices

  • Never expose your API key in client-side code
  • Use environment variables for sensitive data
  • Implement rate limiting
  • Validate all inputs
  • Cache access tokens
  • Batch API calls when possible
  • Monitor credit usage
  • Implement graceful error handling
  • Separate payment logic from business logic
  • Use middleware for authentication
  • Implement proper logging
  • Write tests for payment flows

Choose Your Path

  • If you are new to Nevermined or want to monetize a single AI service, start with the Simple AI Agent Guide.
  • If you are building complex, autonomous systems where agents interact, head to the Multi-Agent System Guide.
Each guide provides code examples, architectural patterns, and best practices tailored to the specific use case.