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

# Configuration

> Initialization, models, and events

## Initializing

```dart theme={"theme":"css-variables"}
await RunAnywhere.initialize(apiKey: '', baseUrl: '');
```

```dart theme={"theme":"css-variables"}
static Future<void> initialize({
  String? apiKey,
  String? baseUrl,
  SDKEnvironment environment = SDKEnvironment.SDK_ENVIRONMENT_PRODUCTION,
})
```

Named arguments, not an options object. Concurrent calls share one in-flight future rather
than initializing twice.

## Reading state

| Accessor | Type | Meaning |
| - | - | - |
| `RunAnywhere.isReady` | `bool` | Local inference is usable |
| `RunAnywhere.version` | `String` | SDK version |
| `RunAnywhere.deviceId` | `String` | Stable per-install identifier |
| `RunAnywhere.events` | `Stream<SdkEvent>` | Lifecycle and error breadcrumbs |

## Capabilities

```dart theme={"theme":"css-variables"}
final capabilities = RunAnywhere.capabilities();   // synchronous
```

## Models

```dart theme={"theme":"css-variables"}
final models = await RunAnywhere.models.list();
final model = await RunAnywhere.models.get('qwen3-0.6b');

await for (final event in RunAnywhere.models.download('qwen3-0.6b')) {
  if (event is DownloadEventProgress) {
    setState(() => _progress = event.fraction ?? 0);
  }
}

final loaded = await RunAnywhere.models.load('qwen3-0.6b');
await RunAnywhere.models.unload('qwen3-0.6b');
await RunAnywhere.models.unloadAll();
await RunAnywhere.models.delete('qwen3-0.6b');
await RunAnywhere.models.register(registration);
await RunAnywhere.models.unregister('qwen3-0.6b');

final state = await RunAnywhere.models.state();
await RunAnywhere.models.refresh();
```

> [!NOTE]
>
> `list` and `unloadAll` take **positional optional** parameters, so it is `list(filter)` and
> `unloadAll(category)`, not `list(filter: filter)`.

```dart theme={"theme":"css-variables"}
final filtered = await RunAnywhere.models.list(someFilter);
await RunAnywhere.models.unloadAll(ModelCategory.MODEL_CATEGORY_LANGUAGE);
```

You rarely need `load` directly. Generation auto-loads what it needs and downloads when
`options.model` names a model that is absent.

## LoRA

```dart theme={"theme":"css-variables"}
await RunAnywhere.lora.apply('legal-summarizer', scale: 0.8);
await RunAnywhere.lora.remove('legal-summarizer');
await RunAnywhere.lora.removeAll();
```

`remove` takes a positional optional adapter id; omit it to remove the current one.

## Hugging Face token

```dart theme={"theme":"css-variables"}
RunAnywhere.setHfToken(token);
```

Needed for gated or private repositories. Hold it in secure storage, never in source.

## Events

```dart theme={"theme":"css-variables"}
final subscription = RunAnywhere.events.listen((event) {
  // lifecycle, model, and error breadcrumbs
});

// later
await subscription.cancel();
```

Cancel the subscription in `dispose`.

## Resetting

```dart theme={"theme":"css-variables"}
await RunAnywhere.reset();
```

Unloads models, closes sessions, and clears state. Like `initialize`, concurrent calls share
one in-flight future.


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