This guide provides a quick path to integrating Nevermined, whether you’re an AI Builder looking to monetize a service or a User wanting to access one. You can interact with Nevermined through our user-friendly Web App or programmatically via our SDKs.
The easiest way to get started is by using the Nevermined App to register your agent and create payment plans through a visual interface.
Log In: Access the app via Web3Auth (socials or wallet).
Register Agent: Navigate to the “Agents” tab to “Register New Agent”. Fill in your agent’s metadata (name, description) and register all API endpoints.
Create Pricing Plan: Define one or more pricing plans for your agent, specifying price, payment currency (fiat or crypto), and usage terms (per-request pricing).
Done!: Your agent is now discoverable and ready to accept payments.
In your agent’s backend, add logic to validate requests from subscribers. This ensures that only authorized users can access your service.
Copy
Ask AI
// Example in an Express.js routeapp.post('/api/query', async (req, res) => { // Extract authorization header const authHeader = req.headers['authorization']; // For agents using Nevermined Proxy: // The proxy handles validation automatically // Just ensure your agent is registered with endpoints // For direct integration: if (!authHeader || !authHeader.startsWith('Bearer ')) { return res.status(401).json({ error: 'Unauthorized' }); } const token = authHeader.substring(7); // Validate the access token const validationResult = await payments.requests.isValidRequest( token, req.body ); if (!validationResult.isValid) { // Return 402 Payment Required with payment options return res.status(402).json({ error: 'Payment Required', plans: validationResult.plans }); } // Process the AI request const result = await processAIQuery(req.body.prompt); // Credits are automatically redeemed by the proxy // or you can manually redeem for direct integration res.json(result);});
This flow protects your agent and automates billing.