Skip to main content
1

Get your free Valyu API key

Go to the Valyu Platform and sign in (or create an account). Copy an API key from your dashboard.

Get your free API key

You get over 1000 free query retrievals. No credit card required.
Join the Valyu community on Discord for help and release previews.
2

Install Valyu

Install the SDK for your language:
pip install valyu
3

Start searching

Run your first search in a few lines of code:
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}")

Add parameters to improve or filter results:
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]}...")

For more details, see the Search Guide and the DeepSearch API reference.

Content Extraction

Turn any web page into clean markdown (or structured data):
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])

For structured extraction with JSON Schemas or AI summaries, see the Content Extraction Guide and the Contents API reference.

AI-Powered Answers

Get intelligent responses that combine search with AI processing:
from valyu import Valyu

valyu = Valyu() # Uses VALYU_API_KEY from env

data = valyu.answer(
    query="latest developments in quantum computing",
)
print(data["contents"])

For structured responses or custom AI instructions, see the Answer API Guide and the Answer API reference.

Use Cases

Academic Research

Search millions of papers with full-text retrieval:
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"]
)

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]}...")

Example response:
{
  "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...",
      "source": "valyu/valyu-arxiv",
      "length": 593,
      "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

Just ask in plain English:
response = valyu.search(
    "Pfizer stock price since COVID-19 outbreak",
    search_type="proprietary",
    max_num_results=1,
    max_price=30
)

for result in response.results:
    print(f" Title: {result.title}")
    print(f" Content Preview: {str(result.content)[:300]}...")
    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]}")

Example response:
{
    "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/characteristics",
        "content": [
          {
              "datetime": "2025-05-01 04:00:00",
              "open": 24,
              "high": 24,
              "low": 22,
              "close": 23,
              "volume": 78776482
          }
        ],
        "source": "valyu/valyu-stocks",
        "price": 0.006,
        "length": 8175,
        "data_type": "structured",
        "source_type": "data",
        "relevance_score": 0.6277149030411012
      }
    ],
    "results_by_source": {
        "proprietary": 1,
        "web": 0
    }
}
The search can interpret noisy queries like ”$$$$$ 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