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

# Receipts SDK

> Cryptographic receipts — create, verify, and generate MMR inclusion proofs

# Receipts SDK

Cryptographic receipts — create, verify, and generate MMR inclusion proofs

## Operations

| Method                     | Description                                                |
| -------------------------- | ---------------------------------------------------------- |
| `create`                   | Create a receipt                                           |
| `get`                      | Get a receipt                                              |
| `verify`                   | Verify a receipt (hash + signature + inclusion)            |
| `getProof`                 | Get inclusion proof for receipt                            |
| `lucidVerifyReceiptByHash` | Verify receipt by hash with inclusion proof and epoch info |
| `getMmrRoot`               | Get current MMR root                                       |
| `getSignerPubKey`          | Get orchestrator signing public key                        |

## Generated Reference

### Overview

Cryptographic receipts — create, verify, and generate MMR inclusion proofs

#### Available Operations

* [create](#create) - Create a receipt
* [get](#get) - Get a receipt
* [verify](#verify) - Verify a receipt (hash + signature + inclusion)
* [getProof](#getproof) - Get inclusion proof for receipt
* [lucidVerifyReceiptByHash](#lucidverifyreceiptbyhash) - Verify receipt by hash with inclusion proof and epoch info
* [getMmrRoot](#getmmrroot) - Get current MMR root
* [getSignerPubKey](#getsignerpubkey) - Get orchestrator signing public key

### create

Create a new cryptographic receipt for a completed inference run and append it to the Merkle Mountain Range. The receipt is Ed25519-signed by the orchestrator and includes timing metrics.

#### Example Usage

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

const raijinLabsLucidAi = new RaijinLabsLucidAi();

async function run() {
  const result = await raijinLabsLucidAi.receipts.create({
    modelPassportId: "ppt_model_7xK9mQ2v",
    computePassportId: "ppt_compute_Xn5vR2kJ",
    policyHash: "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
    runtime: "vllm",
    tokensIn: 42,
    tokensOut: 128,
    ttftMs: 85,
    totalLatencyMs: 1200,
  });

  console.log(result);
}

run();
```

#### Standalone function

The standalone function version of this method:

```typescript theme={null}
import { RaijinLabsLucidAiCore } from "raijin-labs-lucid-ai/core.js";
import { receiptsCreate } from "raijin-labs-lucid-ai/funcs/receiptsCreate.js";

// Use `RaijinLabsLucidAiCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const raijinLabsLucidAi = new RaijinLabsLucidAiCore();

async function run() {
  const res = await receiptsCreate(raijinLabsLucidAi, {
    modelPassportId: "ppt_model_7xK9mQ2v",
    computePassportId: "ppt_compute_Xn5vR2kJ",
    policyHash: "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
    runtime: "vllm",
    tokensIn: 42,
    tokensOut: 128,
    ttftMs: 85,
    totalLatencyMs: 1200,
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("receiptsCreate failed:", res.error);
  }
}

run();
```

#### Parameters

| Parameter              | Type                                                                                                                              | Required             | Description                                                                                                                                                                    |
| ---------------------- | --------------------------------------------------------------------------------------------------------------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `request`              | [models.CreateReceiptRequest](https://github.com/lucid-fdn/lucid-ai-sdk/blob/main/typescript/docs/models/createreceiptrequest.md) | :heavy\_check\_mark: | The request object to use for the request.                                                                                                                                     |
| `options`              | RequestOptions                                                                                                                    | :heavy\_minus\_sign: | Used to set various options for making HTTP requests.                                                                                                                          |
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options)                                           | :heavy\_minus\_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
| `options.retries`      | [RetryConfig](https://github.com/lucid-fdn/lucid-ai-sdk/blob/main/typescript/docs/lib/utils/retryconfig.md)                       | :heavy\_minus\_sign: | Enables retrying HTTP requests under certain failure conditions.                                                                                                               |

#### Response

**Promise\<[operations.LucidCreateReceiptResponse](https://github.com/lucid-fdn/lucid-ai-sdk/blob/main/typescript/docs/models/operations/lucidcreatereceiptresponse.md)>**

#### Errors

| Error Type                           | Status Code | Content Type     |
| ------------------------------------ | ----------- | ---------------- |
| errors.ErrorResponse                 | 400         | application/json |
| errors.ErrorResponse                 | 500         | application/json |
| errors.RaijinLabsLucidAiDefaultError | 4XX, 5XX    | \*/\*            |

### get

Retrieve a single receipt by its UUID, including the receipt hash, Ed25519 signature, signer public key, and inference metrics (tokens, latency, TTFT).

#### Example Usage

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

const raijinLabsLucidAi = new RaijinLabsLucidAi();

async function run() {
  const result = await raijinLabsLucidAi.receipts.get({
    receiptId: "<id>",
  });

  console.log(result);
}

run();
```

#### Standalone function

The standalone function version of this method:

```typescript theme={null}
import { RaijinLabsLucidAiCore } from "raijin-labs-lucid-ai/core.js";
import { receiptsGet } from "raijin-labs-lucid-ai/funcs/receiptsGet.js";

// Use `RaijinLabsLucidAiCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const raijinLabsLucidAi = new RaijinLabsLucidAiCore();

async function run() {
  const res = await receiptsGet(raijinLabsLucidAi, {
    receiptId: "<id>",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("receiptsGet failed:", res.error);
  }
}

run();
```

#### Parameters

| Parameter              | Type                                                                                                                                                 | Required             | Description                                                                                                                                                                    |
| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `request`              | [operations.LucidGetReceiptRequest](https://github.com/lucid-fdn/lucid-ai-sdk/blob/main/typescript/docs/models/operations/lucidgetreceiptrequest.md) | :heavy\_check\_mark: | The request object to use for the request.                                                                                                                                     |
| `options`              | RequestOptions                                                                                                                                       | :heavy\_minus\_sign: | Used to set various options for making HTTP requests.                                                                                                                          |
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options)                                                              | :heavy\_minus\_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
| `options.retries`      | [RetryConfig](https://github.com/lucid-fdn/lucid-ai-sdk/blob/main/typescript/docs/lib/utils/retryconfig.md)                                          | :heavy\_minus\_sign: | Enables retrying HTTP requests under certain failure conditions.                                                                                                               |

#### Response

**Promise\<[operations.LucidGetReceiptResponse](https://github.com/lucid-fdn/lucid-ai-sdk/blob/main/typescript/docs/models/operations/lucidgetreceiptresponse.md)>**

#### Errors

| Error Type                           | Status Code | Content Type     |
| ------------------------------------ | ----------- | ---------------- |
| errors.ErrorResponse                 | 404         | application/json |
| errors.ErrorResponse                 | 500         | application/json |
| errors.RaijinLabsLucidAiDefaultError | 4XX, 5XX    | \*/\*            |

### verify

Verify a receipt's integrity by checking its SHA-256 hash against the canonical JSON content, validating the Ed25519 signature, and confirming MMR inclusion. Returns per-check pass/fail status.

#### Example Usage

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

const raijinLabsLucidAi = new RaijinLabsLucidAi();

async function run() {
  const result = await raijinLabsLucidAi.receipts.verify({
    receiptId: "<id>",
  });

  console.log(result);
}

run();
```

#### Standalone function

The standalone function version of this method:

```typescript theme={null}
import { RaijinLabsLucidAiCore } from "raijin-labs-lucid-ai/core.js";
import { receiptsVerify } from "raijin-labs-lucid-ai/funcs/receiptsVerify.js";

// Use `RaijinLabsLucidAiCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const raijinLabsLucidAi = new RaijinLabsLucidAiCore();

async function run() {
  const res = await receiptsVerify(raijinLabsLucidAi, {
    receiptId: "<id>",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("receiptsVerify failed:", res.error);
  }
}

run();
```

#### Parameters

| Parameter              | Type                                                                                                                                                       | Required             | Description                                                                                                                                                                    |
| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `request`              | [operations.LucidVerifyReceiptRequest](https://github.com/lucid-fdn/lucid-ai-sdk/blob/main/typescript/docs/models/operations/lucidverifyreceiptrequest.md) | :heavy\_check\_mark: | The request object to use for the request.                                                                                                                                     |
| `options`              | RequestOptions                                                                                                                                             | :heavy\_minus\_sign: | Used to set various options for making HTTP requests.                                                                                                                          |
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options)                                                                    | :heavy\_minus\_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
| `options.retries`      | [RetryConfig](https://github.com/lucid-fdn/lucid-ai-sdk/blob/main/typescript/docs/lib/utils/retryconfig.md)                                                | :heavy\_minus\_sign: | Enables retrying HTTP requests under certain failure conditions.                                                                                                               |

#### Response

**Promise\<[models.ReceiptVerification](https://github.com/lucid-fdn/lucid-ai-sdk/blob/main/typescript/docs/models/receiptverification.md)>**

#### Errors

| Error Type                           | Status Code | Content Type     |
| ------------------------------------ | ----------- | ---------------- |
| errors.ErrorResponse                 | 404         | application/json |
| errors.ErrorResponse                 | 500         | application/json |
| errors.RaijinLabsLucidAiDefaultError | 4XX, 5XX    | \*/\*            |

### getProof

Retrieve the MMR inclusion proof for a receipt, containing the sibling hashes needed to verify the receipt's membership in the Merkle Mountain Range.

#### Example Usage

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

const raijinLabsLucidAi = new RaijinLabsLucidAi();

async function run() {
  const result = await raijinLabsLucidAi.receipts.getProof({
    receiptId: "<id>",
  });

  console.log(result);
}

run();
```

#### Standalone function

The standalone function version of this method:

```typescript theme={null}
import { RaijinLabsLucidAiCore } from "raijin-labs-lucid-ai/core.js";
import { receiptsGetProof } from "raijin-labs-lucid-ai/funcs/receiptsGetProof.js";

// Use `RaijinLabsLucidAiCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const raijinLabsLucidAi = new RaijinLabsLucidAiCore();

async function run() {
  const res = await receiptsGetProof(raijinLabsLucidAi, {
    receiptId: "<id>",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("receiptsGetProof failed:", res.error);
  }
}

run();
```

#### Parameters

| Parameter              | Type                                                                                                                                                           | Required             | Description                                                                                                                                                                    |
| ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `request`              | [operations.LucidGetReceiptProofRequest](https://github.com/lucid-fdn/lucid-ai-sdk/blob/main/typescript/docs/models/operations/lucidgetreceiptproofrequest.md) | :heavy\_check\_mark: | The request object to use for the request.                                                                                                                                     |
| `options`              | RequestOptions                                                                                                                                                 | :heavy\_minus\_sign: | Used to set various options for making HTTP requests.                                                                                                                          |
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options)                                                                        | :heavy\_minus\_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
| `options.retries`      | [RetryConfig](https://github.com/lucid-fdn/lucid-ai-sdk/blob/main/typescript/docs/lib/utils/retryconfig.md)                                                    | :heavy\_minus\_sign: | Enables retrying HTTP requests under certain failure conditions.                                                                                                               |

#### Response

**Promise\<[operations.LucidGetReceiptProofResponse](https://github.com/lucid-fdn/lucid-ai-sdk/blob/main/typescript/docs/models/operations/lucidgetreceiptproofresponse.md)>**

#### Errors

| Error Type                           | Status Code | Content Type     |
| ------------------------------------ | ----------- | ---------------- |
| errors.ErrorResponse                 | 404         | application/json |
| errors.ErrorResponse                 | 500         | application/json |
| errors.RaijinLabsLucidAiDefaultError | 4XX, 5XX    | \*/\*            |

### lucidVerifyReceiptByHash

Verify a receipt using its 64-character hex hash. Returns the inclusion proof, on-chain anchoring status, and epoch information. This is the primary verification endpoint for the Fluid Compute protocol.

#### Example Usage

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

const raijinLabsLucidAi = new RaijinLabsLucidAi();

async function run() {
  const result = await raijinLabsLucidAi.receipts.lucidVerifyReceiptByHash({
    receiptHash: "<value>",
  });

  console.log(result);
}

run();
```

#### Standalone function

The standalone function version of this method:

```typescript theme={null}
import { RaijinLabsLucidAiCore } from "raijin-labs-lucid-ai/core.js";
import { receiptsLucidVerifyReceiptByHash } from "raijin-labs-lucid-ai/funcs/receiptsLucidVerifyReceiptByHash.js";

// Use `RaijinLabsLucidAiCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const raijinLabsLucidAi = new RaijinLabsLucidAiCore();

async function run() {
  const res = await receiptsLucidVerifyReceiptByHash(raijinLabsLucidAi, {
    receiptHash: "<value>",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("receiptsLucidVerifyReceiptByHash failed:", res.error);
  }
}

run();
```

#### Parameters

| Parameter              | Type                                                                                                                                                                   | Required             | Description                                                                                                                                                                    |
| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `request`              | [operations.LucidVerifyReceiptByHashRequest](https://github.com/lucid-fdn/lucid-ai-sdk/blob/main/typescript/docs/models/operations/lucidverifyreceiptbyhashrequest.md) | :heavy\_check\_mark: | The request object to use for the request.                                                                                                                                     |
| `options`              | RequestOptions                                                                                                                                                         | :heavy\_minus\_sign: | Used to set various options for making HTTP requests.                                                                                                                          |
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options)                                                                                | :heavy\_minus\_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
| `options.retries`      | [RetryConfig](https://github.com/lucid-fdn/lucid-ai-sdk/blob/main/typescript/docs/lib/utils/retryconfig.md)                                                            | :heavy\_minus\_sign: | Enables retrying HTTP requests under certain failure conditions.                                                                                                               |

#### Response

**Promise\<[models.ReceiptHashVerification](https://github.com/lucid-fdn/lucid-ai-sdk/blob/main/typescript/docs/models/receipthashverification.md)>**

#### Errors

| Error Type                           | Status Code | Content Type     |
| ------------------------------------ | ----------- | ---------------- |
| errors.ErrorResponse                 | 400, 404    | application/json |
| errors.ErrorResponse                 | 500         | application/json |
| errors.RaijinLabsLucidAiDefaultError | 4XX, 5XX    | \*/\*            |

### getMmrRoot

Retrieve the current global MMR root hash and total leaf count. The root is recomputed via right-to-left peak bagging after each receipt append.

#### Example Usage

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

const raijinLabsLucidAi = new RaijinLabsLucidAi();

async function run() {
  const result = await raijinLabsLucidAi.receipts.getMmrRoot();

  console.log(result);
}

run();
```

#### Standalone function

The standalone function version of this method:

```typescript theme={null}
import { RaijinLabsLucidAiCore } from "raijin-labs-lucid-ai/core.js";
import { receiptsGetMmrRoot } from "raijin-labs-lucid-ai/funcs/receiptsGetMmrRoot.js";

// Use `RaijinLabsLucidAiCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const raijinLabsLucidAi = new RaijinLabsLucidAiCore();

async function run() {
  const res = await receiptsGetMmrRoot(raijinLabsLucidAi);
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("receiptsGetMmrRoot failed:", res.error);
  }
}

run();
```

#### Parameters

| Parameter              | Type                                                                                                        | Required             | Description                                                                                                                                                                    |
| ---------------------- | ----------------------------------------------------------------------------------------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `options`              | RequestOptions                                                                                              | :heavy\_minus\_sign: | Used to set various options for making HTTP requests.                                                                                                                          |
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options)                     | :heavy\_minus\_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
| `options.retries`      | [RetryConfig](https://github.com/lucid-fdn/lucid-ai-sdk/blob/main/typescript/docs/lib/utils/retryconfig.md) | :heavy\_minus\_sign: | Enables retrying HTTP requests under certain failure conditions.                                                                                                               |

#### Response

**Promise\<[operations.LucidGetMmrRootResponse](https://github.com/lucid-fdn/lucid-ai-sdk/blob/main/typescript/docs/models/operations/lucidgetmmrrootresponse.md)>**

#### Errors

| Error Type                           | Status Code | Content Type     |
| ------------------------------------ | ----------- | ---------------- |
| errors.ErrorResponse                 | 500         | application/json |
| errors.RaijinLabsLucidAiDefaultError | 4XX, 5XX    | \*/\*            |

### getSignerPubKey

Retrieve the Ed25519 public key used by the orchestrator to sign receipts. Clients use this key to independently verify receipt signatures offline.

#### Example Usage

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

const raijinLabsLucidAi = new RaijinLabsLucidAi();

async function run() {
  const result = await raijinLabsLucidAi.receipts.getSignerPubKey();

  console.log(result);
}

run();
```

#### Standalone function

The standalone function version of this method:

```typescript theme={null}
import { RaijinLabsLucidAiCore } from "raijin-labs-lucid-ai/core.js";
import { receiptsGetSignerPubKey } from "raijin-labs-lucid-ai/funcs/receiptsGetSignerPubKey.js";

// Use `RaijinLabsLucidAiCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const raijinLabsLucidAi = new RaijinLabsLucidAiCore();

async function run() {
  const res = await receiptsGetSignerPubKey(raijinLabsLucidAi);
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("receiptsGetSignerPubKey failed:", res.error);
  }
}

run();
```

#### Parameters

| Parameter              | Type                                                                                                        | Required             | Description                                                                                                                                                                    |
| ---------------------- | ----------------------------------------------------------------------------------------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `options`              | RequestOptions                                                                                              | :heavy\_minus\_sign: | Used to set various options for making HTTP requests.                                                                                                                          |
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options)                     | :heavy\_minus\_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
| `options.retries`      | [RetryConfig](https://github.com/lucid-fdn/lucid-ai-sdk/blob/main/typescript/docs/lib/utils/retryconfig.md) | :heavy\_minus\_sign: | Enables retrying HTTP requests under certain failure conditions.                                                                                                               |

#### Response

**Promise\<[operations.LucidGetSignerPubkeyResponse](https://github.com/lucid-fdn/lucid-ai-sdk/blob/main/typescript/docs/models/operations/lucidgetsignerpubkeyresponse.md)>**

#### Errors

| Error Type                           | Status Code | Content Type     |
| ------------------------------------ | ----------- | ---------------- |
| errors.ErrorResponse                 | 500         | application/json |
| errors.RaijinLabsLucidAiDefaultError | 4XX, 5XX    | \*/\*            |
