Skip to article

Valyu

Web-only search with content snippets, relevance, reported USD usage, and explicit adapter settings.

On this page

Normalized web search

The adapter sends one POST to https://api.valyu.ai/v1/search with X-API-Key authentication. It explicitly selects search_type: 'web'; the provider's broader dataset search is outside this adapter.

valyu-search.ts · server
import { createSearch } from '@belweave/search-sdk';
import { valyu } from '@belweave/search-sdk/valyu';

const apiKey = process.env.VALYU_API_KEY;
if (!apiKey) throw new Error('VALYU_API_KEY is required');

const client = createSearch({ provider: valyu({ apiKey }) });
const response = await client.web.search({
  query: 'SQLite write concurrency',
  limit: 5,
});
console.log(response.results, response.usage);

Content maps to snippet, relevance_score to the native score, and tx_id to provenance requestId. Reported total_deduction_dollars maps to USD usage. A missing amount remains unknown. The SDK validates consumed results before applying your output ceiling.

Adapter settings

Import ValyuOptions or ValyuSearchOptions from the same subpath for typed configuration. The search object is fixed when you create the adapter; it does not add fields to the portable SearchRequest.

SettingBehavior
search.maxPricePositive provider-native request budget; not an SDK estimate of USD.
search.relevanceThresholdNative relevance threshold between 0 and 1.
search.responseLengthshort, medium, large, max, or a positive integer character budget.
search.fastModeExplicit native fast-mode selection.
search.startDate, search.endDateYYYY-MM-DD subset with valid dates in ascending order.
search.instructionsNonblank provider ranking instructions, at most 500 characters.

Domain filters map to included_sources and excluded_sources. Both lists allow up to 100 hostnames under conservative SDK policy; this is not a verified native maximum. No implicit pagination or proprietary dataset access is performed.

Preserve provider details

The adapter also exposes searchRaw. It makes the same validated web-only request and returns { provider, retrievedAt, data }, retaining provider fields omitted by normalization. This direct adapter call does not run the createSearch fallback, retry, cache, or deadline policy. The HTTP transport retains its own resource bounds; supply a cancellation signal for your application deadline.

valyu-raw.ts · server
import { valyu } from '@belweave/search-sdk/valyu';

const apiKey = process.env.VALYU_API_KEY;
if (!apiKey) throw new Error('VALYU_API_KEY is required');

const provider = valyu({ apiKey, search: { responseLength: 'short' } });
const response = await provider.searchRaw(
  { query: 'SQLite write concurrency', limit: 5 },
  { signal: AbortSignal.timeout(10_000) },
);
// data is a record of unknown values: validate fields before using them.
console.log(response.provider, response.retrievedAt);

Coverage and verification

This integration has no generated native client or native operation inventory. Contents, generated answers, research jobs, and dataset access are separate Valyu products. Local fixtures establish expected mapping and failure handling; they do not verify live availability, account access, or billing.