Skip to main content

API Reference

The plugin provides slash commands for chat channels and tools that agents can invoke on behalf of users. Slash commands are triggered directly by users with the / prefix, while tools are called by the AI agent in response to natural language requests.

Authentication Commands

Log In — /nvm_login

Authenticate with the Nevermined platform to enable all payment tools. The plugin supports three authentication flows: automatic browser login, environment selection, and direct API key input. When using browser login, the plugin starts a temporary local server, opens your default browser to the Nevermined login page, and captures the API key automatically after you sign in. On headless servers where no browser is available, paste your API key directly.
ParameterTypeRequiredDefaultDescription
environmentstringNosandboxsandbox or live
Example prompt: “Log me in to Nevermined”
/nvm_login
/nvm_login live
/nvm_login sandbox:eyJhbG...

Log Out — /nvm_logout

End your Nevermined session and remove the stored API key from memory. After logging out, all payment tools will be unavailable until you authenticate again. Use this when switching accounts or when you want to revoke the current session for security.

Subscriber Tools

These tools are designed for users who consume paid AI agent services. They handle the full lifecycle of subscribing to a plan, paying for access, and querying agents.

Check Credit Balance — nevermined_checkBalance

Retrieve the current credit balance for a payment plan. This is useful to verify how many credits remain before making requests, or to confirm that a recent purchase was credited to your account. The response includes the plan name, remaining balance, and whether you are an active subscriber. If a planId is configured in the plugin settings, it is used by default. You can override it per call.
ParameterTypeRequiredDefaultDescription
planIdstringNoConfig planIdThe payment plan ID to check
Example prompt:
How many credits do I have left on my Weather Forecast plan?
Returns:
{
  "planId": "did:nv:abc123...",
  "planName": "Basic Plan",
  "balance": "95",
  "isSubscriber": true
}

Get Access Token — nevermined_getAccessToken

Generate an x402 access token that authorizes requests to a paid Nevermined agent. The token is cryptographically signed and contains delegated permissions (order, burn) that allow the agent to verify and settle payments on your behalf. This tool supports two payment schemes. Crypto (the default) uses the nvm:erc4337 on-chain scheme with session keys and smart accounts. Fiat uses the nvm:card-delegation scheme, which charges a previously enrolled credit card via Stripe delegation. When using fiat, the plugin automatically looks up your enrolled payment methods and selects the first one unless you specify a paymentMethodId. Most users will not need to call this tool directly — nevermined_queryAgent handles token acquisition automatically. Use this tool when you need the raw token for custom integrations or debugging.
ParameterTypeRequiredDefaultDescription
planIdstringNoConfig planIdThe payment plan ID
agentIdstringNoConfig agentIdThe agent ID
paymentTypestringNoConfig paymentType or "crypto""crypto" (nvm:erc4337 scheme) or "fiat" (nvm:card-delegation scheme)
paymentMethodIdstringNoAuto-selects first enrolled cardStripe payment method ID (pm_...). Only used for fiat.
spendingLimitCentsnumberNoConfig defaultSpendingLimitCents or 1000Max spend in cents. Only used for fiat.
delegationDurationSecsnumberNoConfig defaultDelegationDurationSecs or 3600Delegation duration in seconds. Only used for fiat.
Example prompt:
Get me an access token for the Weather Oracle agent so I can call it from my script.
Example prompt: “Get me an access token for the translation agent”
Returns:
{
  "accessToken": "eyJhbG..."
}

Purchase a Crypto Plan — nevermined_orderPlan

Purchase a payment plan using cryptocurrency. This initiates an on-chain transaction that transfers the plan’s price to the builder’s wallet and credits your account with the plan’s allotted credits. The transaction is processed through the Nevermined Protocol smart contracts. Use this for plans priced in native tokens (ETH, MATIC) or ERC-20 tokens (USDC). For plans priced in fiat currency, use nevermined_orderFiatPlan instead.
ParameterTypeRequiredDefaultDescription
planIdstringNoConfig planIdThe plan ID to purchase
Example prompt:
Buy the Weather Forecast plan so I can start querying the agent.
Returns: Order confirmation with transaction hash.

Purchase a Fiat Plan — nevermined_orderFiatPlan

Purchase a payment plan using fiat currency (USD). Instead of executing an on-chain transaction, this tool returns a Stripe checkout URL where you complete the payment in a browser. Once the payment is confirmed, credits are added to your account. Use this for plans that have been created with pricingType: fiat. For crypto-priced plans, use nevermined_orderPlan instead.
ParameterTypeRequiredDefaultDescription
planIdstringNoConfig planIdThe plan ID to purchase
Example prompt:
I want to subscribe to the Premium Agent plan using my credit card.
Returns:
{
  "result": {
    "checkoutUrl": "https://checkout.stripe.com/..."
  }
}

List Payment Methods — nevermined_listPaymentMethods

Retrieve the list of credit cards you have enrolled for fiat payments. Cards are enrolled through the Nevermined App under Settings > Payment Methods. Each entry includes the card brand, last four digits, and expiration date. This is useful to verify which cards are available before making a fiat payment, or to find the paymentMethodId for a specific card when you have multiple cards enrolled. No parameters required. Example prompt:
Which credit cards do I have on file for Nevermined payments?
Returns:
[
  {
    "id": "pm_...",
    "brand": "visa",
    "last4": "4242",
    "expMonth": 12,
    "expYear": 2027
  }
]

