An r/n8n thread asked for a search API that returns structured snippets ready to drop into an LLM context window — not raw HTML, not stripped meaning. This tutorial wires Scavio's /search endpoint into a Python or Node assistant in under 5 minutes.
Prerequisites
- Python 3.10+ or Node 20+
- Scavio API key (500 free credits/mo)
Walkthrough
Step 1: Get your API key
Sign up at scavio.dev. The free tier returns 500 credits/mo, no card.
export SCAVIO_API_KEY=sk_...Step 2: Make the search call
POST to /api/v1/search with x-api-key header.
import os, requests
API_KEY = os.environ['SCAVIO_API_KEY']
def search(query):
r = requests.post('https://api.scavio.dev/api/v1/search',
headers={'x-api-key': API_KEY},
json={'query': query})
return r.json()Step 3: Pull only the fields the LLM needs
Title, snippet, link. Drop the rest.
def trim(results):
return [{'title': r['title'], 'snippet': r['snippet'], 'url': r['link']}
for r in results.get('organic_results', [])[:5]]Step 4: Inject into the prompt
Pass trimmed results as part of the system context.
context = '\n'.join(f'- {r["title"]}: {r["snippet"]} ({r["url"]})' for r in trim(search('reddit api alternatives 2026')))
prompt = f'Use this context to answer the question.\n\n{context}\n\nQuestion: which APIs replace Reddit\'s direct search?'Step 5: Pair with the extract endpoint when more context is needed
Fetch the top result as markdown.
def fetch(url):
r = requests.post('https://api.scavio.dev/api/v1/extract',
headers={'x-api-key': API_KEY}, json={'url': url, 'format': 'markdown'})
return r.json().get('markdown', '')Python Example
import os, requests
API_KEY = os.environ['SCAVIO_API_KEY']
def ask_with_search(question):
s = requests.post('https://api.scavio.dev/api/v1/search',
headers={'x-api-key': API_KEY}, json={'query': question}).json()
ctx = '\n'.join(f'{r["title"]}: {r["snippet"]}' for r in s.get('organic_results', [])[:5])
return ctx
print(ask_with_search('what is mcp'))JavaScript Example
const API_KEY = process.env.SCAVIO_API_KEY;
export async function search(q) {
const r = await fetch('https://api.scavio.dev/api/v1/search', {
method: 'POST',
headers: { 'x-api-key': API_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({ query: q })
});
return r.json();
}Expected Output
Five clean snippets per query, ready to inject into the LLM's context. Token cost stays under 800 tokens for the search context block.