@anuma/sdk

中文文档
11.4.1发布于 2026/11/06ISCTypeScriptESM + CJS近 30 天下载 10.2万

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

原始使用文档
文档目录13 节
  1. Installation
  2. Testing prereleases
  3. Getting Started
  4. Usage
  5. React Hooks
  6. API Functions
  7. Platforms
  8. Encrypted remote chat storage
  9. iCloud backups
  10. Features
  11. Documentation
  12. Contributing
  13. Tool e2e tests

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/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.

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.

版本与发布记录

@anuma/sdk 共发布 573 个版本,首次发布于 2026/02/12;过去 12 个月发布了 573 个版本。

版本发布日期距今
11.4.1latest2026/11/061 天前
11.4.02026/11/061 天前
11.3.52026/11/062 天前
11.3.42026/11/062 天前
11.3.32026/11/052 天前
11.3.22026/11/052 天前

其他发布通道:next → 9.1.0-next.20261022061528。

关于 @anuma/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.

如何安装 @anuma/sdk?

在项目目录运行 npm install @anuma/sdk,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(^18.0.0 || ^19.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@anuma/sdk 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@anuma/sdk 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@anuma/sdk 可以商用吗?

@anuma/sdk 使用 ISC 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@anuma/sdk 的下载量有多少?

根据 npm 官方下载统计,@anuma/sdk 在 2026/10/06 – 2026/11/04 这 30 天内被下载 101,993 次,日均约 3,400 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@anuma/sdk 还在维护吗?

最新版本 11.4.1 发布于 2026/11/06(1 天前);至今共发布 573 个版本,其中过去 12 个月发布了 573 个;首次发布于 2026/02/12。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。