Skip to main content

Installation

The NuRoute JavaScript SDK works in Node.js (18+) and modern browsers. It uses the native fetch API, so no polyfills are needed in Node 18+.

GitHub

Install​

npm install @aicp/sdk
# or
yarn add @aicp/sdk
# or
pnpm add @aicp/sdk

Basic setup​

import { NuRouteClient } from '@aicp/sdk';

const client = new NuRouteClient({
apiKey: 'aicp-...', // your API key
baseUrl: 'https://your-gateway', // NuRoute gateway URL
timeout: 30_000, // request timeout in ms (default: 30 000)
});
OptionTypeDefaultDescription
apiKeystringnoneBearer token. Can be omitted and set later with client.setApiKey().
baseUrlstringhttp://localhost:3000NuRoute gateway base URL.
timeoutnumber30000Request timeout in milliseconds.

Update the API key at runtime​

After a login or signup call you receive a session JWT. You can apply it without creating a new client:

const { token } = await client.auth.login({ email, password });
client.setApiKey(token);