> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lucid.foundation/llms.txt
> Use this file to discover all available pages before exploring further.

# TypeScript SDK

> Install and use the generated TypeScript SDK for the LucidLayer API.

# TypeScript SDK

LucidLayer API: LucidLayer Offchain API.

Route groups:

* `/v1/*` — Passports, Match, Run, Receipts, Epochs, Payouts, Compute
* `/health/*` — System health and dependency checks
* `/api/agents/*` — AI Agent MMR, Planner, and Orchestrator

## Installation

```bash theme={null}
npm install raijin-labs-lucid-ai
```

## Quick Start

```typescript theme={null}
import { RaijinLabsLucidAi } from "raijin-labs-lucid-ai";

const sdk = new RaijinLabsLucidAi({
  serverURL: "https://api.lucid.foundation",
});

// Check system health
const health = await sdk.health.checkSystemHealth();
console.log("Status:", health.status);
```

## Authentication

```typescript theme={null}
import { RaijinLabsLucidAi } from "raijin-labs-lucid-ai";

const sdk = new RaijinLabsLucidAi({
  serverURL: "https://api.lucid.foundation",
  // Add API key auth when the endpoint requires it.
  // security: { bearerAuth: process.env.LUCID_API_KEY },
});
```

## Namespaces

| Namespace                                                           | Description                                                                                                      | Operations |
| ------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------: |
| [`sdk.a2a`](/sdks/namespaces/a2a)                                   | Google A2A protocol — agent cards, task submission, and task lifecycle                                           |          6 |
| [`sdk.agents`](/sdks/namespaces/agents)                             | DEPRECATED: Legacy agent MMR orchestration (use AgentDeploy, AgentMirror instead)                                |         19 |
| [`sdk.agentscrosschain`](/sdks/namespaces/agentscrosschain)         | Cross-chain agent operations.                                                                                    |          2 |
| [`sdk.anchoring`](/sdks/namespaces/anchoring)                       | DePIN anchoring control plane — query, verify, and trace artifact anchor records                                 |          5 |
| [`sdk.chains`](/sdks/namespaces/chains)                             | Supported chain and network metadata.                                                                            |          2 |
| [`sdk.compute`](/sdks/namespaces/compute)                           | Compute node heartbeat registration and health monitoring                                                        |          3 |
| [`sdk.crosschain`](/sdks/namespaces/crosschain)                     | EVM multi-chain operations — chain status, ERC-8004 registration, cross-chain reputation and payouts             |          2 |
| [`sdk.deploy`](/sdks/namespaces/deploy)                             | Agent deployment workflows.                                                                                      |          8 |
| [`sdk.disputes`](/sdks/namespaces/disputes)                         | Escrow dispute resolution — open, submit evidence, resolve, appeal                                               |          5 |
| [`sdk.epochs`](/sdks/namespaces/epochs)                             | Epoch lifecycle — creation, finalization, on-chain anchoring, and retry                                          |         12 |
| [`sdk.escrow`](/sdks/namespaces/escrow)                             | Cross-chain escrow lifecycle — create, release, dispute, and query                                               |          4 |
| [`sdk.health`](/sdks/namespaces/health)                             | System health — liveness, readiness, and per-dependency status checks                                            |          7 |
| [`sdk.identity`](/sdks/namespaces/identity)                         | Cross-chain identity bridging — CAIP-10 linking, resolution, and chain discovery                                 |          5 |
| [`sdk.launch`](/sdks/namespaces/launch)                             | Agent launch flows.                                                                                              |          6 |
| [`sdk.match`](/sdks/namespaces/match)                               | Policy-based compute matching and route planning                                                                 |          3 |
| [`sdk.memory`](/sdks/namespaces/memory)                             | Agent memory — episodic, semantic, procedural, entity, trust-weighted, temporal types with hash-chain provenance |         19 |
| [`sdk.mirror`](/sdks/namespaces/mirror)                             | Mirroring and projection operations.                                                                             |          4 |
| [`sdk.modules`](/sdks/namespaces/modules)                           | ERC-7579 module management — install, uninstall, and configure policy/payout modules                             |          5 |
| [`sdk.passports`](/sdks/namespaces/passports)                       | AI asset identity — create, list, update, delete model/compute/tool/dataset/agent passports                      |         15 |
| [`sdk.paymaster`](/sdks/namespaces/paymaster)                       | ERC-4337 gas sponsorship — sponsor transactions, estimate fees, check rates                                      |          3 |
| [`sdk.payments`](/sdks/namespaces/payments)                         | x402 payment configuration — pricing, facilitators, grants, and subscription                                     |         10 |
| [`sdk.payouts`](/sdks/namespaces/payouts)                           | Revenue split calculation and payout execution (basis-point math)                                                |          4 |
| [`sdk.payoutscrosschain`](/sdks/namespaces/payoutscrosschain)       | Cross-chain payout operations.                                                                                   |          2 |
| [`sdk.receipts`](/sdks/namespaces/receipts)                         | Cryptographic receipts — create, verify, and generate MMR inclusion proofs                                       |          7 |
| [`sdk.reputation`](/sdks/namespaces/reputation)                     | Pluggable reputation scoring — algorithms, compute scores, and composite aggregation                             |          3 |
| [`sdk.reputationcrosschain`](/sdks/namespaces/reputationcrosschain) | Cross-chain reputation operations.                                                                               |          5 |
| [`sdk.revenue`](/sdks/namespaces/revenue)                           | Revenue and share accounting.                                                                                    |          3 |
| [`sdk.run`](/sdks/namespaces/run)                                   | OpenAI-compatible inference (chat completions) and model listing                                                 |          2 |
| [`sdk.shares`](/sdks/namespaces/shares)                             | Share token launch and revenue airdrop for fractional AI asset ownership                                         |          3 |
| [`sdk.tba`](/sdks/namespaces/tba)                                   | ERC-6551 Token Bound Accounts — create and query agent wallets                                                   |          2 |
| [`sdk.wallet`](/sdks/namespaces/wallet)                             | Wallet and account helpers.                                                                                      |          4 |
| [`sdk.webhooks`](/sdks/namespaces/webhooks)                         | Deployment webhook receivers — normalizes provider-specific callbacks into deployment events                     |          1 |
| [`sdk.zkml`](/sdks/namespaces/zkml)                                 | Zero-knowledge ML — prove inference, verify proofs, register models on-chain                                     |          4 |

