Summarization
Any length in, summary out — chunking and map-reduce handled server-side, every step itemized.
POST /v1/summarize summarizes anything — a paragraph, a 400-page PDF, a
long meeting transcript — in one call. When the input exceeds the model's
context window, the gateway chunks it on paragraph boundaries, summarizes
the pieces, and merges them (recursively if needed) — the map-reduce
plumbing every team hand-rolls, done server-side and itemized on the bill.
curl https://api.gopuram.net/v1/summarize \
-H "Authorization: Bearer $GOPURAM_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": {"type": "document_url", "document_url": "data:application/pdf;base64,<PDF>"},
"length": "brief",
"style": "bullets"
}'
{
"object": "summary",
"model": "google/gemini-3.6-flash",
"summary": "- The contract term is 24 months…",
"usage": {
"cost": 0.0031,
"input_tokens": 41200,
"output_tokens": 950,
"steps": [
{ "kind": "ocr", "model": "mistral/mistral-ocr", "pages": 38, "cost": 0.1596 },
{ "kind": "llm", "stage": "map", "chunk": 0, "cost": 0.0009 },
{ "kind": "llm", "stage": "map", "chunk": 1, "cost": 0.0008 },
{ "kind": "llm", "stage": "reduce", "cost": 0.0002 }
]
}
}
Request
| Field | Type | Notes |
|---|---|---|
input | object | {type:"text", text} (≤8M chars) · {type:"document_url", …} (PDF via OCR) · {type:"image_url", …} |
length | "brief" | "standard" | "detailed" | ≈100 / 300 / 800 words (default standard) |
max_words | int 1–5000 | overrides length (send one or the other) |
style | "prose" | "bullets" | "tldr" | default prose |
model | string | optional chat-model override |
Short inputs are a single model call (one steps entry). Long inputs show
the whole pipeline — map steps per chunk, then reduce — each priced at
the model's normal rate, exact total in usage.cost. Inputs beyond 64
chunks per pass are rejected with a clear 400 rather than silently
truncated.