Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.ai-stats.phaseo.app/llms.txt

Use this file to discover all available pages before exploring further.

SDKs are in very early alpha: We’re working as hard as we can to get them into a stable state. Please bear with us as we iterate rapidly.
The AI Stats TypeScript SDK provides a type-safe, convenient way to interact with the AI Stats Gateway API. Built on top of the OpenAPI specification, it offers full TypeScript support with generated types and a simple client interface.

Features

  • Type-safe: Full TypeScript support with generated types from the OpenAPI spec
  • Simple API: Easy-to-use client with a clean interface
  • Generated code: Automatically generated from the canonical API specification
  • Comprehensive: Covers all Gateway API endpoints

Quick Example

import AIStats from "@ai-stats/sdk";

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

const response = await client.generateText({
	model: "openai/gpt-4o-mini",
	messages: [{ role: "user", content: "Hello, how are you?" }],
});

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

What’s Included

  • AIStats client class for all API interactions
  • Resource-style helpers such as client.models, client.batches, client.videos, and client.asyncJobs
  • Discovery and pricing helpers such as client.getModels(), client.listProviders(), client.getCredits(), client.getActivity(), client.getAnalytics(), client.listEndpoints(), client.listOrganisations(), client.listPricingModels(), client.calculatePricing(), client.listApiKeys(), client.createApiKey(), client.getApiKey(id), client.updateApiKey(id, ...), client.deleteApiKey(id), client.listWorkspaces(), client.getWorkspace(id), client.createWorkspace(...), client.updateWorkspace(id, ...), client.deleteWorkspace(id), and client.getCurrentApiKey()
  • Async-job websocket URL helpers for batch and video lifecycle streams
  • Generated types for all request/response objects
  • Full API coverage including chat completions, models, credits, and more
  • TypeScript definitions for better development experience
Last modified on May 6, 2026