Get your free Valyu API key
Install Valyu
Install the Valyu SDK in your language of choice. Start searching with Valyu
Basic Search
Run your first Valyu DeepSearch in 4 lines of code. Simply replace the API key in this snippet with your own:from valyu import Valyu
valyu = Valyu("your-api-key-here")
response = valyu.search("What is quantum computing?")
for result in response.results:
print(f"Title: {result.title}")
print(f"Content preview: {result.content[:200]}...")
print(f"URL: {result.url}")
Advanced Search
Improve or guardrail your search results with more advanced parameters:from valyu import Valyu
valyu = Valyu("your-api-key-here")
response = valyu.search(
"Implementation details of agentic search-enhanced large reasoning models",
search_type="proprietary",
max_num_results=10,
max_price=30,
relevance_threshold=0.5,
category="agentic retrieval-augmented generation",
included_sources=["valyu/valyu-arxiv"],
is_tool_call=True
)
for result in response.results:
print(f" Title: {result.title}")
print(f" URL: {result.url}")
print(f" Content Preview: {result.content[:300]}...")
Turn any web page into clean markdown (or structured data) using the Contents API:from valyu import Valyu
valyu = Valyu() # Uses VALYU_API_KEY from env
data = valyu.contents(
urls=[
"https://techcrunch.com/category/artificial-intelligence/",
],
response_length="medium",
extract_effort="auto",
)
print(data["results"][0]["content"][:500]) # preview first 500 chars
AI-Powered Answers
Get intelligent responses that combine real-time search with AI processing using the Answer API:from valyu import Valyu
valyu = Valyu() # Uses VALYU_API_KEY from env
data = valyu.answer(
query="latest developments in quantum computing",
)
print(data["contents"]) # AI-generated response
Use Cases
Academic Research
Access millions of research papers and academic content with full-text search:
response = valyu.search(
"Extending context window of large language models via positional interpolation",
search_type="proprietary",
max_num_results=5,
max_price=30,
included_sources=["valyu/valyu-arxiv", "valyu/valyu-pubmed"]
)
# Print academic paper details with key fields
for result in response.results:
print(f" Title: {result.title}")
print(f" Authors: {', '.join(result.authors) if hasattr(result, 'authors') else 'N/A'}")
print(f" Publication Date: {getattr(result, 'publication_date', 'N/A')}")
print(f" DOI: {getattr(result, 'doi', 'N/A')}")
print(f" Citation: {getattr(result, 'citation', 'N/A')}")
print(f" Citation Count: {getattr(result, 'citation_count', 'N/A')}")
print(f" Content Preview: {result.content[:200]}...")
Response includes rich academic content:
{
"success": true,
"error": "",
"tx_id": "tx_55e65c6f-3607-4ebe-892b-e964b9c72a8d",
"query": "Extending context window of large language models via positional interpolation",
"results": [
{
"id": "55e65c6f-3607-4ebe-892b-e964b9c72a8d:2306.15595:1",
"title": "Extending Context Window of Large Language Models via Positional Interpolation",
"url": "https://arxiv.org/abs/2306.15595?utm_source=valyu.ai&utm_medium=referral",
"content": "#### 2.3 PROPOSED APPROACH: POSITION INTERPOLATION (PI)\n\n#### 2.1 BACKGROUND: ROTARY POSITION EMBEDDING (ROPE)\n\nTransformer models require explicit positional information to be injected, typically in the form of positional encodings, to represent the order of inputs. We consider Rotary Position Embedding (RoPE) (Su et al., 2021), which is the position encoding used in the LLaMA model...\n\n$$\\mathbf{f}(\\mathbf{x},m)=[(x_{0}+\\mathrm{i}x_{1})e^{im\\theta_{0}},(x_{2}+\\mathrm{i}x_{3})e^{im\\theta_{1}},\\ldots,(x_{d-2}+\\mathrm{i}x_{d-1})e^{im\\theta_{d/2-1}}]^{\\top}$$",
"source": "valyu/valyu-arxiv",
"length": 593,
"image_url": {
"_page_4_Figure_2.jpeg": "https://prod-s3-vyplatform-processeddata.s3.amazonaws.com/valyu/Arxiv-new/eb030308-a71b-5227-8ddf-9dbeeb1c6e12/_page_4_Figure_2.jpeg"
},
"publication_date": "2023-01-01",
"doi": "https://doi.org/10.48550/arxiv.2306.15595",
"citation": "Shouyuan Chen et al. (2023). Extending Context Window of Large Language Models via Positional Interpolation.",
"citation_count": 25,
"authors": [
"Shouyuan Chen",
"S.H. Wong",
"Liangjian Chen",
"Yuandong Tian"
],
"price": 0.0005,
"data_type": "unstructured",
"source_type": "paper",
"relevance_score": 0.8071867796187081
}
],
"results_by_source": {
"proprietary": 1,
"web": 0
}
}
Financial Market Data
Want financial data? Just ask in plain English - we’ll figure it out:
response = valyu.search(
"Pfizer stock price since COVID-19 outbreak",
search_type="proprietary",
max_num_results=1,
max_price=30 # Maximum price for a thousand retreivals (CPM)
)
for result in response.results:
print(f" Title: {result.title}")
print(f" Content Preview: {str(result.content)[:300]}...") # For structured financial data, show sample data points
if result.data_type == "structured" and isinstance(result.content, list):
print(f" Sample Data Points: {len(result.content)} entries")
for item in range(0, 3):
print(f" {result.content[item]}")
Response looks like this:
{
"success": true,
"error": "",
"tx_id": "tx_6a2568cf-a3f4-4860-9b6e-96b35e398b7f",
"query": "Price of TSLA today?",
"results": [
{
"title": "Price of PFE every 1mo between 2020-01-01 00:00 and 2025-05-26 00:00",
"url": "https://platform.valyu.ai/data-sources/valyu/valyu-stocks-US/characteristics",
"content": [
{
"datetime": "2025-05-01 04:00:00",
"open": 24,
"high": 24,
"low": 22,
"close": 23,
"volume": 78776482
},
{
...
}
],
"source": "valyu/valyu-stocks-US",
"price": 0.006,
"length": 8175,
"image_url": null,
"data_type": "structured",
"source_type": "data",
"relevance_score": 0.6277149030411012
}
],
"results_by_source": {
"proprietary": 1,
"web": 0
}
}
The search service can interpret noisy queries such as ”$$$$$ of larry and
Sergey brins companie. on fr week commencing 5th hune on the 21st century”
(which maps to “Google stock price for Friday June 5th, 2021”).
Next Steps