Install the SDK
The SDK is available on npm as@superserve/sdk:
Requirements
- Node.js 18 or later (uses native fetch API)
- TypeScript 5.0+ (optional but recommended)
- React 18+ (only required for React hooks)
Get an API Key
To use the SDK, you need an API key. Generate one using the CLI:~/.config/superserve/token.
You can retrieve your token at any time:
Initialize the Client
Import and create aSuperserve client instance:
Your Superserve API token from
superserve loginBase URL for the Superserve API. Defaults to
https://api.superserve.aiRequest timeout in milliseconds. Defaults to
30000 (30 seconds). Only applies to non-streaming requests.Environment Variables
For production applications, store your API key in an environment variable:Using React Hooks
If you’re using React, import hooks from the/react subpath:
TypeScript Configuration
The SDK is written in TypeScript and includes type definitions. For the best experience, enable strict mode in yourtsconfig.json:
Module Formats
The SDK supports both ESM and CommonJS:Verify Installation
Test your setup by listing available agents:Next Steps
Client Reference
Learn about the Superserve client methods
Streaming
Stream agent responses in real-time