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

# Node.js models and configuration

> Load model weights, inspect SDK versions and configure optional OpenTelemetry export.

**Version:** `@ai-coustics/aic-sdk` 0.24.0, Core SDK 0.24.0. [API index](/reference/sdk/api/node/index) · [Node.js quickstart](/reference/sdk/language-bindings/nodejs).

<span id="node-model" />

## `Model`

Read-only model weights. Use `Model.fromFile`; there is no public constructor. Enhancement, VAD and analysis models are different types. A model can supply multiple independent compatible objects. Those objects retain the weights after this handle is disposed. The file stays memory-mapped until the last dependent object is released; do not change or delete it meanwhile.

<span id="node-model-fromfile" />

### `Model.fromFile`

```typescript theme={null}
static fromFile(path: string): Model
```

`path` names a local `.aicmodel` file. Loads it synchronously and returns a new handle. Throws for an invalid path, filesystem failure, corrupt model or incompatible format. It does not download the model. Keep the file unchanged while any object retains it.

<span id="node-model-dispose" />

### `Model.dispose`

```typescript theme={null}
dispose(): void
```

Releases this handle's native reference synchronously. Idempotent. Instance methods then throw `Model has been disposed`; existing processors, VADs and analyzers retain their own model reference. Static factories remain callable.

<span id="node-model-download" />

### `Model.download`

```typescript theme={null}
static download(modelId: string, downloadDir: string): Promise<string>
```

`modelId` is the exact catalog ID; `downloadDir` is the destination directory, created if needed. Returns a promise for the local path. Work runs on the libuv pool. The downloader resolves a compatible artifact through its manifest/cache and verifies the checksum of an existing file before reuse. It can fetch or refresh metadata and replace an invalid cached file. It can reject for an unknown/incompatible ID, network, checksum or filesystem failure. For a deployment that must load without downloads, provision the file first and use `fromFile`.

<span id="node-model-getid" />

### `Model.getId`

```typescript theme={null}
getId(): string
```

Returns the loaded model's identifier, which can include build and format suffixes beyond the requested download ID. Use it when recording an evaluation. Throws after disposal.

<span id="node-model-getoptimalsamplerate" />

### `Model.getOptimalSampleRate`

```typescript theme={null}
getOptimalSampleRate(): number
```

Returns the model's native rate in Hz as a JavaScript number. Throws after disposal. Native frequency coverage does not expand when host input is resampled from a higher rate.

<span id="node-model-getoptimalblocksize" />

### `Model.getOptimalBlockSize`

```typescript theme={null}
getOptimalBlockSize(sampleRate: number): number
```

`sampleRate` is the intended whole-number input rate in Hz. Returns the corresponding optimal mono block length in samples as a JavaScript number. This query does not validate an entire audio configuration; `initialize` does. Throws after disposal.

<span id="node-otelconfig" />

## `OtelConfig`

A TypeScript object interface, not a JavaScript constructor. Accepted by `Processor`, `ProcessorAsync`, `Vad` and `VadAsync`. Supplying it overrides environment-based OpenTelemetry settings for that instance. `Analyzer` has no `otelConfig` argument in this release. This configuration does not replace SDK authentication or usage reporting.

<span id="node-otelconfig-enable" />

### `OtelConfig.enable`

```typescript theme={null}
enable: boolean
```

Required boolean. Enables or disables OpenTelemetry export for this instance. Disabling it does not waive credential or usage-reporting requirements.

<span id="node-otelconfig-sessionid" />

### `OtelConfig.sessionId`

```typescript theme={null}
sessionId?: string
```

Optional string. If omitted, the SDK generates a session identifier. Avoid customer data or secrets in this value.

<span id="node-otelconfig-exportintervalms" />

### `OtelConfig.exportIntervalMs`

```typescript theme={null}
exportIntervalMs?: number
```

Optional nonnegative whole-number interval in milliseconds. Omission or `0` requests the SDK default of 60,000 ms. The wrapper passes a 32-bit unsigned integer to the SDK.

<span id="node-getcompatiblemodelversion" />

## `getCompatibleModelVersion`

```typescript theme={null}
function getCompatibleModelVersion(): number
```

Returns the model-file format version supported by the loaded SDK. This is not a model display version or npm package version. No credential or model is needed.

<span id="node-getversion" />

## `getVersion`

```typescript theme={null}
function getVersion(): string
```

Returns the underlying native SDK version string. It can differ from the npm package version. No credential or model is needed.

## Example

Save as `inspect-model.cjs` and run `node inspect-model.cjs path/to/model.aicmodel` after installing the pinned package. This local inspection needs no SDK key. The output identifies the actual model and its native geometry.

```javascript inspect-model.cjs theme={null}
const { Model, getVersion, getCompatibleModelVersion } = require('@ai-coustics/aic-sdk');

const modelPath = process.argv[2];
if (!modelPath) throw new Error('Usage: node inspect-model.cjs path/to/model.aicmodel');
const model = Model.fromFile(modelPath);
try {
  const sampleRate = model.getOptimalSampleRate();
  console.log({
    sdkVersion: getVersion(),
    modelFormat: getCompatibleModelVersion(),
    modelId: model.getId(),
    sampleRate,
    blockSize: model.getOptimalBlockSize(sampleRate),
  });
} finally {
  model.dispose();
}
```

## Related

[Node.js API index](/reference/sdk/api/node/index) · [Errors and recovery](/reference/sdk/api/node/errors) · [Stream lifecycle](/reference/concepts/streams-and-state).
