QVeris API client.
import { Qveris } from '@qverisai/sdk';
const qveris = new Qveris({ apiKey: process.env.QVERIS_API_KEY! });
const found = await qveris.discover('stock price market data API', { limit: 5 });
const parameters = { symbol: 'AAPL' };
const matchesType = (type: string, value: unknown) => {
if (type === 'string') return typeof value === 'string';
if (type === 'integer') return typeof value === 'number' && Number.isFinite(value) && Number.isInteger(value);
if (type === 'number') return typeof value === 'number' && Number.isFinite(value);
if (type === 'boolean') return typeof value === 'boolean';
if (type === 'array') return Array.isArray(value);
if (type === 'object') return value !== null && typeof value === 'object' && !Array.isArray(value);
return false;
};
const tool = found.results.find((candidate) => {
if (!candidate.params) return false;
const definitions = new Map(candidate.params.map((parameter) => [parameter.name, parameter]));
if (definitions.size !== candidate.params.length) return false;
return Object.entries(parameters).every(([name, value]) => {
const parameter = definitions.get(name);
return Boolean(parameter && matchesType(parameter.type, value) &&
(!parameter.enum || parameter.enum.some((allowed) => Object.is(allowed, value))));
}) && candidate.params.every((parameter) =>
!parameter.required || Object.prototype.hasOwnProperty.call(parameters, parameter.name));
});
if (!tool) throw new Error('Inspect promising candidates to obtain a compatible contract.');
const outcome = await qveris.call(tool.tool_id, {
searchId: found.search_id,
parameters,
});
new Qveris(
config):Qveris
get rateLimitRetryCount():
number
How many times the client has backed off on a rate-limited (429) / transient (503) response so far. Rate-limit backoff is retried pressure, not failure — observe this rather than counting the retried responses.
number
call(
toolId,options):Promise<ExecuteResponse>
Call a capability. The response may include pre-settlement billing; final charges are reflected in usage() and ledger().
string
Promise<ExecuteResponse>
credits():
Promise<CreditsResponse>
Get current credit balance and bucket details.
Promise<CreditsResponse>
discover(
query,options?):Promise<SearchResponse>
Discover capabilities from a natural-language query. Free.
string
DiscoverOptions = {}
Promise<SearchResponse>
inspect(
toolIds,options?):Promise<SearchResponse>
Inspect capabilities by id to get current parameter schemas. Free. An empty id list resolves locally without a network request.
string | string[]
InspectOptions = {}
Promise<SearchResponse>
ledger(
filters?):Promise<CreditsLedgerResponse>
Query final credits ledger entries.
CreditsLedgerRequest = {}
Promise<CreditsLedgerResponse>
probe(
toolId,options?):Promise<ProbeResponse>
Validate candidate parameters and request a zero-cost quote without executing the capability.
string
ProbeOptions = {}
Promise<ProbeResponse>
usage(
filters?):Promise<UsageEventsResponse>
Query request-level usage audit history.
UsageHistoryRequest = {}
Promise<UsageEventsResponse>
staticfromEnv(overrides?):Qveris
Create a client from the QVERIS_API_KEY environment variable. An explicit baseUrl override takes priority over QVERIS_BASE_URL.
Omit<QverisClientOptions, "apiKey" | "credentialProvider">
Select a capability from Discover, build parameters from its current schema, and Probe before Call when an agent generated the values, the schema is complex, or cost matters. Authentication, exhausted rate-limit retries, and request validation failures throw SDK errors; also inspect Call's success and error fields for business failures. search_tools, get_tools_by_ids, and execute_tool are compatibility aliases; new code should use discover, inspect, probe, and call.
const found = await qveris.discover("weather data for a city");
const tool = found.results[0];
if (!tool) throw new Error("No matching capability");
await qveris.inspect(tool.tool_id, { searchId: found.search_id });
const parameters = { q: "London" }; // Build from the inspected params schema.
await qveris.probe(tool.tool_id, { parameters, checks: ["schema", "quote"] });
const result = await qveris.call(tool.tool_id, { parameters, searchId: found.search_id });
if (!result.success) throw new Error(result.error_message ?? "Capability call failed");
Was this page helpful?