Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions integrations/exa.mdx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
title: "Exa"
description: "Buy Exa API credits with card delegation: a $7 x402 purchase provisions or tops up an Exa API key, fully agent-driven."

Check warning on line 3 in integrations/exa.mdx

View check run for this annotation

Mintlify / Mintlify Validation (neverminedag) - vale-spellcheck

integrations/exa.mdx#L3

Did you really mean 'Exa'?
icon: "magnifying-glass"
---

[Exa](https://exa.ai) accepts autonomous payments through Nevermined's [x402 card-delegation](/specs/x402-card-delegation) scheme. An agent holding a Nevermined API key mints an x402 access token against the Exa plan and exchanges it at Exa's purchase endpoint for a working Exa API key. Repeat purchases top up the same key.

Check warning on line 7 in integrations/exa.mdx

View check run for this annotation

Mintlify / Mintlify Validation (neverminedag) - vale-spellcheck

integrations/exa.mdx#L7

Did you really mean 'Exa'?

Check warning on line 7 in integrations/exa.mdx

View check run for this annotation

Mintlify / Mintlify Validation (neverminedag) - vale-spellcheck

integrations/exa.mdx#L7

Did you really mean 'Nevermined's'?

Check warning on line 7 in integrations/exa.mdx

View check run for this annotation

Mintlify / Mintlify Validation (neverminedag) - vale-spellcheck

integrations/exa.mdx#L7

Did you really mean 'Nevermined'?

Check warning on line 7 in integrations/exa.mdx

View check run for this annotation

Mintlify / Mintlify Validation (neverminedag) - vale-spellcheck

integrations/exa.mdx#L7

Did you really mean 'Exa'?

Check warning on line 7 in integrations/exa.mdx

View check run for this annotation

Mintlify / Mintlify Validation (neverminedag) - vale-spellcheck

integrations/exa.mdx#L7

Did you really mean 'Exa's'?

<Info>
Exa's Nevermined plan ID:<br />`27800462147494506865542649899724877617306579171265399959488097895839186996870`<br />The purchase is for API credits, not for a single search request. \$7 covers roughly 1,000 standard searches; see [Exa pricing](https://exa.ai/pricing) for current rates.
Exa's Nevermined plan ID:<br />`27800462147494506865542649899724877617306579171265399959488097895839186996870`<br />This plan and purchase run on **live**; use a live-prefixed Nevermined API key. The purchase is for API credits, not for a single search request. \$7 covers roughly 1,000 standard searches; see [Exa pricing](https://exa.ai/pricing) for current rates.

Check warning on line 10 in integrations/exa.mdx

View check run for this annotation

Mintlify / Mintlify Validation (neverminedag) - vale-spellcheck

integrations/exa.mdx#L10

Did you really mean 'Exa's'?

Check warning on line 10 in integrations/exa.mdx

View check run for this annotation

Mintlify / Mintlify Validation (neverminedag) - vale-spellcheck

integrations/exa.mdx#L10

Did you really mean 'Nevermined'?

Check warning on line 10 in integrations/exa.mdx

View check run for this annotation

Mintlify / Mintlify Validation (neverminedag) - vale-spellcheck

integrations/exa.mdx#L10

Did you really mean 'Nevermined'?

Check warning on line 10 in integrations/exa.mdx

View check run for this annotation

Mintlify / Mintlify Validation (neverminedag) - vale-spellcheck

integrations/exa.mdx#L10

Did you really mean 'Exa'?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LOW — Use the exact live: token for consistency. L75 refers to a `sandbox:`-prefixed key (the exact prefix token), but here it's the looser "live-prefixed". A reader matching prefixes across the page sees two different forms. Change live-prefixed to `live:`-prefixed so both places use the exact token.

</Info>

## Prerequisites (one time, done by the card owner)
Expand All @@ -22,12 +22,12 @@

## The flow

Handled with the Nevermined Payments SDK (`npm install @nevermined-io/payments`; the package is ESM-only; in a fresh npm project set `"type": "module"` in `package.json`, or the import fails with `ERR_PACKAGE_PATH_NOT_EXPORTED`). The package's bundled TypeScript definitions are the authoritative call reference for every method named below. For broader context, start from the [Payments overview](/products/payments/overview) and the [documentation index](https://nevermined.ai/docs/llms.txt).

Check warning on line 25 in integrations/exa.mdx

View check run for this annotation

Mintlify / Mintlify Validation (neverminedag) - vale-spellcheck

integrations/exa.mdx#L25

Did you really mean 'Nevermined'?

1. **Initialize** the SDK with your Nevermined API key only (`Payments.getInstance({ nvmApiKey })`). The environment is derived from the key prefix; do not pass an `environment` option.

Check warning on line 27 in integrations/exa.mdx

View check run for this annotation

Mintlify / Mintlify Validation (neverminedag) - vale-spellcheck

integrations/exa.mdx#L27

Did you really mean 'Nevermined'?
2. **Find the delegation to pay with**; see [Getting a delegation](#getting-a-delegation) below.
3. **Mint the x402 access token** for the Exa plan ID via `payments.x402.getX402AccessToken`, using the `nvm:card-delegation` scheme and referencing the delegation by ID (`delegationConfig: { delegationId }`). No agentId is needed for this flow: the method's arguments are `(planId, agentId?, tokenOptions?)`, so pass the plan ID, `undefined`, and the token options. Tokens cannot create delegations on the fly; the delegation must exist first.

Check warning on line 29 in integrations/exa.mdx

View check run for this annotation

Mintlify / Mintlify Validation (neverminedag) - vale-spellcheck

integrations/exa.mdx#L29

Did you really mean 'Exa'?

Check warning on line 29 in integrations/exa.mdx

View check run for this annotation

Mintlify / Mintlify Validation (neverminedag) - vale-spellcheck

integrations/exa.mdx#L29

Did you really mean 'agentId'?
4. **POST the token to Exa** in the `payment-signature` header (endpoint below). The response contains the Exa API key. Check the HTTP status before reading the body.

Check warning on line 30 in integrations/exa.mdx

View check run for this annotation

Mintlify / Mintlify Validation (neverminedag) - vale-spellcheck

integrations/exa.mdx#L30

Did you really mean 'Exa'?

Check warning on line 30 in integrations/exa.mdx

View check run for this annotation

Mintlify / Mintlify Validation (neverminedag) - vale-spellcheck

integrations/exa.mdx#L30

Did you really mean 'Exa'?
5. **Use the key** against the standard [Exa Search API](https://docs.exa.ai).

## Getting a delegation
Expand All @@ -46,7 +46,7 @@

The response includes the `delegationId` to mint with (it also includes a `delegationToken`; not needed for this flow; treat it as a secret and do not log it). **Card selection:** `listPaymentMethods()` carries no ordering guarantee and cards may be indistinguishable by metadata; if several are enrolled and the owner's intent is unknown, prefer asking the owner; otherwise any Active card of the provider is acceptable, and you should record which payment-method id was chosen. Note the trade-off of this whole path: the agent chooses the card and sets its own budget. Prefer an owner-created delegation whenever an owner is available.

## Exa's purchase contract

Check warning on line 49 in integrations/exa.mdx

View check run for this annotation

Mintlify / Mintlify Validation (neverminedag) - vale-spellcheck

integrations/exa.mdx#L49

Did you really mean 'Exa's'?

```bash
POST https://admin-api.exa.ai/team-management/nevermined/purchase-key
Expand All @@ -54,12 +54,12 @@
```

* **Cost:** \$7 per purchase, charged to the card behind the delegation referenced by the token.
* **New payer:** `{ status: "ok", apiKey: "…", expiresAt: null }`; a new Exa API key with \$7 of credits.

Check warning on line 57 in integrations/exa.mdx

View check run for this annotation

Mintlify / Mintlify Validation (neverminedag) - vale-spellcheck

integrations/exa.mdx#L57

Did you really mean 'Exa'?
* **Returning payer:** the same API key with \$7 more credits added.
* **Replayed token:** cached result, no new charge.
* **Missing/invalid signature:** `402 Payment Required` with payment requirements in the body.

**When the key runs out:** Exa's regular API endpoints return `HTTP 402` with error tag `NO_MORE_CREDITS`. Mint a fresh x402 token with the same plan ID and delegation, POST it to the same endpoint, and Exa adds another \$7 of credits to the same key.

Check warning on line 62 in integrations/exa.mdx

View check run for this annotation

Mintlify / Mintlify Validation (neverminedag) - vale-spellcheck

integrations/exa.mdx#L62

Did you really mean 'Exa's'?

Check warning on line 62 in integrations/exa.mdx

View check run for this annotation

Mintlify / Mintlify Validation (neverminedag) - vale-spellcheck

integrations/exa.mdx#L62

Did you really mean 'Exa'?

## Verifying charges

Expand All @@ -71,9 +71,10 @@
|---|---|
| Token mint fails: `Required token-generation input is missing or incomplete (HTTP 402)` | The mint referenced no existing delegation (e.g., legacy create-on-the-fly `delegationConfig` with card details). Create or discover a delegation first and pass `delegationConfig: { delegationId }`. |
| `ERR_PACKAGE_PATH_NOT_EXPORTED` on import | The SDK is ESM-only. Set `"type": "module"` in `package.json` or use `.mts`. |
| Console warning: `The 'environment' option is deprecated…` even though you never passed it | Known SDK issue; harmless. The environment is derived from your key prefix. |
| Console warning: `The 'environment' option is deprecated…` | Something is still passing the deprecated `environment` option (a wrapper or copied example). Remove it; the environment is derived from your key prefix. On SDK 1.10.0 the warning can also self-fire with nothing passed ([payments#416](https://github.com/nevermined-io/payments/issues/416)); if you have removed the option and still see it, that issue is why. |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LOW — Ordering vs. the pinned SDK version (non-blocking). The page pins SDK 1.10.0 (L25), and per payments#416 the warning self-fires on 1.10.0 regardless of what the caller passes — so for anyone following this doc verbatim, the self-fire is the default case, not the "something is still passing it" case this row leads with. The row does recover at the end ("if you have removed the option and still see it, that issue is why"), so it's correct as written; but a reader on the documented version will first go hunting for a wrapper/copied example that isn't there. Consider leading with the 1.10.0 behaviour, e.g.:

On SDK 1.10.0 this fires on instantiation even with nothing passed (payments#416) — expected, ignore it. On other versions it means something is still passing the deprecated environment option (a wrapper or copied example); remove it, the environment is derived from your key prefix.

Purely a most-common-path reordering — flagging, not gating.

| The plan ID above does not resolve, or token mint fails against it | Check your key prefix: this is a live plan, and a `sandbox:`-prefixed key targets a different environment where the plan does not exist. |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LOW — Row names the cause but not the fix. This entry explains why a sandbox: key fails but leaves the remedy implicit (it's only stated far up in the Info block at L10). A troubleshooting row reads best when it carries its own fix. Copilot flagged the same (suppressed comment). Suggestion:

Suggested change
| The plan ID above does not resolve, or token mint fails against it | Check your key prefix: this is a live plan, and a `sandbox:`-prefixed key targets a different environment where the plan does not exist. |
| The plan ID above does not resolve, or token mint fails against it | Check your key prefix: this is a live plan, so use a `live:`-prefixed key. A `sandbox:`-prefixed key targets a different environment where the plan does not exist. |

| A delegation you spent from disappears from `getPurchasingPower()` | It is exhausted. Inspect it with `listDelegations()`; create or top up a delegation to continue. |
| Exa search returns `402` with `NO_MORE_CREDITS` | The Exa key's credits are spent. Repeat the purchase flow to top up the same key. |

Check warning on line 77 in integrations/exa.mdx

View check run for this annotation

Mintlify / Mintlify Validation (neverminedag) - vale-spellcheck

integrations/exa.mdx#L77

Did you really mean 'Exa'?

Check warning on line 77 in integrations/exa.mdx

View check run for this annotation

Mintlify / Mintlify Validation (neverminedag) - vale-spellcheck

integrations/exa.mdx#L77

Did you really mean 'Exa'?

## References

Expand Down