Text embeddings API

From $0.01 per successful call · failed calls are never charged · no account needed · Markdown version: /guides/text-embeddings-api.md

A 1,024-dimension embedding vector for up to 4,000 characters of text in 100+ languages, from BAAI's BGE-M3. Use for semantic search, RAG retrieval, clustering and deduplication.

When an agent wants this

OpenAI compatible embeddings: BGE-M3, 1,024 dimensions $0.01

A 1,024-dimension embedding vector for up to 4,000 characters of text in 100+ languages, from BAAI's BGE-M3. Use for semantic search, RAG retrieval, clustering and deduplication.

Inputs: text (required): Text to embed, up to 4,000 characters.

Free first (25 successful calls per caller, no key):

curl "https://tools.funwords.eu/ai/embed?text=pay-per-call%20APIs%20for%20AI%20agents&trial=1"

With a card key from /credits, in a header or, when your client can only fetch a URL, in the URL:

curl -H "Authorization: Bearer adt_…" "https://tools.funwords.eu/ai/embed?text=pay-per-call%20APIs%20for%20AI%20agents"
curl "https://tools.funwords.eu/ai/embed?text=pay-per-call%20APIs%20for%20AI%20agents&api_key=adt_…"

Without a key the same URL answers 402 Payment Required with x402 and MPP terms, so a wallet client pays USDC per call and retries. Over MCP (https://tools.funwords.eu/mcp) this tool is ai_embed.

Example result
{
  "dimensions": 1024,
  "embedding": [
    0.0123,
    -0.0456,
    0.0789
  ],
  "model": "@cf/baai/bge-m3"
}

Tool page, inputs and limits

Rerank documents by relevance: reranker for RAG $0.002

Order up to 50 documents by how well each answers a query, with a relevance score from 0 to 1 (BAAI bge-reranker-base, a cross-encoder). Send documents as a JSON array or one per line; each is read up to 2,000 characters, 40,000 in all. Returns the original index, score and text, best first; top_n keeps only the best. Also available in the Cohere-style shape at /v1/rerank. Use to pick what a model reads after search or vector retrieval.

Inputs: query (required): What the documents should answer (up to 2,000 characters); documents (required): Up to 50 documents: a JSON array of strings, or one per line; top_n: Keep only the best N results (default all).

Free first (25 successful calls per caller, no key):

curl "https://tools.funwords.eu/ai/rerank?query=What%20is%20the%20capital%20of%20France%3F&documents=%5B%22France%20has%20hundreds%20of%20cheeses.%22%2C%22Berlin%20is%20the%20capital%20of%20Germany.%22%2C%22Paris%20is%20the%20capital%20and%20largest%20city%20of%20France.%22%5D&trial=1"

With a card key from /credits, in a header or, when your client can only fetch a URL, in the URL:

curl -H "Authorization: Bearer adt_…" "https://tools.funwords.eu/ai/rerank?query=What%20is%20the%20capital%20of%20France%3F&documents=%5B%22France%20has%20hundreds%20of%20cheeses.%22%2C%22Berlin%20is%20the%20capital%20of%20Germany.%22%2C%22Paris%20is%20the%20capital%20and%20largest%20city%20of%20France.%22%5D"
curl "https://tools.funwords.eu/ai/rerank?query=What%20is%20the%20capital%20of%20France%3F&documents=%5B%22France%20has%20hundreds%20of%20cheeses.%22%2C%22Berlin%20is%20the%20capital%20of%20Germany.%22%2C%22Paris%20is%20the%20capital%20and%20largest%20city%20of%20France.%22%5D&api_key=adt_…"

Without a key the same URL answers 402 Payment Required with x402 and MPP terms, so a wallet client pays USDC per call and retries. Over MCP (https://tools.funwords.eu/mcp) this tool is ai_rerank.

Example result
{
  "query": "What is the capital of France?",
  "results": [
    {
      "index": 2,
      "relevance_score": 0.999785,
      "document": "Paris is the capital and largest city of France."
    },
    {
      "index": 1,
      "relevance_score": 0.025102,
      "document": "Berlin is the capital of Germany."
    }
  ],
  "documents": 3,
  "clippedDocuments": 0,
  "model": "@cf/baai/bge-reranker-base"
}

Tool page, inputs and limits

Questions

Which model and size?

BAAI's BGE-M3, 1,024 dimensions.

Can I send several texts at once?

No, one text (up to 4,000 characters) per call.

How do I pay?

Each successful call costs the tool's price; failed calls are not charged. The first 25 calls are free. Then pay with card credits from $1 (the key goes in an Authorization header or as api_key= in the URL) or per call in USDC over x402 or MPP. No account is needed.