npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

investec-ai

v0.2.0

Published

AI-powered banking SDK for Investec — spending analysis, voice banking, receipt scanning, and agentic workflows

Downloads

259

Readme

Investec AI SDK

An AI-powered banking developer platform built on top of the Investec Open API. Add conversational banking, spending analysis, fraud detection, voice banking, and receipt scanning to any app in minutes.

Live demo: https://investec-ai-sdk.vercel.app
npm: https://www.npmjs.com/package/investec-ai


What's inside

| Package | Description | |---|---| | packages/sdk | The investec-ai npm package | | packages/react | Headless React components and hooks | | packages/shared | Shared TypeScript types | | apps/web | Next.js demo app (deployed to Vercel) | | apps/docs | Documentation site |


Quickstart

1. Install

npm install investec-ai

2. Initialise the client

import { InvestecAI } from 'investec-ai';

const sdk = new InvestecAI({
  clientId:     process.env.INVESTEC_CLIENT_ID!,
  clientSecret: process.env.INVESTEC_CLIENT_SECRET!,
  apiKey:       process.env.INVESTEC_API_KEY!,
  openaiApiKey: process.env.OPENAI_API_KEY!,
});

3. Add AI chat to any route (Next.js example)

// app/api/chat/route.ts
import { InvestecAI, createChatHandler } from 'investec-ai';

const sdk = new InvestecAI({ ... });

export const POST = createChatHandler(sdk);

That's it. Your app now has a fully functional AI banking assistant backed by real Investec data.


SDK reference

Accounts

// List all accounts
const accounts = await sdk.getAccounts();

// Get live balance
const { currentBalance, availableBalance } = await sdk.getBalance(accountId);

Transactions

const transactions = await sdk.getTransactions(accountId, {
  from: '2025-01-01',
  to:   '2025-01-31',
  limit: 50,
});

AI spending analysis

const analysis = await sdk.analyzeSpending(accountId, { period: '30d' });

console.log(analysis.categories);         // { "Groceries": 2400, "Transport": 850, ... }
console.log(analysis.insights);           // ["You spent 20% more on food...", ...]
console.log(analysis.predictions.next30Days); // 6200

Fraud detection

const alert = await sdk.detectFraud(transaction);

console.log(alert.riskScore);        // 0–100
console.log(alert.reasons);          // ["Unusual merchant location", ...]
console.log(alert.requiresConfirmation); // true | false

Receipt scanning

const receipt = await sdk.scanReceipt(imageBase64);

console.log(receipt.merchant); // "Woolworths Food"
console.log(receipt.amount);   // 342.50
console.log(receipt.items);    // [{ name: "Milk", price: 28, quantity: 2 }, ...]

Voice transcription

// audioBlob from browser MediaRecorder
const transcript = await sdk.transcribeAudio(audioBlob);

AI chat handler

import { createChatHandler } from 'investec-ai';
import { anthropic } from '@ai-sdk/anthropic';

export const POST = createChatHandler(sdk, {
  model: anthropic('claude-opus-4-5'),  // any Vercel AI SDK model
  maxSteps: 10,
  system: (defaultPrompt) => `${defaultPrompt}\n\nAlways respond in Zulu.`,
});

The handler is framework-agnostic — works with Next.js App Router, Hono, or any runtime that handles standard Request/Response objects.


Environment variables

| Variable | Description | |---|---| | INVESTEC_CLIENT_ID | Investec OAuth client ID | | INVESTEC_CLIENT_SECRET | Investec OAuth client secret | | INVESTEC_API_KEY | Investec x-api-key header value | | OPENAI_API_KEY | OpenAI API key (for chat, analysis, fraud detection, receipt scanning, transcription) |

Get your Investec credentials from the Investec Developer Portal. The SDK defaults to the sandbox environment. Pass environment: 'production' to use live data.


Running the demo app locally

# 1. Clone the repo
git clone https://github.com/HappyDevs1/investec-ai.git
cd investec-ai

# 2. Install dependencies
pnpm install

# 3. Add environment variables
cp apps/web/.env.local.example apps/web/.env.local
# Fill in your credentials

# 4. Start the dev server
pnpm --filter @investec-ai/web dev

Then open http://localhost:3000.


Demo features

| Page | Feature | |---|---| | /dashboard | Account overview, live balance, spending chart, AI insights | | /dashboard/chat | Conversational banking — ask anything about your finances | | /dashboard/transactions | Full transaction list with per-transaction AI fraud detection | | /dashboard/voice | Voice banking — speak a question, Whisper transcribes, GPT-4o responds | | /dashboard/receipt | Receipt scanner — upload a photo, GPT-4o Vision extracts the data | | /dashboard/goals | Savings goals with progress tracking | | /dashboard/budgets | Category budgets with over-limit alerts |


Architecture

The SDK calls Investec and OpenAI directly using the developer's own credentials — no hosted infrastructure in the trust chain.

Your app
  └── investec-ai SDK
        ├── InvestecClient  →  Investec Open API (your credentials)
        ├── AIFeatures      →  OpenAI API (your key)
        └── createChatHandler → Vercel AI SDK (streaming)

Tech stack

  • SDK: TypeScript, Vercel AI SDK, OpenAI SDK
  • Demo app: Next.js 16, Tailwind CSS, TanStack Query, Recharts, Shiki
  • Monorepo: Turborepo + pnpm workspaces
  • Deployment: Vercel (demo app) · npm (SDK)

License

MIT © Happy Mahlangu