Installation
npm install @hubrix/sdk # or pnpm add @hubrix/sdk
Authentication
import { HubrixClient, login } from '@hubrix/sdk';
// With API key
const client = new HubrixClient({ apiKey: 'hbx_your_api_key' });
// With email/password
const { access_token } = await login('you@example.com', 'YOUR_PASSWORD');
const authedClient = new HubrixClient({ apiKey: access_token });Quickstart
import { HubrixClient } from '@hubrix/sdk';
const client = new HubrixClient({ apiKey: 'YOUR_API_KEY' });
// 1. Verify connection
const profile = await client.me();
console.log('Connected:', profile.email);
// 2. Start a research report
const job = await client.research.create(
'Latest advances in AI reasoning models',
{ depth: 'standard' }
);
// 3. Poll until complete
const report = await client.research.poll(job.id, { timeout: 120_000 });
console.log('Report:', report.content?.length, 'chars');
// 4. List workflows
const { total, items } = await client.workflows.list({ limit: 5 });
console.log(`Workflows: ${total}`, items.map(w => w.name));Recipes
Run a workflow
const run = await client.workflows.createRun(
'your-workflow-uuid',
{ query: 'Summarise Q1 2026 sales', format: 'markdown' }
);
const result = await client.workflows.pollRun(
'your-workflow-uuid',
run.id,
{ interval: 3000, timeout: 120_000 }
);
if (result.status === 'completed') {
console.log('Output:', result.outputs);
} else {
console.error('Failed:', result.status);
}Error handling
import {
HubrixClient,
InsufficientCreditsError,
RateLimitError,
AuthenticationError,
} from '@hubrix/sdk';
try {
const report = await client.research.create('AI trends 2026');
} catch (err) {
if (err instanceof InsufficientCreditsError) {
console.error('Credits needed:', err.detail);
} else if (err instanceof RateLimitError) {
console.error('Rate limited:', err.detail);
} else if (err instanceof AuthenticationError) {
console.error('Auth error — refresh token');
} else {
throw err;
}
}TypeScript
All SDK types are exported from @hubrix/sdk:
import type { Workflow, WorkflowRun, ResearchReport, User } from '@hubrix/sdk';Reference
Full API reference at api.hubrix.ai/reference.
Source: github.com/hubrix-ai/sdk-js