This is the end-to-end path for an autonomous AI agent — Claude Code, an OpenAI agent, or your own — to discover a Nevermined-monetized service and pay for it on its own. A human is needed only twice, and only the first time: to create an API key, and (for card payments) to enroll a card. Everything after that is programmatic and reusable.Documentation Index
Fetch the complete documentation index at: https://docs.nevermined.app/llms.txt
Use this file to discover all available pages before exploring further.
What you’ll do
1. Discover
Read an organization’s agent-discoverable instructions to learn its plans, agents, and which environment you’re in.
2. Log in
Get a Nevermined API Key (one-time, human), then store and reuse it.
3. Get a payment method
Use the stablecoin method created for you, or enroll a card via the embedded flow.
4. Delegate & buy
Authorize a spending budget, then buy plan credits with x402.
Sandbox vs. Live
Nevermined runs two environments. Develop against Sandbox, then switch to Live.| Environment | Money | API base URL | Web app |
|---|---|---|---|
| Sandbox | Test only — no real charges | https://api.sandbox.nevermined.app/api/v1 | nevermined.app |
| Live | Real charges | https://api.live.nevermined.app/api/v1 | nevermined.app |
sandbox:, Live keys with live:. Use the key that matches the environment you’re calling.
The flow
Discover what an organization sells
Every organization exposes two agent-discoverable files. Start here — they tell you the plans, the agents, and which environment you’re in:
GET {API_BASE}/organizations/{orgId}/agentic-instructions.md— human/agent-readable instructions, including an Environment block (the exact API base URL to use) and a How to purchase section.GET {API_BASE}/organizations/{orgId}/llms.txt— a compact index of plans, agents, and reference links.
{API_BASE}/rest/docs-json (human-browsable UI at {API_BASE}/rest/docs).Get a Nevermined API Key (one-time, needs a human)
You can’t mint the first key yourself — a human creates it in the web app. Ask them to follow Get Your API Key: sign in at nevermined.app, open Settings → Global NVM API Keys, create a key for the right environment, and hand it back to you.Store it and reuse it — you don’t need a new key per request. Keep it in an environment variable and initialize the SDK once:
- TypeScript
- Python
Send the key as
Authorization: Bearer <api-key> if you’re calling the REST API directly instead of the SDK.Pick how you'll pay
List the payment methods available to your account:
- Stablecoin (no human needed): your account’s smart-account wallet — an ERC-4337 wallet provisioned for you — appears here as a
Crypto Walletpayment method. Fund it and you can pay right away, no enrollment required: skip to the last step. - Card (one-time human enrollment): enroll a credit or debit card through a supported provider — Stripe, Braintree, or Visa Intelligent Commerce. Which providers apply depends on the plan, and enrolling is a one-time human step via the embedded flow in the next step.
Enroll a card and delegate a budget (embedded flow, no CLI)
To pay by card, a human enrolls one once and grants you a delegation — a spending budget with a hard limit and expiry. Drive it with the embedded redirect handshake (no CLI, any language):If you can’t host a localhost callback, ask the human to enroll a card and create a delegation directly at nevermined.app (Payment Methods → Enroll card → Delegate), then continue.
-
Mint a session with your API key:
The response carries a
sessionToken. The self-mint flow only accepts a localhostreturnUrl, so run a tiny one-shot callback server on127.0.0.1first. -
Hand the human a URL to complete card setup in their browser:
-
Receive the result. When they finish, the browser redirects to your
returnUrlwithpaymentMethodIdanddelegationId. Verify thestateecho, then store thedelegationId.
Full handshake (callback server,
state/CSRF, returnUrl rules) and the alternatives — embedding the widget in your own page, or enrolling directly in the app — are in Card Delegation and Card Enrollment.Pay with x402
Mint an x402 access token for the plan, then send it in the The agent’s x402 middleware verifies and settles each request, burning credits as you go. Check your remaining balance anytime:
payment-signature header. Each plan uses one of two schemes, and you tell the SDK which budget to charge through delegationConfig:nvm:card-delegation(your delegated card) — passscheme: 'nvm:card-delegation'and thedelegationIdyou stored during enrollment. Braintree and Visa cards also need a matchingnetwork('braintree'/'visa'); Stripe is the default.nvm:erc4337(stablecoins) — the default scheme, so you can omitscheme. Create a delegation inline from aspendingLimitCents+durationSecsbudget, or reuse one bydelegationId.
verify → settle flow.- TypeScript
- Python
- TypeScript
- Python
Prefer to gate your own API, build the
payment-required challenge, or call verifyPermissions / settlePermissions directly? See Nevermined x402 and Validate Requests. For stablecoin plans you can also buy credits upfront with orderPlan.Reuse and good practices
- Reuse the API key. It doesn’t expire per request — store it once and reuse it.
- Reuse the delegation. A delegation is good until its budget is spent or it expires. Don’t re-enroll a card for every purchase.
- Top up, don’t re-buy. Check
getPlanBalanceand order more credits when you run low. - Match the environment. A
sandbox:key only works against the Sandbox API base URL, andlive:only against Live.
Related
Card Delegation
The full embedded card-enrollment + delegation handshake, in any language.
Nevermined x402
The x402 payment protocol: schemes, headers, verify/settle.
Get Your API Key
Create and manage Nevermined API keys.
Agent-to-Agent Monetization
Let your own agent get paid by other agents.