TypeScript LLM client · v3.8.1

One client.
Every model.

@hilbras/sdk puts 23 provider adapters behind a single API — streaming, tool calling and validated structured output — with budgets, retries and guardrails, and no runtime dependencies.

Zero runtime depsTyped end to endMIT licensed2078 tests
// One client, any provider. Fallback and a spend cap included.
import { HilbrasClient } from '@hilbras/sdk';

const client = new HilbrasClient({ budget: { sessionBudget: 2.5 } });

client.addProvider({ name: 'openai', apiKey: process.env.OPENAI_API_KEY });
client.addProvider({ name: 'anthropic', apiKey: process.env.ANTHROPIC_API_KEY });

for await (const chunk of client.stream({
  provider: 'openai',
  model: 'gpt-5.6-terra',
  messages: [{ role: 'user', content: 'Explain vector search' }],
  fallback: [{ provider: 'anthropic', model: 'claude-sonnet-5' }],
})) {
  if (chunk.type === 'text') process.stdout.write(chunk.text);
}
// text · reasoning · tool_call · usage · finish — typed, every time

Bring the providers you already use

A calmer provider layer

Swap the model. Keep the code.

Provider differences belong in one place. Your application keeps calling stream() andcomplete() while models, regions and vendors change underneath it.

One API, 23 adapters

Register a provider, then call the same methods everywhere. Swapping a vendor is a string, not a rewrite — and the catalog knows each provider's models, context windows and pricing.

17 providers · one client

Streaming with real semantics

Every chunk is typed — text, reasoning, tool call, usage, finish. SSE framing handles CRLF, usage is accounted per provider, and a fallback that is configured actually runs.

Typed chunks · first-chunk latency

Guardrails that ship on

Session and per-request budgets with reservations, retries with capped backoff, a circuit breaker, fallback chains, RBAC, and an audit log that redacts credentials before writing.

Budgets · retries · audit
Everything in the box

Built for the parts that break.

Validated structured output, with a repair loop when the model returns malformed JSON
Tool calling — native where the provider supports it, and text-embedded where it does not
Cost tracking and budget alerts, priced per model
Retries, timeouts and a circuit breaker per provider
Fallback and priority routing across providers
RBAC, an audit log, prompt-injection checks and PII redaction
Hooks for React, Vue, Svelte, Solid, Qwik and Angular; handlers for Next.js, Astro and Remix
Runs on Node 18+, Bun and Deno, with no runtime dependencies
Three steps

From install to first token.

01

Install it

One package, no transitive runtime dependencies. TypeScript types come with it.

npm install @hilbras/sdk
02

Add your providers

Bring keys for the services you already use, or point at a local Ollama endpoint.

client.addProvider({ name: 'openai', apiKey })
03

Make one request

Stream or complete, with tools, schemas and fallback declared on the call.

await client.stream({ provider, model, messages })

Start with one provider.

Add a second when you need it — routing, fallback and budgets are already there.