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

# Configuration

> Configure the ILLA SDK, CoreApiProvider, ContextManager, and caching

This page summarizes the main configuration surfaces.

## ILLA SDK configuration

The `IllaSDK` class accepts configuration for API connectivity and internal state components.

### Basic configuration

```ts theme={null}
import { IllaSDK } from '@illalabs/sdk'

const sdk = new IllaSDK({
  apiKey: process.env.ILLA_API_KEY!,
})
```

### With custom cache

```ts theme={null}
import { IllaSDK, InMemoryCache } from '@illalabs/sdk'

const sdk = new IllaSDK(
  { apiKey: process.env.ILLA_API_KEY! },
  { cache: new InMemoryCache() },
)
```

### With context manager options

```ts theme={null}
import { IllaSDK } from '@illalabs/sdk'

const sdk = new IllaSDK(
  { apiKey: process.env.ILLA_API_KEY! },
  {
    contextManagerOptions: {
      cacheKeyPrefix: 'illa:sdk:ctx',
      defaultToolsConfig: {
        autoRouter: { swapOrBridge: 'lifi' },
      },
    },
  },
)
```

### With custom context manager

```ts theme={null}
import { IllaSDK, InMemoryCache } from '@illalabs/sdk'

const cache = new InMemoryCache()
const contextManager = IllaSDK.createNewContextManager(cache, {
  cacheKeyPrefix: 'my-app:ctx',
  defaultToolsConfig: {},
})

const sdk = new IllaSDK(
  { apiKey: process.env.ILLA_API_KEY! },
  { contextManager },
)
```

## CoreApiProvider config

```ts theme={null}
import { CoreApiProvider } from '@illalabs/sdk'

const provider = new CoreApiProvider({
  headers: { 'x-api-key': process.env.ILLA_API_KEY! },
  timeout: 30_000,
  routes: {
    chat: '/api/v1/chat/',
    actionStatus: '/api/v1/actions/check',
  },
})
```

Notes:

* `x-api-key` is required.
* `timeout` is in milliseconds.
* Route overrides are useful for proxies and gateway path rewrites.

## ContextManager options

```ts theme={null}
const contextManager = new ContextManager(new InMemoryCache(), {
  cacheKeyPrefix: 'illa:sdk:ctx',
  defaultToolsConfig: {
    autoRouter: { swapOrBridge: 'lifi' },
  },
})
```

## Cache entry TTL

```ts theme={null}
await cache.set('key', value, { ttl: 5 * 60_000 })
```

TTL values are milliseconds.
