# POST /summarise: $0.02 per call

Summarise text or any public web page with AI. POST JSON with either "text" (up to 40,000 characters) or "url", plus optional "length" (short, medium, long), "format" (paragraph or bullets) and "language" for the summary. Returns the summary and source details. Failed or empty summaries are not charged.

- **Price:** $0.02 in USDC, the same on Base, Solana, Polygon, Arbitrum. Failed calls are never charged.
- **Free trial:** no, paid only (it uses a paid AI model or data source, or costs more than the trial covers). Other ways to pay: x402 or [prepaid credits](/credits).
- **Answers cached for:** 1 hour(s)
- **Data sources:** Workers AI (metered); the web
- **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/summarise](/sample/summarise). It is a stored real answer when we have one, otherwise an example marked `"kind": "illustrative"`.

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

## 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/summarise -H "content-type: application/json" -d '{"url":"https://en.wikipedia.org/wiki/HTTP_402","length":"short","format":"paragraph"}'
```

## 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/summarise", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({"url":"https://en.wikipedia.org/wiki/HTTP_402","length":"short","format":"paragraph"}),
});
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("summarise", {"url":"https://en.wikipedia.org/wiki/HTTP_402","length":"short","format":"paragraph"});
```

## Inputs

- `text` (string): Text to summarise (use this or url).
- `url` (string): Public web page to summarise (use this or text).
- `length` (string; one of `short`, `medium`, `long`; default `medium`): How long the summary should be.
- `format` (string; one of `paragraph`, `bullets`; default `paragraph`): Prose or bullet points.
- `language` (string): Language for the summary, e.g. English or fr. Default: same as the source.

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

## Example answer

```json
{
  "summary": "HTTP 402 Payment Required is a status code reserved for digital payments...",
  "source": {
    "url": "https://en.wikipedia.org/wiki/HTTP_402",
    "title": "HTTP 402",
    "chars": 5120,
    "truncated": false
  },
  "model": "@cf/mistralai/mistral-small-3.1-24b-instruct"
}
```

## 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 /embeddings](/services/embeddings) ($0.002): Text embeddings for semantic search, clustering and RAG: 1024-dimension multilingual vectors (BGE-M3, 100+ languages).
- [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](/).