## Supported Runtimes

This SDK is intended to be used in JavaScript runtimes that support ECMAScript 2020 or newer. The SDK uses the following features:

* [Web Fetch API][web-fetch]
* [Web Streams API][web-streams] and in particular `ReadableStream`
* [Async iterables][async-iter] using `Symbol.asyncIterator`

[web-fetch]: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API

[web-streams]: https://developer.mozilla.org/en-US/docs/Web/API/Streams_API

[async-iter]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols

Runtime environments that are explicitly supported are:

* Evergreen browsers which include: Chrome, Safari, Edge, Firefox
* Node.js active and maintenance LTS releases
  * Currently, this is v18 and v20
* Bun v1 and above
* Deno v1.39
  * Note that Deno does not currently have native support for streaming file uploads backed by the filesystem ([issue link][deno-file-streaming])

[deno-file-streaming]: https://github.com/denoland/deno/issues/11018

## Recommended TypeScript compiler options

The following `tsconfig.json` options are recommended for projects using this
SDK in order to get static type support for features like async iterables,
streams and `fetch`-related APIs ([`for await...of`][for-await-of],
[`AbortSignal`][abort-signal], [`Request`][request], [`Response`][response] and
so on):

[for-await-of]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of

[abort-signal]: https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal

[request]: https://developer.mozilla.org/en-US/docs/Web/API/Request

[response]: https://developer.mozilla.org/en-US/docs/Web/API/Response

```jsonc theme={null}
{
  "compilerOptions": {
    "target": "es2020", // or higher
    "lib": ["es2020", "dom", "dom.iterable"]
  }
}
```

While `target` can be set to older ECMAScript versions, it may result in extra,
unnecessary compatibility code being generated if you are not targeting old
runtimes.

## Source

* [SDK repository](https://github.com/lucid-fdn/lucid-ai-sdk/tree/main/typescript)
* [npm package](https://www.npmjs.com/package/raijin-labs-lucid-ai)
* [OpenAPI with code samples](https://raw.githubusercontent.com/lucid-fdn/lucid-ai-sdk/main/openapi-with-code-samples.yaml)
