# WikiGem — Wikipedia Knowledge API WikiGem is a pay-per-call MPP service that gives AI agents instant access to Wikipedia's knowledge base (60M+ articles, 300+ languages) via the Tempo blockchain micropayment protocol. **Cost:** $0.001 USDC.e per API call **Network:** Tempo Mainnet **Base URL:** https://wikigem.xyz **OpenAPI:** https://wikigem.xyz/api/openapi.json --- ## Endpoints ### POST /api/search Search Wikipedia articles by query string. **Request body:** ```json { "query": "string (required) — search terms", "lang": "string (optional, default: en) — language code: en, de, fr, ru, zh, es, ja, pt, it, ar, ...", "limit": "integer (optional, default: 5, max: 10) — number of results" } ``` **Response:** ```json { "query": "quantum computing", "lang": "en", "count": 5, "results": [ { "title": "Quantum computing", "snippet": "A quantum computer is a computer that exploits...", "wordcount": 12500, "size": 98432, "timestamp": "2026-05-12T08:23:11Z", "url": "https://en.wikipedia.org/wiki/Quantum_computing" } ] } ``` --- ### POST /api/summary Get the introductory summary of a Wikipedia article. **Request body:** ```json { "title": "string (required) — article title", "lang": "string (optional, default: en)" } ``` **Response:** Article extract (plain text + HTML), description, thumbnail image URL, last modified timestamp, and direct Wikipedia link. --- ### POST /api/section Extract the plain-text content of a specific article section. **Request body:** ```json { "title": "string (required) — article title", "section": "string (required) — section name (e.g. 'History') or numeric index", "lang": "string (optional, default: en)" } ``` **Response:** Section text (up to 3,000 characters). If section not found, returns the full list of available sections. --- ### POST /api/related Discover articles that Wikipedia considers related to a given article. **Request body:** ```json { "title": "string (required) — article title", "lang": "string (optional, default: en)" } ``` **Response:** Up to 8 related articles with titles, descriptions, and thumbnail URLs. --- ## Payment WikiGem uses the Tempo Machine Payments Protocol (MPP). Each request costs **0.001 USDC.e** charged atomically on Tempo Mainnet. Unauthenticated requests receive a **402 Payment Required** response with a challenge header containing payment instructions. Use the `tempo` CLI or `mppx` client library to handle payments automatically: ```bash tempo request -X POST https://wikigem.xyz/api/search \ --json '{"query":"artificial intelligence","limit":5}' ``` --- ## Data Wikipedia content is licensed under [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/). WikiGem does not store or cache article content beyond the Vercel edge cache TTL (60 seconds).