Private
constructorInitializes the Payments class.
The options to initialize the payments class.
Whether this instance is for browser usage.
Private
Optional
_a2aPrivate
Optional
_mcpCached MCP integration to preserve configuration (e.g., agentId, serverName) across multiple getter accesses. This ensures callers do not need to retain a reference to a previously configured instance.
Optional
extra: anyOptional
options: Omit<ResourceOptions, "kind" | "name">Simple helper to authenticate meta MCP operations (e.g., initialize, tools/resources/prompts list). Usage on server routers: await mcp.authenticateMeta(extra, method)
Optional
serverOptional
extra: anyOptional
extra: anyOptional
extra: anyOptional
extra: anyOptional
extra: anyOptional
extra: anyProtected
Optional
accountProtected
Optional
appProtected
environmentProtected
Optional
heliconeProtected
nvmProtected
returnProtected
Optional
versionStatic
a2aStatic A2A helpers and utilities. Example: Payments.a2a.buildPaymentAgentCard(...)
Builds an AgentCard with payment/pricing metadata in the capabilities.extensions field.
This function takes a base agent card and payment metadata, then creates a new agent card that includes the payment information in a standardized extension. The payment extension follows the A2A standard for extensibility and uses the URI 'urn:nevermined:payment' to identify payment-related capabilities.
The resulting agent card can be used with the PaymentsA2AServer to provide payment-enabled A2A agent functionality.
The base AgentCard (without payment info)
The payment/pricing metadata to include
The AgentCard with payment info in capabilities.extensions
const baseCard: AgentCard = {
name: 'My AI Assistant',
description: 'An AI assistant that helps with various tasks',
capabilities: {
tools: ['text-generation', 'image-analysis'],
extensions: []
}
}
const paymentMetadata: PaymentAgentCardMetadata = {
paymentType: 'fixed',
credits: 10,
agentId: 'agent-123',
planId: 'plan-456',
costDescription: '10 credits per request'
}
const paymentCard = buildPaymentAgentCard(baseCard, paymentMetadata)
// Use with PaymentsA2AServer
PaymentsA2AServer.start({
agentCard: paymentCard,
executor: new MyExecutor(),
paymentsService: payments,
port: 41242
})
Exposes A2A server and client registry methods. The client registry is initialized only if getClient is called.
Gets (or creates) a RegisteredPaymentsClient for the given alias. The registry is initialized only on first use.
ClientRegistryOptions.
Starts the A2A server with payment integration.
Server options.
Checks if a user is logged in.
True if the user is logged in.
payments.isLoggedIn
Returns the MCP integration API. The instance is memoized so that configuration
set via configure({ agentId, serverName })
persists across calls.
Optional
extra: anyOptional
options: Omit<ResourceOptions, "kind" | "name">Simple helper to authenticate meta MCP operations (e.g., initialize, tools/resources/prompts list). Usage on server routers: await mcp.authenticateMeta(extra, method)
Optional
serverOptional
extra: anyOptional
extra: anyOptional
extra: anyOptional
extra: anyOptional
extra: anyOptional
extra: anyProtected
getPrivate
initializeInitializes the AI Query Protocol API.
Protected
parseStatic
getGet an instance of the Payments class for browser usage.
The options to initialize the payments class.
An instance of Payments
This is a browser-only function.
const payments = Payments.getBrowserInstance({
returnUrl: 'https://mysite.example',
environment: 'testing',
appId: 'my-app-id',
version: '1.0.0'
})
PaymentsError if returnUrl is missing.
Static
getGet an instance of the Payments class for server-side usage.
The options to initialize the payments class.
An instance of Payments
const payments = Payments.getInstance({1
nvmApiKey: 'your-nvm-api-key',
environment: 'testing'
})
PaymentsError if nvmApiKey is missing.
Main class that interacts with the Nevermined payments API. Use
Payments.getInstance
for server-side usage orPayments.getBrowserInstance
for browser usage.Remarks
This API requires a Nevermined API Key, which can be obtained by logging in to the Nevermined App.
The library provides methods to manage AI Agents, Plans & process AI Agent Requests.
Each of these functionalities is encapsulated in its own API class:
plans
: Manages AI Plans, including registration and ordering and retrieving plan details.agents
: Handles AI Agents, including registration of AI Agents and access token generation.requests
: Manages requests received by AI Agents, including validation and tracking.observability
: Provides observability and logging utilities for AI Agents with Helicone integration