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

# Quick Start

> A working window

## 1. Construct the facade

```ts main.ts theme={null}
import { createRunAnywhere, NativeBackend } from '@runanywhere/electron'

const RunAnywhere = createRunAnywhere(new NativeBackend())
await RunAnywhere.initialize()
```

`initialize()` is single-phase here: one call, no second services phase to await.

```ts theme={null}
interface InitializeOptions {
  apiKey?: string
  baseUrl?: string
  environment?: Environment
}
```

## 2. Generate text

```ts theme={null}
const result = await RunAnywhere.llm.generate('Explain on-device AI in one sentence', {
  model: 'qwen3-0.6b',
  maxOutputTokens: 100,
})

console.log(result.text, result.tokensPerSecond)
```

## 3. Stream it

```ts theme={null}
for await (const event of RunAnywhere.llm.generateStream('Write a haiku')) {
  if (event.type === 'textDelta') process.stdout.write(event.text)
}
```

The stream emits `started`, `textDelta` / `reasoningDelta`, `toolCallAdded` /
`toolArgumentsDone`, `usage`, then exactly one terminal `completed`, `failed`, or `cancelled`.
Electron is the only SDK with a `cancelled` terminal event.

## 4. Reach it from the renderer

The preload exposes the same facade as `window.runanywhere`, so page code calls the identical
methods without importing a native addon.

```ts renderer.ts theme={null}
const result = await window.runanywhere.llm.generate('Hello')
output.textContent = result.text
```

Input constructors come along for the ride, which is what lets renderer code build the same
values main-process code builds:

```ts theme={null}
const image = window.runanywhere.image.bytes(data)
const result = await window.runanywhere.vlm.generate(image, 'What is this?')
```

## 5. Download a model with progress

Electron is the only SDK where a download can be paused and resumed.

```ts theme={null}
for await (const event of RunAnywhere.models.download('qwen3-0.6b')) {
  if (event.type === 'progress') bar.value = event.fraction ?? 0
}

await RunAnywhere.models.pause('qwen3-0.6b')
await RunAnywhere.models.resume('qwen3-0.6b')
await RunAnywhere.models.cancel('qwen3-0.6b')

const stalled = await RunAnywhere.models.interrupted() // string[]
const canResume = await RunAnywhere.models.isResumable('qwen3-0.6b')
```

## 6. Add speech

```ts theme={null}
const transcription = await RunAnywhere.stt.transcribe(RunAnywhere.audio.wav(bytes))

const handle = await RunAnywhere.tts.speak('Ready when you are')
```

## Verify it is really running locally

```ts theme={null}
const capabilities = await RunAnywhere.capabilities()

console.log(capabilities.backends)
for (const missing of capabilities.unavailable) {
  console.log(missing.name, missing.reason)
}
```

`capabilities()` is generated from packaging facts about the linked addon, not from namespace
presence. On Windows ARM64 you will see `qhexrt` alone; on x64 and macOS you will see
llamacpp, onnx, and sherpa.

## Next

<CardGroup cols={2}>
  <Card title="Configuration" icon="gear" href="/electron/configuration">
    Models, storage, logging, auth
  </Card>

  <Card title="Installation" icon="download" href="/electron/installation">
    Processes and packaging
  </Card>
</CardGroup>
