# POST /embeddings: $0.002 per call

Text embeddings for semantic search, clustering and RAG: 1024-dimension multilingual vectors (BGE-M3, 100+ languages). POST JSON {"input": ["first text", "second text"]} (up to 32 texts of 8,000 characters) or {"text": "one text"}. One price per call, however many texts. No API key needed.

- **Price:** $0.002 in USDC, the same on Base, Solana, Polygon, Arbitrum. Failed calls are never charged.
- **Free trial:** yes, 20 free calls a day from Claude, Cursor or any MCP client ([set-up](/mcp/setup)).
- **Answers cached for:** 1 day(s)
- **Data sources:** Workers AI (metered)
- **Lane:** LLM gateway ([OpenAPI](/openapi/llm.json))
- **Live health:** [status page](/status)

## Free sample

See an answer for the demo input first, free (no payment, 10 a minute): [https://aayatai.com/sample/embeddings](/sample/embeddings). It is a stored real answer when we have one, otherwise an example marked `"kind": "illustrative"`.

```bash
curl "https://aayatai.com/sample/embeddings"
```

## 1. See the price (free)

Call it without paying: you get `402 Payment Required` and a `PAYMENT-REQUIRED` header with the exact price and where to pay.

```bash
curl -i -X POST https://aayatai.com/embeddings -H "content-type: application/json" -d '{"input":["x402 lets AI agents pay per API call.","Stablecoin micropayments over HTTP."]}'
```

## 2. Pay and call (TypeScript)

```bash
npm install @x402/fetch @x402/evm viem
```

```ts
import { wrapFetchWithPaymentFromConfig } from "@x402/fetch";
import { ExactEvmScheme } from "@x402/evm";
import { privateKeyToAccount } from "viem/accounts";

// A wallet used only by your agent, holding a little USDC on Base.
const account = privateKeyToAccount(process.env.WALLET_PRIVATE_KEY as `0x${string}`);
const pay = wrapFetchWithPaymentFromConfig(fetch, {
  schemes: [{ network: "eip155:8453", client: new ExactEvmScheme(account) }],
});

const res = await pay("https://aayatai.com/embeddings", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({"input":["x402 lets AI agents pay per API call.","Stablecoin micropayments over HTTP."]}),
});
console.log(await res.json());
```

## 3. Or as an MCP tool

```ts
// MCP server: https://aayatai.com/mcp (Streamable HTTP). With the x402 MCP client (see /start):
const result = await client.callTool("embeddings", {"input":["x402 lets AI agents pay per API call.","Stablecoin micropayments over HTTP."]});
```

## Inputs

- `input` (array): Texts to embed.
- `text` (string): A single text to embed (instead of input).

Bad inputs are rejected with HTTP 400 before any payment is asked for.

## Example answer

```json
{
  "model": "@cf/baai/bge-m3",
  "dimensions": 1024,
  "embeddings": [
    [
      0.012,
      -0.034,
      0.056
    ],
    [
      0.021,
      -0.011,
      0.047
    ]
  ]
}
```

## Related

- [POST /chat/fast](/services/chat-fast) ($0.003): Pay-per-call LLM chat (Llama 3.2 3B): Fast, cheap model for classification, extraction, short answers and routing.
- [POST /chat](/services/chat) ($0.01): Pay-per-call LLM chat (Mistral Small 3.1 24B): Balanced multilingual model (140+ languages) for writing, reasoning and long inputs.
- [POST /chat/premium](/services/chat-premium) ($0.03): Pay-per-call LLM chat (Llama 3.3 70B): Strongest model for harder reasoning, coding and careful writing; supports JSON output.
- [POST /summarise](/services/summarise) ($0.02): Summarise text or any public web page with AI.
- [POST /translate](/services/translate) ($0.01): Translate text between 100+ languages with AI.

New here? [Getting started in 60 seconds](/start). All services: [Aayat AI](/).