Skip to main content
The Valyu Python SDK gives you search, content extraction, answers, and deep research through one API.

Paste into your AI coding assistant to install the Valyu Python SDK and make your first search call.

Open in Cursor

Install

Authenticate

Get your API key from the Valyu Platform ($10 free credits, $20 with a work email). The SDK reads VALYU_API_KEY from the environment automatically:

First call

Every method returns a typed response with a success flag - check it before reading results.

APIs

Search

Search web and proprietary sources

Contents

Extract and process web content

Answer

Generate cited answers from search

DeepResearch

Autonomous async research reports
For multi-step synthesis or cited reports, reach for DeepResearch - a cost-effective autonomous agent built on the Valyu search engine - rather than hand-rolling a search loop.

Async client

AsyncValyu is the async/await counterpart to Valyu: same arguments, same response objects, same validation. Every method is a coroutine you await. Reach for it when a single request fans out several Valyu calls (research agents, multi-source lookups) or runs inside an async web service. For one-off scripts and notebooks, the synchronous client is simpler.
Cap how many requests are in flight with a semaphore (keep it aligned with max_connections):
Use asyncio.as_completed to process each result the moment it’s ready instead of waiting for the whole batch.
Instantiate the client once at startup and share it - don’t create a fresh AsyncValyu per request, or you throw away the connection pool every time.
Prefer async with for scripts so the pool is released deterministically. For long-lived services, call aclose() on shutdown (it’s idempotent).
AsyncValyu currently exposes search, contents, get_contents_job, and wait_for_contents_job. The remaining endpoints (answer, deepresearch, datasources) are synchronous-only today; async counterparts will follow.

Support