SDKs
JavaScript & TypeScript
A tiny, dependency-free client built on fetch. Works in Node 18+ and modern browsers.
Install
npm
npm install @ohsee/sdkInitialize
Create a client with your API key. Methods take a single request object and return the parsed JSON response.
index.ts
import { Ohsee } from "@ohsee/sdk";
const client = new Ohsee({
apiKey: process.env.OHSEE_API_KEY!,
// baseUrl defaults to https://api.ohsee.tech
});
const res = await client.search({
query: "MCP auth",
search_depth: "basic",
max_results: 5,
});Methods
methods
client.search(body) // POST /search
client.extract(body) // POST /extract
client.structure(body) // POST /structure
client.research(body) // POST /research (async job)
client.map(body) // POST /map (sync if limit <= 50)
client.crawl(body) // POST /crawl (async job)
client.domain(body) // POST /domain (async job)
client.estimate(body) // POST /estimate
client.getJob(jobId) // GET /jobs/{id}
client.listJobs(params?) // GET /jobs
client.runMonitor(id) // POST /monitors/{id}/run (async job)Auth scope
runMonitor works with an API key. Creating and listing monitors and reading account usage require a dashboard session, not an API key, so manage those from the dashboard.Async jobs
research, crawl, domain, large map, and runMonitor return a job. Poll it to completion:
poll.ts
const { job_id } = await client.research({
query: "compare vector databases for RAG",
research_depth: "standard",
});
let job = await client.getJob(job_id);
while (!["succeeded", "partial", "failed"].includes(job.status)) {
await new Promise((r) => setTimeout(r, 1000));
job = await client.getJob(job_id);
}
console.log(job.result);Errors
Non-2xx responses throw an OhseeError with status and detail.
errors.ts
import { Ohsee, OhseeError } from "@ohsee/sdk";
const client = new Ohsee({ apiKey: process.env.OHSEE_API_KEY! });
try {
await client.search({ query: "..." });
} catch (err) {
if (err instanceof OhseeError) {
console.error(err.status, err.detail);
}
}