Query a Paid Agent — nevermined_queryAgent

Send a prompt to a paid Nevermined AI agent and get the response. This is the main tool for interacting with agents — it handles the full payment lifecycle in a single call:
  1. Acquires an x402 access token (crypto or fiat, depending on paymentType)
  2. Sends the prompt to the agent’s URL with the PAYMENT-SIGNATURE header
  3. Returns the agent’s response
If the agent returns a 402 (Payment Required) response, the tool returns an error suggesting you purchase credits first. This typically means your plan has run out of credits or you haven’t subscribed yet. Like nevermined_getAccessToken, this tool supports both crypto and fiat payment types. When using fiat, it automatically resolves your enrolled card and builds the delegation config.
ParameterTypeRequiredDefaultDescription
agentUrlstringYesThe URL of the agent to query
promptstringYesThe prompt to send to the agent
planIdstringNoConfig planIdThe payment plan ID
agentIdstringNoConfig agentIdThe agent ID
methodstringNoPOSTHTTP method
paymentTypestringNoConfig paymentType or "crypto""crypto" (nvm:erc4337 scheme) or "fiat" (nvm:card-delegation scheme)
paymentMethodIdstringNoAuto-selects first enrolled cardStripe payment method ID (pm_...). Only used for fiat.
spendingLimitCentsnumberNoConfig defaultSpendingLimitCents or 1000Max spend in cents. Only used for fiat.
delegationDurationSecsnumberNoConfig defaultDelegationDurationSecs or 3600Delegation duration in seconds. Only used for fiat.
Example prompts:
Ask the Weather Oracle at https://weather.example.com/agent what the forecast is for Barcelona.
Query the translation agent at https://translate.example.com/tasks to translate “hello world” into French, and pay with my credit card.

Builder Tools

These tools are designed for agent builders who want to register their AI agents on the Nevermined marketplace and create payment plans that subscribers can purchase.

Register an Agent — nevermined_registerAgent

Register a new AI agent on Nevermined and create an associated payment plan in a single operation. This publishes your agent to the Nevermined marketplace, making it discoverable and purchasable by subscribers. The tool creates both the agent record (with its endpoint URL) and a payment plan (with pricing and credit allocation). The pricingType parameter controls how the plan is priced: "crypto" for native blockchain tokens, "erc20" for stablecoins like USDC, or "fiat" for USD pricing via Stripe. After registration, the returned agentId and planId should be saved in your plugin config for the paid endpoint to work.
ParameterTypeRequiredDescription
namestringYesAgent name
descriptionstringNoAgent description
agentUrlstringYesThe endpoint URL for the agent
planNamestringYesName for the payment plan
priceAmountsstringYesComma-separated price amounts in wei (crypto) or cents (fiat)
priceReceiversstringYesComma-separated receiver addresses
creditsAmountnumberYesNumber of credits in the plan
tokenAddressstringNoERC20 token address (e.g. USDC). Omit for native token.
pricingTypestringNo"crypto" (default), "erc20", or "fiat"
Example prompt:
Register a new agent called “Code Review Bot” at https://my-server.com/nevermined/agent with a plan named “Code Review” priced at 1000000 (1 USDC) to address 0xABC… with token 0x036CbD… granting 10 credits.
Example prompt: “Register my translation agent hosted at https://agent.example.com with a plan named ‘Translation Plan’ that costs 1000000 wei (1 USDC) sent to address 0x123… for 100 credits”
Returns:
{
  "agentId": "did:nv:...",
  "planId": "did:nv:...",
  "txHash": "0x..."
}

Create a Payment Plan — nevermined_createPlan

Create a standalone payment plan without associating it with an agent. This is useful when you want to manage plans separately from agents, or when a single plan should grant access to multiple agents. The plan can be priced in three ways: "fiat" sets the price in USD cents (e.g. "100" = $1.00) and subscribers pay via Stripe, "erc20" sets the price in an ERC-20 token’s smallest unit (e.g. "1000000" = 1 USDC) and requires a tokenAddress, and "crypto" (the default) sets the price in the blockchain’s native token.
ParameterTypeRequiredDescription
namestringYesPlan name
descriptionstringNoPlan description
priceAmountstringYesPrice in cents for fiat (e.g. “100” = $1.00), in token smallest unit for crypto
receiverstringYesReceiver wallet address (0x…)
creditsAmountnumberYesNumber of credits in the plan
pricingTypestringNo"fiat" for Stripe/USD, "erc20" for ERC20 tokens, "crypto" for native token (default)
accessLimitstringNo"credits" (default) or "time"
tokenAddressstringNoERC20 token contract address. Required when pricingType is “erc20”.
Example prompt:
Create a fiat payment plan called “Pro Tier” at $5.00 (500 cents) to wallet 0xABC… with 50 credits.
Returns:
{
  "planId": "did:nv:..."
}

List My Plans — nevermined_listPlans

Retrieve all payment plans owned by the authenticated builder. This returns the full list of plans you have created, including their IDs, names, and configuration. Useful for finding a planId to use with other tools or to review your current offerings. No parameters required. Example prompt:
Show me all the payment plans I’ve created on Nevermined.
Returns: Array of plan objects.