Skip to main content
POST
/
agent
Register Agent and Plan
curl --request POST \
  --url http://sandbox.mintlify.com/agent \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "agentMetadata": {
    "name": "<string>",
    "tags": [
      "<string>"
    ],
    "dateCreated": "2023-11-07T05:31:56Z"
  },
  "agentApi": {
    "endpoints": [
      {}
    ]
  },
  "price": {},
  "credits": {}
}
'
{
  "agentId": "<string>",
  "planId": "<string>"
}
Registers a new AI agent along with a payment plan in a single transaction using the Nevermined Payments API. This is the most common entrypoint for AI Builders looking to monetize their services immediately after deploying them.

Example Usage

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

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

const agentMetadata = {
  name: 'Corporate Swiss Law assistant',
  tags: ['legal', 'assistant'],
  dateCreated: new Date('2024-12-31')
}

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

// Configure pricing - 10 USDC fixed price
const priceInUSDC = getERC20PriceConfig(10_000_000n, USDC_ERC20_ADDRESS, builderAddress)

// Configure credits - 100 credits with 5 credits per request
const fiveCreditsPerRequest = getFixedCreditsConfig(100n, 5n)

const { agentId, planId } = await payments.registerAgentAndPlan(
  agentMetadata,
  agentApi,
  priceInUSDC,
  fiveCreditsPerRequest
)

Parameters

  • agentMetadata: Metadata about the AI agent including name, tags, and creation date.
  • agentApi: Defines the query endpoints the agent exposes.
  • price: Configuration object describing cost, token type, and receiver(s).
  • credits: Defines what the subscriber gets (number of credits, expiration, etc.).

Returns

{
  agentId: string
  planId: string
}
Returns the unique identifiers of the newly created agent and the payment plan.

Notes

  • You must initialize the Payments client before calling this method.
  • The plan will immediately be associated with the registered agent.
  • All pricing and credit logic is enforced on-chain.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Agent and plan to register

agentMetadata
object
agentApi
object
price
object
credits
object

Response

Agent and plan created

agentId
string
planId
string