@contextwire/sdk
March 26, 2026 · View on GitHub
Official Node.js SDK for ContextWire — AI-powered search, research, and content extraction.
Install
npm install @contextwire/sdk
Quick Start
import 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);
API Reference
new ContextWire(config)
| Parameter | Type | Default | Description |
|---|---|---|---|
apiKey | string | required | Your ContextWire key |
baseUrl | string | https://contextwire.dev | API base URL |
api.search(query, options?)
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 }
api.ask(query, options?)
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 }
api.research(query, options?)
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 found
Options: depth (quick | standard | deep), maxSources
Returns: { summary, findings, sources, papers }
api.extract(url, options?)
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 }
api.batchSearch(queries, options?)
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
Error Handling
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
}
}
TypeScript
Full type definitions included:
import ContextWire, { SearchResult, AskResult, ContextWireError } from '@contextwire/sdk';
Get an API Key
Visit contextwire.dev to get a free API key.
License
MIT