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

# C models and configuration

> Load model data, inspect native audio metadata and configure optional OpenTelemetry.

All functions on this page are from C SDK **0.24.0**, core **0.24.0**. Include `aic.h` and link the matching native library. Start with the [C integration guide](/reference/sdk/language-bindings/c).

The [pointer and error contract](/reference/sdk/api/c/errors-and-types#pointer-contract) applies to every signature below. Error names in prose omit the `AIC_ERROR_CODE_` prefix. There are no default C arguments; optional pointers are stated explicitly.

<span id="AicOtelConfig" />

## AicOtelConfig

```c theme={null}
typedef struct AicOtelConfig {
    bool enable;
    const char *session_id;
    uint32_t export_interval_ms;
} AicOtelConfig;
```

<span id="AicOtelConfig.enable" />

<span id="AicOtelConfig.session_id" />

<span id="AicOtelConfig.export_interval_ms" />

| Field                | Meaning                                                                                                                                             |
| -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| `enable`             | Overrides `AIC_SDK_OTEL_ENABLE` when a config is supplied. `false` disables optional OTel export; it does not disable SDK session telemetry.        |
| `session_id`         | Optional null-terminated session label. `NULL` requests a generated ID. The creation call copies a supplied string; keep it valid during that call. |
| `export_interval_ms` | Positive export interval in milliseconds. Zero keeps the default 60,000 ms interval.                                                                |

Passing `NULL` as the entire config uses environment defaults. Supplying `{false, NULL, 0}` explicitly disables OTel even if the environment enables it. See [OpenTelemetry](/models/get-started/opentelemetry) and [SDK telemetry](/reference/concepts/sdk-telemetry).

<span id="aic_get_sdk_version" />

## aic\_get\_sdk\_version

```c theme={null}
const char *aic_get_sdk_version(void);
```

Returns a borrowed, null-terminated core SDK version string. It has static lifetime: do not modify or free it. This function has no arguments or error return.

<span id="aic_get_compatible_model_version" />

## aic\_get\_compatible\_model\_version

```c theme={null}
uint32_t aic_get_compatible_model_version(void);
```

Returns the model file format version accepted by this core build: 7 for 0.24.0. This is not a model product version. No arguments or error return.

<span id="aic_model_create_from_file" />

## aic\_model\_create\_from\_file

```c theme={null}
enum AicErrorCode aic_model_create_from_file(struct AicModel **model,
                                             const char *file_path);
```

`model` is a writable output slot; `file_path` is a null-terminated UTF-8 path. On success, the slot receives an owned handle. The file is memory-mapped: keep it present and unchanged until the model and every processor, VAD or analyzer derived from it are destroyed. Errors include `NULL_POINTER`, `FILE_PATH_INVALID`, `FILE_SYSTEM_ERROR`, `MODEL_INVALID`, `MODEL_VERSION_UNSUPPORTED` and `MODEL_DATA_UNALIGNED`. Model loading allocates and performs file I/O.

<span id="aic_model_create_from_buffer" />

## aic\_model\_create\_from\_buffer

```c theme={null}
enum AicErrorCode aic_model_create_from_buffer(struct AicModel **model,
                                               const uint8_t *buffer,
                                               size_t buffer_len);
```

`model` is a writable output slot. `buffer` points to `buffer_len` bytes of complete model data, aligned to 64 bytes. Loading borrows the bytes without copying or taking ownership. Keep the allocation alive and unchanged until the model and all derived objects are destroyed, even if you destroy the model handle first. Errors include `NULL_POINTER`, `MODEL_INVALID`, `MODEL_VERSION_UNSUPPORTED` and `MODEL_DATA_UNALIGNED`. Allocates the handle and parses model metadata.

<span id="aic_model_destroy" />

## aic\_model\_destroy

```c theme={null}
void aic_model_destroy(struct AicModel *model);
```

Releases `model`; `NULL` is a no-op. Do not use the handle afterward. Derived processors, VADs and analyzers retain the underlying model through reference counting. A borrowed buffer still belongs to the caller and must outlive those objects. Stop all users of this handle before destroying it. No return value.

<span id="aic_model_get_id" />

## aic\_model\_get\_id

```c theme={null}
const char *aic_model_get_id(const struct AicModel *model);
```

Returns the borrowed, null-terminated UTF-8 model ID for `model`, or `NULL` for a null handle. The string belongs to the model handle and becomes invalid when that handle is destroyed. Copy it if you need it afterward; do not free or modify it.

<span id="aic_model_get_optimal_sample_rate" />

## aic\_model\_get\_optimal\_sample\_rate

```c theme={null}
enum AicErrorCode aic_model_get_optimal_sample_rate(const struct AicModel *model,
                                                    uint32_t *sample_rate);
```

Writes the native model sample rate in Hz to `sample_rate`. `model` and the writable output pointer must be non-null. Returns `SUCCESS` or `NULL_POINTER`. This is a metadata query, not initialization.

<span id="aic_model_get_optimal_block_size" />

## aic\_model\_get\_optimal\_block\_size

```c theme={null}
enum AicErrorCode aic_model_get_optimal_block_size(const struct AicModel *model,
                                                   uint32_t sample_rate,
                                                   size_t *block_size);
```

Writes the model hop size converted to the requested `sample_rate` in Hz into `block_size`, measured in mono samples. `model` and the writable output pointer must be non-null. Returns `SUCCESS` or `NULL_POINTER`; this query does not validate whether the requested rate is supported. Validate rates during initialization. The native rate and optimal block size avoid unnecessary resampling and block buffering.

## Related

[C API index](/reference/sdk/api/c/index) · [C examples](/reference/sdk/examples#c) · [Compatibility](/reference/sdk/compatibility-matrix)

## Example: read model metadata

This helper loads a model and returns its native rate. It does not create a licensed processing session.

```c theme={null}
#include "aic.h"

AicErrorCode read_native_rate(const char *path, uint32_t *rate) {
    AicModel *model = NULL;
    AicErrorCode error = aic_model_create_from_file(&model, path);
    if (error != AIC_ERROR_CODE_SUCCESS) return error;
    error = aic_model_get_optimal_sample_rate(model, rate);
    aic_model_destroy(model);
    return error;
}
```
