Official Node.js SDK for ContextWire — AI-powered search, research, and content extraction.
npm install @contextwire/sdkimport ContextWire from '@contextwire/sdk';
const api = new ContextWire({ apiKey: 'your-api-key' });
// Search the web
const results = await api.search('best javascript frameworks 2026');
console.log(results.results);
// Ask a question (AI-powered answer with sources)
const answer = await api.ask('What is the population of Tokyo?');
console.log(answer.answer, answer.sources);| Parameter | Type | Default | Description |
|---|---|---|---|
apiKey |
string |
required | Your ContextWire key |
baseUrl |
string |
https://contextwire.dev |
API base URL |
Web search across 105+ engines.
const results = await api.search('node.js performance tips', {
profile: 'web',
page: 1,
timeRange: 'month',
});Options: profile, page, engines, timeRange
Returns: { query, results: [{ title, url, snippet, engine }], suggestions }
AI-powered question answering with source citations.
const answer = await api.ask('Who invented the transistor?', { maxSources: 5 });
console.log(answer.answer); // "The transistor was invented by..."
console.log(answer.confidence); // 0.95
console.log(answer.sources); // [{ title, url, snippet }]Options: profile, maxSources
Returns: { answer, sources, confidence }
Deep multi-source research with structured findings.
const report = await api.research('Impact of AI on healthcare', {
depth: 'deep',
maxSources: 20,
});
console.log(report.summary);
console.log(report.findings); // [{ title, summary, sources }]
console.log(report.papers); // Academic papers foundOptions: depth (quick | standard | deep), maxSources
Returns: { summary, findings, sources, papers }
Extract structured content from any URL.
const page = await api.extract('https://example.com/article', { format: 'markdown' });
console.log(page.title, page.content);Options: format (markdown | text | html)
Returns: { title, content, metadata }
Run multiple searches in one request.
const results = await api.batchSearch([
'javascript frameworks 2026',
'rust vs go performance',
], { profile: 'web' });Options: profile
Returns: Array of search results
import { ContextWire, ContextWireError } from '@contextwire/sdk';
try {
const result = await api.search('test');
} catch (err) {
if (err instanceof ContextWireError) {
console.error(err.message); // Human-readable message
console.error(err.status); // HTTP status (0 = network error)
console.error(err.code); // Machine-readable code
}
}Full type definitions included:
import ContextWire, { SearchResult, AskResult, ContextWireError } from '@contextwire/sdk';Visit contextwire.dev to get a free API key.
MIT