Skip to content

Install

neuro-ts is published to npm. It ships ESM, CJS, an IIFE bundle for direct script tags, and full TypeScript types.

$ npm install neuro-ts
RuntimeMinimum
Node18.18
Bun1.0
Modern browsersES2022

The openai SDK is a runtime dependency. It is not bundled into the ESM/CJS outputs (treeshaking-friendly). It is inlined into the IIFE bundle so a single script tag works on a static page.

<script src="https://unpkg.com/neuro-ts/dist/neuro-ts.iife.js"></script>
<script>
NeuroTS.configureClient({
tokenProvider: () => fetch('/api/neuro-token').then((r) => r.text()),
});
NeuroTS.neuro.array
.map({ array: ['a', 'b'], callbackfn: (s) => s, prompt: 'uppercase each' })
.then(console.log);
</script>
import { configureClient, neuro } from 'neuro-ts';
configureClient({ apiKey: process.env.OPENAI_API_KEY });
console.log(await neuro.math.random({}));