# Web search and extraction agent workflow

Combine web discovery, full-page extraction, and model summarization behind one KeepBal API key and one prepaid balance.

## Why teams consolidate this workflow

Research agents normally require separate search, scraper, and LLM accounts, each with different billing units and credential rotation rules. KeepBal lets the same key discover a tool, check its price, extract page text, and call a live model.

## Implementation sequence

1. **Discover and inspect.** Call POST /apis/v1/discover or MCP search_tools with a task query such as 'page contents', then inspect exa/contents at zero cost to read its inputs and published price.
2. **Extract clean text.** Call POST /apis/v1/exa/contents (or POST /apis/v1/run with max_cost_usd when using a variable tool) to fetch clean article text without running a headless browser.
3. **Summarize with a live model.** Pass the extracted text to a live model on POST /v1/chat/completions or POST /v1/messages and reconcile both charges in Usage.

## Example request

```python
import os
import requests

headers = {"Authorization": f"Bearer {os.environ['KEEPBAL_API_KEY']}"}

page = requests.post(
    "https://keepbal.com/apis/v1/exa/contents",
    headers=headers,
    json={"urls": ["https://example.com"], "text": True},
    timeout=60,
)
page.raise_for_status()
excerpt = str(page.json())[:4000]
print("Extracted characters:", len(excerpt))
```

## Pricing and spend controls

Check /tools/exa/contents and /models for current per-call and per-token prices before running batch jobs. Failed or timed-out tool calls charge $0.

## Related catalog surfaces

- [Exa Contents API](/tools/exa/contents)
- [Search and extraction tools](/tools/category/search-and-extraction)
- [Web scraping tools](/tools/category/web-scraping)

## Frequently asked questions

### Should my agent call /apis/v1/exa/contents or /apis/v1/run?

Both use the same wallet and per-call price. Direct tool paths accept the tool body directly; /apis/v1/run wraps body, queryParams, and pathParams in input and supports max_cost_usd on variable tools.

### What happens if a target page times out?

Failed, blocked, or timed-out provider calls charge $0. Check Usage or GET /apis/v1/runs/{id} before retrying an uncertain request.

[All use cases](/use-cases) · [Cost calculator](/cost-calculator) · [MCP config generator](/mcp-config)
