๐ฆ @contextwire/sdk v1.0.0
Node.js SDK
Official SDK for the ContextWire API. Type-safe, zero dependencies, works with Node 18+ and Deno.
Install
npm install @contextwire/sdk
Quick Start
import { ContextWire } from '@contextwire/sdk';
const cw = new ContextWire('YOUR_API_KEY');
// Ask a factual question (94.3% on SimpleQA)
const result = await cw.ask('Who invented the telephone?');
console.log(result.answer); // "Alexander Graham Bell"
console.log(result.sources); // [{title, url}, ...]
// Search the web
const web = await cw.search('latest AI news', { profile: 'news', maxResults: 5 });
console.log(web.results);
// Extract page content
const page = await cw.extract('https://en.wikipedia.org/wiki/Node.js', 'markdown');
console.log(page.content);
// Academic research
const papers = await cw.research('transformer attention mechanism', 5);
console.log(papers.papers);
// Batch search (parallel)
const batch = await cw.batchSearch([
{ q: 'climate change 2026', profile: 'news' },
{ q: 'carbon capture technology', profile: 'academic' },
]);
console.log(batch.results);API Reference
cw.ask(question) โ Full research loop. Returns answer + sources.
cw.search(query, options?) โ Web search. Options: profile, maxResults, freshness.
cw.extract(url, format?) โ Page extraction. Format: 'text' or 'markdown'.
cw.research(query, maxPapers?) โ Academic paper search.
cw.batchSearch(queries) โ Parallel multi-query search.
cw.suggest(query) โ Autocomplete suggestions.
cw.engines(category?) โ List search engines.
cw.profiles() โ List search profiles.
cw.health() โ API health check.
TypeScript
Full TypeScript definitions included. All return types are typed.
import { ContextWire, AskResult, SearchResponse } from '@contextwire/sdk';
const cw = new ContextWire(process.env.CONTEXTWIRE_KEY!);
const result: AskResult = await cw.ask('What is quantum computing?');
const search: SearchResponse = await cw.search('AI agents');Get an API Key
Free tier: 1,000 queries/month. Sign up at contextwire.dev โ