Complete Valyu API toolkit with Search, Answer, Contents extraction, and DeepResearch...
Comprehensive CLI tool for all Valyu APIs: Search, Answer, Contents, and DeepResearch.
Requirements:
export VALYU_API_KEY=your-api-keyscripts/valyu search <type> <query> [maxResults]
scripts/valyu answer <query> [--fast] [--structured <schema>]
scripts/valyu contents <url> [--summary [instructions]] [--structured <schema>]
scripts/valyu deepresearch create <query> [--model <fast|lite|heavy>] [--pdf]
scripts/valyu deepresearch status <task-id>
| Type | Description | Sources |
|---|---|---|
web |
General web search | All web sources |
finance |
Financial data | Stocks, SEC, earnings, crypto, forex |
paper |
Academic papers | arXiv, bioRxiv, medRxiv, PubMed |
bio |
Biomedical research | PubMed, clinical trials, drug labels |
patent |
Patent databases | Patent filings |
sec |
SEC filings | 10-K, 10-Q, 8-K reports |
economics |
Economic data | BLS, FRED, World Bank |
news |
News articles | News sources |
# Web search
scripts/valyu search web "AI developments 2025" 10
# Academic papers
scripts/valyu search paper "transformer architectures" 15
# Financial data
scripts/valyu search finance "Apple earnings Q4 2024" 8
# Biomedical research
scripts/valyu search bio "cancer immunotherapy clinical trials"
{
"success": true,
"type": "search",
"searchType": "web",
"query": "AI news",
"resultCount": 10,
"results": [
{
"title": "Article Title",
"url": "https://example.com",
"content": "Full content...",
"source": "web",
"relevance_score": 0.95
}
],
"cost": 0.025
}
AI-powered answers with real-time search integration.
# Simple answer
scripts/valyu answer "What is quantum computing?"
# Fast mode (quicker, less comprehensive)
scripts/valyu answer "Latest AI news" --fast
# With structured output
scripts/valyu answer "Top tech companies 2024" --structured '{
"type": "object",
"properties": {
"companies": {
"type": "array",
"items": {"type": "string"}
},
"market_summary": {"type": "string"}
}
}'
{
"success": true,
"type": "answer",
"query": "What is quantum computing?",
"answer": "Quantum computing is...",
"data_type": "unstructured",
"sources": [
{
"title": "Source Title",
"url": "https://example.com"
}
],
"cost": 0.032
}
Extract clean, structured content from web pages.
# Extract raw content
scripts/valyu contents "https://techcrunch.com/article"
# Extract with AI summary
scripts/valyu contents "https://example.com" --summary
# Extract with custom instructions
scripts/valyu contents "https://example.com" --summary "Summarize key findings in 2 paragraphs"
# Extract structured data
scripts/valyu contents "https://product-page.com" --structured '{
"type": "object",
"properties": {
"product_name": {"type": "string"},
"price": {"type": "number"},
"features": {
"type": "array",
"items": {"type": "string"}
}
},
"required": ["product_name", "price"]
}'
| Length | Characters | Use For |
|---|---|---|
short |
25,000 | Summaries, key points |
medium |
50,000 | Articles, blog posts (default) |
large |
100,000 | Academic papers, long-form |
max |
Unlimited | Full document extraction |
{
"success": true,
"type": "contents",
"urls_requested": 1,
"urls_processed": 1,
"urls_failed": 0,
"results": [
{
"title": "Article Title",
"url": "https://example.com",
"content": "Extracted content...",
"data_type": "unstructured",
"summary_success": true,
"length": 12840
}
],
"total_cost": 0.001
}
Asynchronous deep research with comprehensive reports.
| Mode | Use Case | Typical Time |
|---|---|---|
fast |
Quick lookups, simple questions | ~5 minutes |
lite |
Balanced research (default) | ~10-20 minutes |
heavy |
In-depth analysis, complex research | Up to ~90 minutes |
# Basic research (lite mode, markdown)
scripts/valyu deepresearch create "AI market trends 2024"
# Heavy mode with PDF output
scripts/valyu deepresearch create "Climate change mitigation strategies" --model heavy --pdf
# Fast mode for quick lookup
scripts/valyu deepresearch create "Current Bitcoin price trends" --model fast
scripts/valyu deepresearch status f992a8ab-4c91-4322-905f-190107bd5a5b
--pdf flag for downloadable PDFqueued ā running ā completed/failed
Statuses:
queued: Waiting to startrunning: Actively researchingcompleted: Research finishedfailed: Error occurredcancelled: User cancelled{
"success": true,
"type": "deepresearch_create",
"deepresearch_id": "f992a8ab-4c91-4322-905f-190107bd5a5b",
"status": "queued",
"query": "AI market trends 2024",
"model": "lite",
"created_at": 1759617800000
}
{
"success": true,
"type": "deepresearch_status",
"deepresearch_id": "f992a8ab-4c91-4322-905f-190107bd5a5b",
"status": "completed",
"query": "AI market trends 2024",
"output": "# AI Market Trends 2024\n\n## Overview...",
"pdf_url": "https://storage.valyu.ai/reports/...",
"sources": [
{
"title": "Market Analysis 2024",
"url": "https://example.com",
"snippet": "Key findings...",
"source": "web",
"word_count": 2500
}
],
"progress": {
"current_step": 5,
"total_steps": 5
},
"usage": {
"search_cost": 0.0075,
"ai_cost": 0.15,
"total_cost": 0.1575
},
"completed_at": 1759617836483
}
# Get search result titles
scripts/valyu search web "AI" 5 | jq '.results[].title'
# Get answer text
scripts/valyu answer "What is AI?" | jq -r '.answer'
# Get extracted content
scripts/valyu contents "https://example.com" | jq -r '.results[].content'
# Get research output
scripts/valyu deepresearch status <task-id> | jq -r '.output'
# Check if completed
result=$(scripts/valyu deepresearch status <task-id>)
if echo "$result" | jq -e '.status == "completed"' > /dev/null; then
echo "Research complete!"
fi
All commands return JSON with success field:
{
"success": false,
"error": "Error message"
}
Exit codes:
0 - Success1 - Error (check JSON for details)# Deep research with PDF
scripts/valyu deepresearch create "Blockchain in healthcare" --model heavy --pdf
# Latest news
scripts/valyu search news "AI regulation EU" 20
# Extract and summarize
scripts/valyu contents "https://blog.com/post" --summary "Key takeaways in bullet points"
# Fast answer
scripts/valyu answer "Who won the 2024 election?" --fast
# Search papers
scripts/valyu search paper "CRISPR gene editing 2024" 15
# Get financial data
scripts/valyu search finance "Tesla stock performance 2024" 10
Get API key: https://platform.valyu.ai ($10 free credits)
/v1/search - Search API/v1/answer - Answer API /v1/contents - Contents API/v1/deepresearch/tasks - DeepResearch API/v1/deepresearch/tasks/{id}/status - Task statusscripts/
āāā valyu # Bash wrapper
āāā valyu.mjs # Node.js CLI (all APIs)
Direct API calls using Node.js built-in fetch(), zero external dependencies.