
Security News
GPT-6 Astra Attempts Supply Chain Attacks Against Open Source Maintainers in Testing
GPT-6 Astra hits 100% on ExploitBench and finds zero-days autonomously, while independent tests reveal scope violations and monitoring gaps.
@unsearch/sdk
Advanced tools
The official JavaScript/TypeScript SDK for UnSearch - comprehensive AI search API with full backend capabilities.
npm install unsearch
# or
yarn add unsearch
# or
pnpm add unsearch
import { UnSearchClient } from 'unsearch';
const client = new UnSearchClient({
apiKey: 'uns_...' // or set UNSEARCH_API_KEY env var
});
// Simple search with AI answer
const results = await client.search({
query: 'What is retrieval augmented generation?',
includeAnswer: true,
maxResults: 5
});
console.log(results.answer);
console.log(results.results);
// Basic web search
const results = await client.search({
query: 'latest AI developments 2026',
maxResults: 10,
searchDepth: 'advanced'
});
results.results.forEach(result => {
console.log(result.title, result.url);
});
// Get direct answers to questions
const response = await client.search({
query: 'How does vector search work?',
includeAnswer: true,
model: 'quality', // Use high-quality LLM
maxResults: 5
});
console.log('Answer:', response.answer);
console.log('Sources:', response.results.length);
// Shortcut for simple questions
const answer = await client.qna('What is the capital of France?');
console.log(answer); // "Paris is the capital of France..."
// Extract and parse content from URLs
const extracted = await client.extract({
urls: [
'https://example.com/article1',
'https://example.com/article2'
],
extractDepth: 'advanced',
includeImages: true
});
extracted.results.forEach(content => {
console.log(content.title);
console.log(content.markdown); // Markdown formatted
console.log(content.images);
});
// Multi-step research with AI synthesis
const research = await client.research({
topic: 'Impact of AI on healthcare',
depth: 'deep', // quick | standard | deep | comprehensive
maxSources: 20,
includeAnalysis: true,
focusAreas: ['diagnostics', 'drug discovery', 'patient care']
});
console.log(research.executiveSummary);
console.log(research.keyFindings);
console.log(research.sources.length); // 20+ sources
// Get search results formatted for RAG
const ragResults = await client.ragSearch({
query: 'machine learning best practices',
maxSources: 5,
scrapeContent: true,
includeContext: true
});
// Use context directly in your LLM prompt
const context = ragResults.context;
const prompt = `Based on this context: ${context}\n\nAnswer: ${query}`;
// Tavily-compatible method for RAG context
const context = await client.getSearchContext(
'What are the latest developments in quantum computing?',
5 // max results
);
// Feed context to your LLM
const answer = await yourLLM.generate({
prompt: `Context: ${context}\n\nQuestion: ...`,
});
// Semantic search with auto-prompting
const neural = await client.neuralSearch({
query: 'innovations in renewable energy',
numResults: 10,
useAutoprompt: true, // AI expands query for better recall
includeHighlights: true,
category: 'tech'
});
console.log('Expanded queries:', neural.expandedQueries);
neural.results.forEach(r => {
console.log(r.title, r.highlights);
});
// Find content similar to a URL
const similar = await client.findSimilar({
url: 'https://example.com/article',
numResults: 10,
excludeSource: true
});
// Or find similar to text
const similarText = await client.findSimilar({
text: 'Your article content here...',
numResults: 5
});
// Create a monitor for real-time updates
const monitor = await client.createMonitor({
topic: 'artificial intelligence regulations',
keywords: ['AI', 'regulation', 'EU', 'policy'],
checkIntervalMinutes: 60,
webhookUrl: 'https://your-app.com/webhook',
deepAnalysis: true
});
// List monitors
const monitors = await client.listMonitors();
// Get results
const results = await client.getMonitorResults(monitor.id, 50);
// Verify a claim
const verification = await client.verifyClaim({
claim: 'The Earth is approximately 4.5 billion years old',
depth: 'thorough'
});
console.log('Verdict:', verification.verdict); // true, false, partially_true, etc.
console.log('Confidence:', verification.confidence);
console.log('Summary:', verification.summary);
console.log('Supporting evidence:', verification.supportingEvidence);
// Check source credibility
const credibility = await client.checkSourceCredibility({
url: 'https://example-news.com'
});
console.log('Credibility score:', credibility.credibilityScore);
console.log('Bias rating:', credibility.biasRating);
const results = await client.search({
query: 'artificial intelligence',
maxResults: 10,
searchDepth: 'advanced', // basic | advanced | fast | ultra-fast
includeAnswer: true,
includeRawContent: true,
includeImages: true,
includeDomains: ['arxiv.org', 'nature.com'], // Filter sources
excludeDomains: ['example.com'],
model: 'quality', // auto | speed | quality | reasoning | production
rerank: true, // Use AI reranking
topic: 'news', // general | news
});
UnSearch supports intelligent model selection based on query complexity:
auto - Automatically choose best model (default)speed - Fast responses, simple queries (llama-3.1-8b)quality - Best quality answers (gpt-oss-120b)reasoning - Complex analysis (qwq-32b)production - Enterprise-grade (gpt-oss-120b)import {
UnSearchClient,
UnSearchAuthError,
UnSearchRateLimitError,
UnSearchNetworkError
} from 'unsearch';
try {
const results = await client.search({ query: 'test' });
} catch (error) {
if (error instanceof UnSearchAuthError) {
console.error('Invalid API key');
} else if (error instanceof UnSearchRateLimitError) {
console.error('Rate limit exceeded, please retry later');
} else if (error instanceof UnSearchNetworkError) {
console.error('Network error:', error.message);
} else {
console.error('Unknown error:', error);
}
}
const client = new UnSearchClient({
apiKey: 'uns_...', // Required (or set UNSEARCH_API_KEY env var)
baseUrl: 'https://api.unsearch.dev', // Optional
timeout: 30000, // Request timeout in ms (default: 30000)
maxRetries: 3, // Max retry attempts (default: 3)
});
UNSEARCH_API_KEY=uns_...
UNSEARCH_BASE_URL=https://api.unsearch.dev # Optional
UnSearch is 100% compatible with Tavily's API. Simply replace the client:
// Before (Tavily)
import { TavilyClient } from '@tavily/core';
const client = new TavilyClient({ apiKey: '...' });
// After (UnSearch)
import { UnSearchClient } from 'unsearch';
const client = new UnSearchClient({ apiKey: '...' });
// All methods work the same!
const results = await client.search({ query: '...' });
const extracted = await client.extract({ urls: ['...'] });
const context = await client.getSearchContext('...', 5);
| Feature | Tavily | UnSearch |
|---|---|---|
| Cost at scale | ~$0.0075/query | $0.0003/query (96% less) |
| Free tier | 1,000 queries | 5,000 queries (5x more) |
| Search engines | Single | 70+ aggregated |
| Self-hosted | ❌ | ✅ Open source |
| Zero retention | ❌ | ✅ Privacy mode |
| Deep research | ❌ | ✅ Multi-step synthesis |
| Model choice | Single | 20+ AI models |
| Method | Description |
|---|---|
search(options) | AI-optimized web search with optional answer generation |
extract(options) | Extract and parse content from URLs |
research(options) | Multi-step deep research with AI synthesis |
qna(query) | Quick Q&A shortcut - get direct answers |
listModels() | List available AI models |
agentHealth() | Agent API health check |
| Method | Description |
|---|---|
coreSearch(options) | Full-featured search with scraping, caching, etc. |
batchSearch(options) | Search multiple queries in parallel |
listEngines() | List available search engines |
searchHealth() | Search API health check |
| Method | Description |
|---|---|
ragResearch(options) | Deep RAG research on a topic |
ragSearch(options) | Quick RAG-optimized search |
getSearchContext(query, maxResults) | Get context string for RAG |
semanticSearch(options) | Semantic search over a corpus |
imageSearch(options) | Image search |
generateQueries(topic, numQueries) | Generate research queries |
listCorpora() | List all research corpora |
getCorpusInfo(corpusId) | Get corpus info |
deleteCorpus(corpusId) | Delete a corpus |
| Method | Description |
|---|---|
neuralSearch(options) | Neural/semantic search with auto-prompting |
findSimilar(options) | Find content similar to URL or text |
extractHighlights(options) | Extract key highlights from content |
predictiveSearch(options) | Predict what user might search next |
listNeuralCategories() | List neural search categories |
| Method | Description |
|---|---|
createMonitor(options) | Create a new topic monitor |
listMonitors() | List all monitors |
getMonitor(monitorId) | Get a specific monitor |
pauseMonitor(monitorId) | Pause a monitor |
resumeMonitor(monitorId) | Resume a monitor |
deleteMonitor(monitorId) | Delete a monitor |
triggerMonitorCheck(monitorId) | Manually trigger a check |
getMonitorResults(monitorId, limit) | Get monitor results |
| Method | Description |
|---|---|
enhancedSearch(options) | Advanced search with extraction strategies |
enhancedScrape(options) | Direct URL scraping with advanced features |
enhancedFeatures() | List available enhanced features |
extractTables(options) | Extract tables from HTML content |
chunkContent(options) | Chunk text for RAG pipelines |
discoverUrls(options) | Discover URLs from sitemaps/crawling |
enhancedPerformance() | Get performance metrics |
| Method | Description |
|---|---|
knowledgeExtract(options) | Extract entities & relationships from text |
knowledgeSearch(options) | Search the knowledge graph |
knowledgePeople(options) | Search for people |
knowledgeGetEntity(entityId) | Get a specific entity |
knowledgeGraph(entityTypes?, limit?) | Get graph structure |
knowledgeDeleteEntity(entityId) | Delete an entity |
| Method | Description |
|---|---|
registerAgent(options) | Register new AI agent (sandbox) |
agentStatus() | Get current agent status |
resendClaim() | Resend agent claim link |
| Method | Description |
|---|---|
verifyClaim(options) | Verify a claim with multi-source fact-checking |
checkSourceCredibility(options) | Check source/domain credibility |
batchVerify(options) | Batch verify multiple claims |
getBatchVerificationStatus(jobId) | Get batch verification status |
Check out the examples directory for complete examples:
This SDK is written in TypeScript and includes full type definitions. All methods are fully typed for the best developer experience.
import type {
SearchOptions,
SearchResponse,
ResearchOptions
} from 'unsearch';
We welcome contributions! Please see our Contributing Guide.
MIT License - see LICENSE for details.
Built with ❤️ by the UnSearch team
FAQs
UnSearch SDK - Tavily-compatible AI search API with RAG capabilities
The npm package @unsearch/sdk receives a total of 7 weekly downloads. As such, @unsearch/sdk popularity was classified as not popular.
We found that @unsearch/sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.

Security News
GPT-6 Astra hits 100% on ExploitBench and finds zero-days autonomously, while independent tests reveal scope violations and monitoring gaps.

Product
Socket can now send alerts and supply chain attack notifications to Microsoft Teams, with filters that route the right updates to each channel.

Security News
pnpm 12 rewrites the package manager in Rust, cutting install times by up to 90% while preserving pnpm 11 workflows and lockfiles.