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

# SDK Examples

> Generated examples for common Lucid SDK usage.

# SDK Examples

These examples are rebuilt from the current generated TypeScript SDK docs.

## Inference Example

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

const raijinLabsLucidAi = new RaijinLabsLucidAi();

async function run() {
  const result = await raijinLabsLucidAi.run.chatCompletions({
    body: {
      model: "mistral-7b-instruct",
      messages: [
        {
          role: "system",
          content: "You are a helpful AI assistant.",
        },
        {
          role: "user",
          content: "Explain how MMR proofs work in one paragraph.",
        },
      ],
      maxTokens: 256,
      temperature: 0.7,
    },
  });

  console.log(result);
}

run();
```

## Standalone Function Example

Standalone functions are useful for browser, edge, and serverless bundles where tree-shaking matters.

```typescript theme={null}
import { RaijinLabsLucidAiCore } from "raijin-labs-lucid-ai/core.js";
import { runChatCompletions } from "raijin-labs-lucid-ai/funcs/runChatCompletions.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 runChatCompletions(raijinLabsLucidAi, {
    body: {
      model: "mistral-7b-instruct",
      messages: [
        {
          role: "system",
          content: "You are a helpful AI assistant.",
        },
        {
          role: "user",
          content: "Explain how MMR proofs work in one paragraph.",
        },
      ],
      maxTokens: 256,
      temperature: 0.7,
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("runChatCompletions failed:", res.error);
  }
}

run();
```

## More Examples

* [Full TypeScript SDK overview](/sdks/typescript)
* [Namespace reference](/sdks/reference)
* [Generated SDK source](https://github.com/lucid-fdn/lucid-ai-sdk/tree/main/typescript)
