Skip to main content

AI SDK

For an agent you build yourself with the AI SDK, @jevlinsearch/ai-sdk gives the model one tool, superSearch. One call asks several search engines at once and returns one merged list, each result naming the engines that found it.

This page is for your own application. For a coding agent such as Claude Code, Cursor or Codex, use the quickstart instead: the client there also sends the agent's trajectory.

Install​

npm install @jevlinsearch/ai-sdk

The package needs ai version 5, 6 or 7 and zod version 4.

Get a key​

Sign in at platform.jevlin.ai, create a key in your project, and set it in the environment:

export JEVLIN_API_KEY=sr-...

Use​

import { generateText, isStepCount } from 'ai';
import { superSearch } from '@jevlinsearch/ai-sdk';

const { text } = await generateText({
model: 'openai/gpt-5-mini',
prompt: 'What changed in the latest stable Kubernetes release?',
tools: {
superSearch: superSearch(),
},
stopWhen: isStepCount(3),
});

console.log(text);

streamText and agents take the tool the same way.

What the model may send​

fieldvalue
queryOne focused search. Required.
searchQueriesUp to 4 other wordings of the same question. Each runs beside the query and the results are pooled.
recencyday, week, month or year. A preference.
domainsUp to 16 bare hostnames. A preference.
tierOnly when you set modelMayChooseTier.

These map onto the router's request options.

What the tool returns​

fieldvalue
results[]The merged list, best first: url, title, published when known, excerpt, foundBy and votes.
results[].foundByThe engines that listed the page. A page several independent engines agree on is more likely the one to read.
engines[]Each engine asked, with its status. One that failed is named, and the rest still answer.
requestIdThe router's id for the search. Its trace on the platform is filed under it.
billing, costUsdThe price band and what the search cost, when the router reports them.

Options​

superSearch({
apiKey: process.env.JEVLIN_API_KEY, // the default
tier: 'fast', // 'fast' | 'balanced' | 'max'; unset, your key's default applies
maxResults: 8, // 1 to 25
pageChars: 1200, // text per page, 200 to 4000
modelMayChooseTier: false, // true adds `tier` to what the model may send
timeoutMs: 30_000,
});

A tier decides how many engines a search asks and what it costs, so the model cannot change it unless you allow it. See Providers and tiers.

Errors​

A refusal from the router is thrown as a JevlinError carrying the HTTP status and the router's code: 401 bad_key, 402 credits_exhausted, 429 rate_limited. The AI SDK passes a thrown tool error back to the model as a tool error. See Rate limits and spend caps.

What it costs​

A search from this package costs what any search on its tier costs, paid from your account's credit. See Pricing and credit.

Source​

github.com/jevlinai/jevlin-ai-sdk · npm