Skip to main content

Installation

Install the SDK using npm or yarn:
npm install @ai-stats/ts-sdk
or
yarn add @ai-stats/ts-sdk

Requirements

  • Node.js 18+
  • TypeScript 4.5+ (for type definitions)

Setup

API Key

You’ll need an AI Stats API key to use the SDK. Get one from the AI Stats Dashboard.

Environment Variables

Set your API key as an environment variable:
export AI_STATS_API_KEY="your-api-key-here"

Basic Usage

import { AIStats } from "@ai-stats/ts-sdk";

// Initialize the client
const client = new AIStats({
	apiKey: process.env.AI_STATS_API_KEY!,
});

// Make your first request
const response = await client.generateText({
	model: "openai/gpt-4o-mini",
	messages: [{ role: "user", content: "Hello!" }],
});

console.log(response.choices[0].message.content);

Next Steps