Skip to Content
Anuma SDKAnuma SDK

Anuma SDK

A TypeScript SDK for building AI-powered applications with streaming chat completions, long-term memory, tool calling, and end-to-end encryption.

To learn more, check out the Documentation .

Installation

npm install @anuma/sdk

Testing prereleases

Stable releases go to the default latest tag (the command above). Prerelease builds for trying out unreleased changes are published to the next tag — install them explicitly:

npm install @anuma/sdk@next

These carry a X.Y.Z-next.<timestamp> version and never affect latest. Maintainers publish them on demand via the Publish Next (prerelease) GitHub Actions workflow.

Getting Started

Create an app on the Anuma Dashboard  to get your API key or configure Privy authentication.

Usage

React Hooks

import { useChat } from "@anuma/sdk/react"; const { sendMessage, isLoading, stop } = useChat({ getToken: async () => token, onData: (chunk) => console.log(chunk), }); await sendMessage({ messages: [{ role: "user", content: [{ type: "text", text: "Hello!" }] }], model: "fireworks/accounts/fireworks/models/kimi-k2p5", });

API Functions

import { postApiV1Responses } from "@anuma/sdk/client"; const response = await postApiV1Responses({ body: { messages: [ { role: "user", content: [{ type: "text", text: "Hello!" }] }, ], model: "fireworks/accounts/fireworks/models/kimi-k2p5", }, headers: { Authorization: `Bearer ${apiKey}`, }, });

Platforms

The SDK provides entry points for different platforms:

  • @anuma/sdk/react — React hooks
  • @anuma/sdk/react/chart — Recharts chart primitives (ChartContainer, ChartTooltip, ChartLegend, …); needs the optional recharts peer
  • @anuma/sdk/expo — React Native / Expo
  • @anuma/sdk/client — Generated API client and types

Encrypted remote chat storage

createRemoteChatStore is available from the main, React and Expo entry points. Pass the account’s canonical keyId and memoryCipher callbacks, the Nearby base URL and an authenticated getToken. The store encrypts each complete JSON record, including titles, messages, tool events, attachment references and vectors. It preserves routing/order metadata in an authenticated envelope and binds every request to the account that opened the store. The server never receives the content key.

get, list and putMany always use the server. Creates use expectedVersion: 0; edits and tombstones use the returned version. Conflicts and ambiguous network outcomes are surfaced to the caller without automatic write retries. Use AbortSignal to cancel work when its account or screen changes. Failed decryption rejects the read rather than returning an empty history.

Records have kinds conversation, message, summary, project and memory_links; data contains complete JSON-compatible fields, with dates serialized explicitly. Create the conversation before its children. Follow nextCursor for complete lists. Batches accept at most 25 records and 8 MiB of ciphertext; each record accepts 2 MiB. Existing useChatStorage hooks still use their current local persistence until the separate verified app migration lands. See the migration epic .

Chat cache adapters

createVaultChatBackend uses ChatCacheStorage for the account manifest and separate sealed cache entries. The manifest key is the account string. Entry keys use <account>/chat-cache/<uuid> and change when the corresponding records change. Conversation records share one index entry. Each cached thread uses a separate entry. The SDK reads and decrypts at most 16 entries at a time.

Integration: Treat each get and set argument as an exact storage key. Keep distinct keys in distinct records. Return null when a key does not exist. Make each set operation atomic. Remove only the specified key when sealed is null. Adapters that validate wallet addresses, retain one value per account, or ignore the key require updates.

Breaking changes: set(account, null) removes only the manifest. Call backend.clearCache() on logout or account changes to remove the manifest and its referenced entries. The SDK still reads the previous snapshot cache format and converts it on the next save.

Cached threads contain at most 200 messages. Reads can serve this partial history offline. clearMessages rejects with history_incomplete until the backend loads the full thread.

iCloud backups

Add a backupRevision field with type String to the ConversationBackup record type in the development schema. Deploy the schema to production  before you release a client that uses iCloud backup.

The SDK compares this saved revision with the local conversation and message data. The next backup replaces older files that have no saved revision.

Features

The SDK gives you access to a unified API across multiple LLM providers through a single integration. Key capabilities include:

  • Streaming chat completions with tool calling and auto-execution
  • Extended thinking and reasoning support
  • Long-term memory with semantic search and encrypted storage
  • Best-effort client-side PII redaction (see PII_REDACTION.md)
  • Voice recording and transcription via Whisper
  • PDF and image text extraction (OCR)
  • Phone call integration
  • End-to-end encryption with wallet-based key management
  • Credit and subscription management

Documentation

https://docs.anuma.ai/ 

Contributing

Contributions are welcome. Please open an issue or pull request on GitHub .

Before opening a PR, run pnpm test and pnpm check.

Tool e2e tests

pnpm e2e:tools runs the live-model tests in test/tools/ and test/classifier/ (vitest.e2e.config.mts) against a real portal. Copy .env.example to .env and set PORTAL_API_KEY (and ANUMA_API_URL to point at a portal other than dev). Pass a file-name filter to run a subset:

pnpm e2e:tools # everything pnpm e2e:tools weather # test/tools/weather.ts only

CI runs the same suite on PRs that touch the tool code (see the changes job in .github/workflows/e2e-tools.yml for the exact paths) and again in the merge queue. PRs without access to the PORTAL_API_KEY secret (forks, Dependabot) skip it and get their result in the queue. On a PR the result is advisory; the queue run is the one that blocks.

Modules

ModuleDescription
client-
expoReact Native hooks for building AI-powered mobile applications.
nextNext.js configuration plugin for @anuma/sdk
reactThe @anuma/sdk/react package provides a collection of React hooks designed to simplify building AI features in your applications. These hooks abstract away the complexity of managing streaming responses, loading states, authentication, and real-time updates, letting you focus on creating great user experiences.
react/chart-
vercelHelper utilities for integrating the useChat hook and Vercel AI Elements .
Last updated on