Skip to main content

NVM Pay

Agents pay Exa with a credit card via Nevermined’s x402 card-delegation scheme. Each call costs $10 and either provisions a new Exa API key or tops up the key previously provisioned for the same payer.

Buy a key

POST https://admin-api.exa.ai/team-management/nevermined/purchase-key
payment-signature: <x402-token>
  • Cost: $10 per call, charged to the card delegated to the x402 token.
  • Response (new payer): { status: "provisioned", apiKey: "exa_…", expiresAt } — $10 of Exa credits added.
  • Response (returning payer): { status: "topped_up", apiKey: "exa_…" } — same key, $10 more credits.
  • Response (replayed token): cached result, no new charge.
  • Missing/invalid signature: 402 Payment Required with payment requirements in the body.

Sample request

Mint an x402 token with the Nevermined SDK and POST it to Exa. The API key, plan ID, and card enrollment all come from Nevermined — see NVM Pay docs for SDK setup and card enrollment.
import { Payments } from "@nevermined-io/payments";

const payments = Payments.getInstance({
  nvmApiKey: process.env.NVM_API_KEY!,  // your Nevermined API key
  environment: "live",                   // or "sandbox" for testing
});

// 1. Mint x402 token scoped to an enrolled card
const { accessToken } = await payments.x402.getX402AccessToken(
  "107134729016282785317688751027026876438402324055584221042936325851129895197441",
  undefined,
  {
    scheme: "nvm:card-delegation",
    delegationConfig: {
      providerPaymentMethodId: "pm_...",  // Stripe payment method, enrolled in Nevermined
      spendingLimitCents: 1000,           // >= $10 per call
      durationSecs: 3600,
    },
  },
);

// 2. Exchange the token for (or top up) an Exa API key
const res = await fetch(
  "https://admin-api.exa.ai/team-management/nevermined/purchase-key",
  { method: "POST", headers: { "payment-signature": accessToken } },
);
const { apiKey } = await res.json();

// 3. Use the key like any Exa API key
await fetch("https://api.exa.ai/search", {
  method: "POST",
  headers: { "x-api-key": apiKey, "Content-Type": "application/json" },
  body: JSON.stringify({ query: "..." }),
});

Parameters you get from Nevermined

ParameterWhere to get it
nvmApiKeyNevermined dashboard → API Keys
providerPaymentMethodIdEnroll a card via Nevermined, copy the pm_… id

When the key runs out

Exa returns HTTP 429 on the regular search endpoints once the API key’s credits are exhausted. Mint a fresh x402 token and POST it again to top up by another $10.

Use the key

Call any Exa endpoint (/search, /contents, /findSimilar, etc.) with x-api-key: exa_…. Credits are consumed at standard Exa pricing.

References