Skip to main content
Make your first Valyu call in three steps: get a key, install the SDK, run a search.

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

Open in Cursor
1

Get your free API key

Sign in at the Valyu Platform and copy a key from your dashboard.

Get your free API key

$10 free credits ($20 with a work email), usable across every source. No credit card required.
2

Install the SDK

pip install valyu
npm install valyu-js
3

Run your first search

from valyu import Valyu

valyu = Valyu("your-api-key-here")
response = valyu.search("What is quantum computing?")

for result in response.results:
    print(result.title)
    print(result.url)
    print(result.content[:200], "...")
import { Valyu } from "valyu-js";

const valyu = new Valyu("your-api-key-here");
const response = await valyu.search("What is quantum computing?");

response.results.forEach((result) => {
  console.log(result.title);
  console.log(result.url);
  console.log(result.content.substring(0, 200), "...");
});
curl --request POST \
  --url https://api.valyu.ai/v1/search \
  --header 'content-type: application/json' \
  --header "x-api-key: $VALYU_API_KEY" \
  --data '{ "query": "What is quantum computing?" }'
That’s it - the results are ready to feed an LLM.
Add parameters to target proprietary sources, filter by relevance, and steer ranking. Set is_tool_call=true whenever results feed an LLM.
from valyu import Valyu

valyu = Valyu("your-api-key-here")
response = valyu.search(
    "Implementation details of agentic search-enhanced large reasoning models",
    max_num_results=10,
    relevance_threshold=0.5,
    included_sources=["valyu/valyu-arxiv", "valyu/valyu-pubmed"],
    is_tool_call=True
)

for result in response.results:
    print(result.title, result.url)
import { Valyu } from "valyu-js";

const valyu = new Valyu("your-api-key-here");
const response = await valyu.search(
  "Implementation details of agentic search-enhanced large reasoning models",
  {
    maxNumResults: 10,
    relevanceThreshold: 0.5,
    includedSources: ["valyu/valyu-arxiv", "valyu/valyu-pubmed"],
    isToolCall: true
  }
);

response.results.forEach((result) => console.log(result.title, result.url));
curl --request POST \
  --url https://api.valyu.ai/v1/search \
  --header 'content-type: application/json' \
  --header "x-api-key: $VALYU_API_KEY" \
  --data '{
    "query": "Implementation details of agentic search-enhanced large reasoning models",
    "max_num_results": 10,
    "relevance_threshold": 0.5,
    "included_sources": ["valyu/valyu-arxiv", "valyu/valyu-pubmed"],
    "is_tool_call": true
  }'
The search engine handles noisy queries too - ”$$$$$ of larry and Sergey brins companie. on fr week commencing 5th hune on the 21st century” resolves to Google’s stock price for Friday June 5th, 2021. See the Search guide and API reference.
Valyu is four building blocks behind one API key. Reach for the one that fits the task.
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://en.wikipedia.org/wiki/Artificial_intelligence"],
    response_length="medium",
    extract_effort="auto",
)
print(data.results[0].content[:500])
import { Valyu } from "valyu-js";

const valyu = new Valyu(); // Uses VALYU_API_KEY from env

const data = await valyu.contents(
  ["https://en.wikipedia.org/wiki/Artificial_intelligence"],
  {
    responseLength: "medium",
    extractEffort: "auto",
  }
);
console.log(data.results[0].content.slice(0, 500));
curl -X POST https://api.valyu.ai/v1/contents \
  -H "content-type: application/json" \
  -H "x-api-key: $VALYU_API_KEY" \
  -d '{
    "urls": ["https://en.wikipedia.org/wiki/Artificial_intelligence"],
    "response_length": "medium",
    "extract_effort": "auto"
  }'
For JSON Schema extraction and AI summaries, see the Content Extraction guide.
A single answer backed by Valyu search and citations.
from valyu import Valyu

valyu = Valyu()  # Uses VALYU_API_KEY from env

data = valyu.answer(query="latest developments in quantum computing")
print(data.contents)
import { Valyu } from "valyu-js";

const valyu = new Valyu(); // Uses VALYU_API_KEY from env

const data = await valyu.answer("latest developments in quantum computing");
console.log(data.contents);
curl -X POST https://api.valyu.ai/v1/answer \
  -H "content-type: application/json" \
  -H "x-api-key: $VALYU_API_KEY" \
  -d '{ "query": "latest developments in quantum computing" }'
For structured responses and custom instructions, see the Answer API guide.
Hand off an open-ended task and get back a synthesised, cited report. Runs asynchronously - modes: fast ($0.10), standard ($0.50), heavy ($2.50), max ($15.00).
from valyu import Valyu

valyu = Valyu()  # Uses VALYU_API_KEY from env

task = valyu.deepresearch.create(
    query="Analyze the competitive landscape of cloud computing in 2024",
    mode="standard"
)
result = valyu.deepresearch.wait(task.deepresearch_id)
print(result.output)
import { Valyu } from "valyu-js";

const valyu = new Valyu(); // Uses VALYU_API_KEY from env

const task = await valyu.deepresearch.create({
  query: "Analyze the competitive landscape of cloud computing in 2024",
  mode: "standard"
});
const result = await valyu.deepresearch.wait(task.deepresearch_id);
console.log(result.output);
curl -X POST https://api.valyu.ai/v1/deepresearch/tasks \
  -H "content-type: application/json" \
  -H "x-api-key: $VALYU_API_KEY" \
  -d '{ "query": "Analyze the competitive landscape of cloud computing in 2024", "mode": "standard" }'
See the DeepResearch guide.

Next steps

Overview

Pick the path that matches what you’re building

Python SDK

Full Python SDK reference

TypeScript SDK

Full TypeScript SDK reference

Prompting guide

Write effective queries

Tips and tricks

Get better results

MCP integration

Power your MCP agents