Skip to main content

Install the SDK

The SDK is available on npm as @superserve/sdk:
npm install @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:
superserve login
This authenticates with the Superserve platform and creates a token. The token is saved locally at ~/.config/superserve/token. You can retrieve your token at any time:
cat ~/.config/superserve/token
The token will look like:
ss_1234567890abcdef...

Initialize the Client

Import and create a Superserve client instance:
import Superserve from '@superserve/sdk'

const client = new Superserve({
  apiKey: 'ss_...'
})
apiKey
string
required
Your Superserve API token from superserve login
baseUrl
string
Base URL for the Superserve API. Defaults to https://api.superserve.ai
timeout
number
Request 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:
const client = new Superserve({
  apiKey: process.env.SUPERSERVE_API_KEY!
})
Then set it in your deployment environment:
export SUPERSERVE_API_KEY=ss_...

Using React Hooks

If you’re using React, import hooks from the /react subpath:
import { useAgent, SuperserveProvider } from '@superserve/sdk/react'
The React integration has a peer dependency on React 18+. If you only use the core SDK (not React hooks), you don’t need React installed.

TypeScript Configuration

The SDK is written in TypeScript and includes type definitions. For the best experience, enable strict mode in your tsconfig.json:
{
  "compilerOptions": {
    "strict": true,
    "moduleResolution": "bundler",
    "module": "ESNext",
    "target": "ES2022"
  }
}

Module Formats

The SDK supports both ESM and CommonJS:
import Superserve from '@superserve/sdk'

const client = new Superserve({ apiKey: 'ss_...' })

Verify Installation

Test your setup by listing available agents:
import Superserve from '@superserve/sdk'

const client = new Superserve({
  apiKey: process.env.SUPERSERVE_API_KEY!
})

const agents = await client.agents.list()
console.log('Available agents:', agents.map(a => a.name))
If you see your deployed agents, you’re ready to start building!

Next Steps

Client Reference

Learn about the Superserve client methods

Streaming

Stream agent responses in real-time

Build docs developers (and LLMs) love