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

# SDK configuration

> Configure the server client and React helpers.

## Server client

```ts theme={null}
import { createDigitalHumanClient } from "digital-human/server";

const client = createDigitalHumanClient({
  apiKey: process.env.DIGITAL_HUMAN_API_KEY!,
  baseUrl: "https://api.livefaces.ai",
});
```

Set the canonical production origin explicitly to `https://api.livefaces.ai`.
Older client defaults use the redirecting `https://api.lagena.ai` origin.

### Custom API origin

Authorized integrations can supply a different absolute HTTP origin without
changing application code:

```ts theme={null}
const client = createDigitalHumanClient({
  apiKey: process.env.DIGITAL_HUMAN_API_KEY!,
  baseUrl: process.env.DIGITAL_HUMAN_BASE_URL ?? "https://api.livefaces.ai",
});
```

Keep the explicit canonical origin when no override is configured. The SDK does
not expose environment names or environment-specific constants.

### Custom fetch

Pass `fetch` when your server runtime needs an instrumented or compatible
implementation:

```ts theme={null}
const client = createDigitalHumanClient({
  apiKey,
  fetch: tracedFetch,
});
```

The injected function must follow the standard Fetch API contract.

## Client methods

| Method | Purpose |
| - | - |
| `inspectApiKey()` | Return the key ID, organization ID, scopes, and expiry |
| `createSession(options)` | Create or safely retry a session |
| `getSession(sessionId)` | Read state and obtain a fresh token when connectable |
| `endSession(sessionId)` | End a session and return its terminal state |

All methods accept an optional `AbortSignal`. `createSession` receives the
signal inside its options object.

## React room

`DigitalHumanRoom` maps a `SessionConnection` to LiveKit's room provider:

```tsx theme={null}
<DigitalHumanRoom
  connection={connection}
  audio={true}
  video={true}
  onError={(error) => reportCallError(error)}
>
  {children}
</DigitalHumanRoom>
```

It enables adaptive streaming and dynacast, renders remote room audio, and
publishes the local camera and microphone by default. Set `renderAudio={false}`
only when a child component renders room audio itself.

All other supported props pass through to LiveKit's room component.

## Digital-human video

`DigitalHumanVideo` selects a remote camera track and never selects the local
participant:

```tsx theme={null}
<DigitalHumanVideo
  participantIdentity="optional-known-identity"
  fallback={<p>Waiting…</p>}
  className="avatar"
/>
```

Use `useDigitalHumanTrack()` when you need to render the selected track with a
custom LiveKit component.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.