# Agent AI Tools (MPP): chat, translate, embeddings, rerank > Pay-per-call AI primitives for agents: chat completions with small open models (Gemma 4 26B-A4B, Granite 4 Micro, gpt-oss-20b), machine translation (100 languages), multilingual embeddings and cross-encoder reranking. Open models with commercial-use licences (Apache-2.0, MIT). No account or API key: pay per call with MPP on Tempo (USDC.e or pathUSD). Invalid input, a failed model call or the daily capacity limit returns 402 and is not charged. ## Docs (free) - Human docs with copy-paste examples: https://mpp-ai.fmf-x402.workers.dev/docs - OpenAPI 3.1: https://mpp-ai.fmf-x402.workers.dev/openapi.json - This file: https://mpp-ai.fmf-x402.workers.dev/llms.txt - MCP server (Streamable HTTP): https://mpp-ai.fmf-x402.workers.dev/mcp - Health: https://mpp-ai.fmf-x402.workers.dev/health - Attribution counters (no PII): https://mpp-ai.fmf-x402.workers.dev/stats/refs ## How to pay No account and no API key. Unpaid calls receive HTTP 402 with an MPP challenge on Tempo (USDC.e or pathUSD). Official clients pay the challenge and retry automatically. POST JSON (or GET with query params) to any paid route and pay the MPP 402 challenge on Tempo (USDC.e or pathUSD). Bad input or an upstream failure returns 402 with an error and you are not charged. Optional ?ref=channel or header X-FMF-Ref attributes the call for our coverage map (ignored by the tool). ## Quick start mppx CLI (creates/uses a Tempo account in your keychain): ```bash npx mppx https://mpp-ai.fmf-x402.workers.dev/mpp/embeddings -X POST -H 'content-type: application/json' -d '{"texts":["machine payments","pay per call API"]}' ``` TypeScript (mppx). After Mppx.create(), global fetch handles 402: ```ts import { Mppx, tempo } from 'mppx/client' import { privateKeyToAccount } from 'viem/accounts' Mppx.create({ methods: [tempo({ account: privateKeyToAccount(process.env.TEMPO_PRIVATE_KEY) })], }) // Global fetch now pays the 402 automatically. const res = await fetch('https://mpp-ai.fmf-x402.workers.dev/mpp/embeddings', { method: 'POST', headers: { 'content-type': 'application/json', }, body: JSON.stringify({"texts":["machine payments","pay per call API"]}), }) console.log(await res.json()) ``` Python (pympp): ```python # pip install pympp # Docs: https://mpp.dev/sdk/python import asyncio from mpp.client import Mpp from mpp.methods.tempo import TempoAccount from mpp.methods.tempo import client as tempo account = TempoAccount.from_key("0x...") async def main(): async with Mpp(methods=[tempo.charge(account=account)]) as mpp: response = await mpp.fetch("https://mpp-ai.fmf-x402.workers.dev/mpp/embeddings", method="POST", json={"texts":["machine payments","pay per call API"]}) print(await response.json()) asyncio.run(main()) ``` An unpaid curl shows the 402 (you are not charged): ```bash curl -i -X POST https://mpp-ai.fmf-x402.workers.dev/mpp/embeddings -H 'content-type: application/json' -d '{"texts":["machine payments","pay per call API"]}' ``` ## MCP Add this to Cursor / Claude Desktop / VS Code MCP settings (Streamable HTTP): ```json { "mcpServers": { "fmf-mpp-ai": { "url": "https://mpp-ai.fmf-x402.workers.dev/mcp" } } } ``` `tools/list` is free. `tools/call` requires an MPP Payment credential in the Authorization header (or just call the HTTP route with mppx). The wrapper does not settle payment on its own and stores nothing. ## Routes - POST https://mpp-ai.fmf-x402.workers.dev/mpp/chat ($0.002) Chat completion (small open models): OpenAI-style chat with open-weight models on Cloudflare Workers AI: gemma-4-26b-a4b (default), granite-4-micro (fastest), gpt-oss-20b (all Apache-2.0). Send messages[] or a prompt; up to ~6k input tokens and 1,024 output tokens per call, flat price. Returns the reply, token usage and finish reason. Daily capacity is limited; when it is reached you get 402 and are not charged. Example: `npx mppx https://mpp-ai.fmf-x402.workers.dev/mpp/chat -X POST -H 'content-type: application/json' -d '{"messages":[{"role":"system","content":"Answer in one sentence."},{"role":"user","content":"What is the Machine Payments Protocol?"}],"max_tokens":200}'` - POST https://mpp-ai.fmf-x402.workers.dev/mpp/translate ($0.003) Translate text (100 languages): Machine translation between 100 languages (Meta M2M-100 1.2B, MIT licence): one text up to 5,000 characters or up to 20 texts per call, source and target as ISO codes or names. Long text is split by sentence and reassembled. Example: `npx mppx https://mpp-ai.fmf-x402.workers.dev/mpp/translate -X POST -H 'content-type: application/json' -d '{"text":"Pay per call, no API key needed.","target":"fr"}'` - POST https://mpp-ai.fmf-x402.workers.dev/mpp/embeddings ($0.0005) Text embeddings (multilingual): Dense vector embeddings for up to 100 texts per call (BAAI bge-m3, 1024 dimensions, 100+ languages, MIT licence), L2-normalised for cosine similarity. OpenAI-style response (data[i].embedding). Example: `npx mppx https://mpp-ai.fmf-x402.workers.dev/mpp/embeddings -X POST -H 'content-type: application/json' -d '{"texts":["machine payments","pay per call API"]}'` - POST https://mpp-ai.fmf-x402.workers.dev/mpp/rerank ($0.001) Rerank documents for a query: Score and sort up to 100 documents by relevance to a query with a cross-encoder (BAAI bge-reranker-base, MIT licence). Returns index, relevance score (0-1) and text, best first; top_n to truncate. Ideal after search or embeddings retrieval. Example: `npx mppx https://mpp-ai.fmf-x402.workers.dev/mpp/rerank -X POST -H 'content-type: application/json' -d '{"query":"how do agents pay for APIs?","documents":["MPP lets agents pay per HTTP call.","Bananas are rich in potassium."]}'` ## Sources and licences Models: Meta M2M-100 1.2B (MIT), BAAI bge-m3 and bge-reranker-base (MIT) on Cloudflare Workers AI. ## Sister services - [Doc Tools](https://mpp-docs.fmf-x402.workers.dev/docs?ref=cross-ai): PDF, Office, audio, OCR and text tools - [Web & Data](https://mpp-agent-data.fmf-x402.workers.dev/docs?ref=cross-ai): Scrape, extract, SEC filings, weather, FX - [Utility Tools](https://mpp-tools.fmf-x402.workers.dev/docs?ref=cross-ai): Tempo chain, attestation, QR, DNS, email, IP, geo, tech detect, math - [Browser](https://mpp-browser.fmf-x402.workers.dev/docs?ref=cross-ai): JS-rendered screenshots, page to Markdown, page to PDF - [Research](https://mpp-research.fmf-x402.workers.dev/docs?ref=cross-ai): Papers, FDA drugs, recalls, clinical trials, LEI - [Control-plane](https://controlplane-x402.fmf-x402.workers.dev/docs?ref=cross-ai): Contract control-plane snapshots and Tempo token data (MPP + x402) ## Attribution Append `?ref=your-channel` or send header `X-FMF-Ref: your-channel` on any request (including unpaid 402s and /docs). We count hits and paid successes per channel so we can see what actually drives calls. The parameter is ignored by the tool.