Skip to main content
The Valyu Python SDK provides comprehensive access to all Valyu APIs, enabling you to build powerful AI applications with search, content extraction, answer generation, and deep research capabilities.

Features

The SDK includes four core APIs:
  • Search API - Advanced search across web and proprietary data sources
  • Contents API - Extract and process content from URLs with AI
  • Answer API - AI-powered answer generation with search integration
  • DeepResearch API - Async deep research with comprehensive reports

Installation

Install the Valyu Python SDK using pip:
pip install valyu

Authentication

Get your API key from Valyu Platform (free $10 credits included). Set up authentication in one of two ways:
export VALYU_API_KEY="your-api-key-here"
from valyu import Valyu

# Automatically uses VALYU_API_KEY from environment
valyu = Valyu()

Direct API Key

from valyu import Valyu

valyu = Valyu("your-api-key-here")

Quick Start

Here’s a simple example to get you started with search:
from valyu import Valyu

valyu = Valyu()

# Basic search example
search_response = valyu.search(
    "What are the latest developments in quantum computing?"
)

print(f"Found {len(search_response.results)} results")
for result in search_response.results:
    print(f"Title: {result.title}")
    print(f"URL: {result.url}")
    print(f"Content preview: {result.content[:200]}...")

Error Handling

The SDK includes built-in error handling and validation:
response = valyu.search("test query")

if not response.success:
    print("Search failed:", response.error)
    return

# Process successful results
for result in response.results:
    # Handle each result
    pass

Next Steps

Explore the detailed documentation for each API:

Support