Text embeddings (Large)
POST /api/embed-largeGenerate a text embedding vector using OpenAI text-embedding-3-large (3072 dimensions). Send POST /api/embed-large with the required field text and pay $0.010 per call over x402 or MPP (there is no free tier). It returns a JSON object with model, provider, embedding, dimensions and usage.
Higher accuracy than the small model. Ideal for semantic search, RAG, and clustering. No API key needed; pay per call via x402. Text capped at 32k chars.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
text | string | yes | Text to embed (max 32,000 chars) Also accepted as content, str, string, input, body, data. |
Example request
curl -i -X POST https://agent402.tools/api/embed-large \
-H "Content-Type: application/json" \
-d '{"text":"Agent402 is an open-source x402 tool server."}'
Without payment this returns HTTP 402 Payment Required with the exact price for embed-large; any x402 v2 or MPP client pays it and retries.
Example response
{
"model": "text-embedding-3-large",
"provider": "openai",
"embedding": [
0.0023,
-0.0091,
0.0152
],
"dimensions": 3072,
"usage": {
"total_tokens": 12
}
}
| Field | Type | Always present | In the example |
|---|---|---|---|
model | string | yes | text-embedding-3-large |
provider | string | yes | openai |
embedding | array of number | yes | 3 items in the example |
dimensions | number | yes | 3072 |
usage | object | yes | 1 field: total_tokens |
From an MCP client
catalog.call {
"slug": "embed-large",
"params": {
"text": "Agent402 is an open-source x402 tool server."
}
}
The hosted connector at https://agent402.tools/mcp needs a payment for embed-large; the stdio package pays it from a wallet or from AGENT402_CREDITS_KEY. Local install: npx -y agent402-mcp.
Errors and behavior
textis required. An input the tool rejects returns an HTTP 4xx whose body carrieserror,tool,expected,requiredandexample, so the caller can correct it.- A paid call that ends in any status of 400 or above is not charged over x402, MPP or a prepaid credits key: settlement is cancelled when the tool fails. The exception is a Tempo push credential, a transfer the buyer sent before the call: it settles before the tool runs, so if the tool then fails the payment is recorded as a refund owed to the paying wallet.
- Wallet-only: this tool runs a model, so it has no proof-of-work tier. A prepaid card-credits key issued earlier (
Authorization: Bearer a402_...) also pays it. - Model-backed: the answer is generated by a model, so the same input can produce different wording.
- A
GETorHEADto /api/embed-large returns the same 402 quote, so the price can be read without a body. - An
Idempotency-Keyheader makes a retried paid call replay the first 200 instead of charging again (an answer larger than 1 MB is not replayed).
Paid call (JavaScript agent)
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
const client = new x402Client();
client.setSpendControls?.(false); // keep your own spending ceiling in code
registerExactEvmScheme(client, { signer: privateKeyToAccount(KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);
const res = await payFetch("https://agent402.tools/api/embed-large", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"text": "Agent402 is an open-source x402 tool server."
}),
});
Related tools
Text embeddings
POST /api/embedGenerate a text embedding vector using OpenAI text-embedding-3-small (1536 dimensions). Ideal for semantic search, RAG, …
Embeddings (OpenAI-compatible)
POST /v1/embeddingsOpenAI-compatible text embeddings over x402 - point any OpenAI SDK at base_url https://agent402.tools/v1 and pay $0.002 …
Decisions (OpenAI wire)
POST /v1/decisionsOpenAI's Decisions API on its own wire: point an OpenAI SDK's base URL here and client.decisions.create works unchanged,…
Image generation
POST /api/image-genGenerate an image from a text prompt using GPT Image 2 (low quality, 1024x1024). No API key needed; pay per call via x40…
Image generation (HD)
POST /api/image-gen-hdGenerate a higher-quality image from a text prompt using GPT Image 2 (medium quality, 1024x1024). No API key needed; pay…
Image generation (Premium)
POST /api/image-gen-premiumGenerate a larger image from a text prompt using GPT Image 2 (medium quality): 1536x1024 landscape by default, 1024x1536…