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

# Configuration

> Environment variables and settings reference

Configure tinykit using environment variables. All settings can be configured via a `.env` file or passed directly to your deployment platform.

## Quick Reference

| Variable                    | Required | Default   | Description               |
| --------------------------- | -------- | --------- | ------------------------- |
| `LLM_PROVIDER`              | No\*     | -         | AI provider to use        |
| `LLM_API_KEY`               | No\*     | -         | API key for your provider |
| `LLM_MODEL`                 | No       | varies    | Model name                |
| `LLM_BASE_URL`              | No       | -         | Custom API endpoint       |
| `POCKETBASE_ADMIN_EMAIL`    | Yes      | -         | Database admin email      |
| `POCKETBASE_ADMIN_PASSWORD` | Yes      | -         | Database admin password   |
| `PORT`                      | No       | `3000`    | Server port               |
| `HOST`                      | No       | `0.0.0.0` | Server host               |

\*Can also be configured via `/tinykit/settings` UI after deployment.

***

## AI Provider Settings

### LLM\_PROVIDER

The AI provider to use for the agent. Options:

| Provider  | Value       | Description                 |
| --------- | ----------- | --------------------------- |
| Anthropic | `anthropic` | Claude models (recommended) |
| OpenAI    | `openai`    | GPT-4 and GPT-3.5 models    |
| Google    | `gemini`    | Gemini models               |

```bash theme={null}
LLM_PROVIDER=anthropic
```

### LLM\_API\_KEY

Your API key from the provider. Get yours from:

* **Anthropic**: [console.anthropic.com](https://console.anthropic.com/)
* **OpenAI**: [platform.openai.com/api-keys](https://platform.openai.com/api-keys)
* **Google**: [aistudio.google.com/apikey](https://aistudio.google.com/apikey)

```bash theme={null}
LLM_API_KEY=sk-ant-api03-...
```

<Warning>
  Never commit API keys to version control. Use environment variables or secrets management.
</Warning>

### LLM\_MODEL

The specific model to use. Defaults vary by provider:

| Provider  | Default                    | Recommended                |
| --------- | -------------------------- | -------------------------- |
| Anthropic | `claude-sonnet-4-20250514` | `claude-sonnet-4-20250514` |
| OpenAI    | `gpt-4o`                   | `gpt-4o`                   |
| Gemini    | `gemini-2.0-flash`         | `gemini-2.0-flash`         |

```bash theme={null}
LLM_MODEL=claude-sonnet-4-20250514
```

### LLM\_BASE\_URL

Custom API endpoint for OpenAI-compatible providers. Only needed for:

* Self-hosted models
* Other OpenAI-compatible APIs

```bash theme={null}
# For local OpenAI-compatible server
LLM_BASE_URL=http://localhost:8080/v1
```

***

## Database Settings

### POCKETBASE\_ADMIN\_EMAIL

Email address for the Pocketbase admin account. Used to initialize the database on first run.

```bash theme={null}
POCKETBASE_ADMIN_EMAIL=admin@yourdomain.com
```

### POCKETBASE\_ADMIN\_PASSWORD

Password for the Pocketbase admin account. Must be at least 8 characters.

```bash theme={null}
POCKETBASE_ADMIN_PASSWORD=your-secure-password
```

<Warning>
  Use a strong, unique password. This account has full access to your database.
</Warning>

### POCKETBASE\_URL

Optional. URL of an external Pocketbase instance. By default, tinykit runs its own embedded Pocketbase.

```bash theme={null}
# Only set if using external Pocketbase
POCKETBASE_URL=http://127.0.0.1:8091
```

***

## Server Settings

### PORT

The port the server listens on.

```bash theme={null}
PORT=3000
```

* **Default**: `3000` (production), `5173` (development)
* Railway and similar platforms set this automatically

### HOST

The host address to bind to.

```bash theme={null}
HOST=0.0.0.0
```

* **Default**: `0.0.0.0` (all interfaces)
* Use `127.0.0.1` to restrict to localhost only

***

## Provider Examples

### Anthropic (Claude)

```bash theme={null}
LLM_PROVIDER=anthropic
LLM_API_KEY=sk-ant-api03-...
LLM_MODEL=claude-sonnet-4-20250514
```

### OpenAI (GPT-4)

```bash theme={null}
LLM_PROVIDER=openai
LLM_API_KEY=sk-...
LLM_MODEL=gpt-4
```

### Google (Gemini)

```bash theme={null}
LLM_PROVIDER=gemini
LLM_API_KEY=your-gemini-api-key
LLM_MODEL=gemini-pro
```

***

## Complete Example

Here's a complete `.env` file for production:

```bash theme={null}
# AI Configuration
LLM_PROVIDER=anthropic
LLM_API_KEY=sk-ant-api03-...
LLM_MODEL=claude-sonnet-4-20250514

# Database
POCKETBASE_ADMIN_EMAIL=admin@yourdomain.com
POCKETBASE_ADMIN_PASSWORD=your-secure-password-here

# Server (usually set by platform)
PORT=3000
HOST=0.0.0.0
```

***

## Platform-Specific Notes

### Railway

Railway automatically sets `PORT`. Configure other variables in the Railway dashboard under **Variables**.

### Docker

Pass variables with `-e` flags or use `--env-file`:

```bash theme={null}
docker run -d \
  -e LLM_PROVIDER=anthropic \
  -e LLM_API_KEY=sk-ant-... \
  -e POCKETBASE_ADMIN_EMAIL=admin@example.com \
  -e POCKETBASE_ADMIN_PASSWORD=password \
  tinykit
```

### VPS / PM2

Use a `.env` file in the project root, or configure in `ecosystem.config.js`:

```javascript theme={null}
module.exports = {
  apps: [{
    name: 'tinykit',
    script: './start.sh',
    env: {
      LLM_PROVIDER: 'anthropic',
      LLM_API_KEY: 'sk-ant-...',
      // ...
    }
  }]
}
```

***

## Troubleshooting

<AccordionGroup>
  <Accordion title="AI responses return errors">
    Check these in order:

    1. `LLM_API_KEY` is set and valid
    2. `LLM_PROVIDER` matches your key (e.g., Anthropic key with `anthropic` provider)
    3. Your account has credits/quota remaining
    4. Check logs for specific error messages
  </Accordion>

  <Accordion title="Pocketbase won't start">
    Verify:

    1. `POCKETBASE_ADMIN_EMAIL` is a valid email format
    2. `POCKETBASE_ADMIN_PASSWORD` is at least 8 characters
    3. The `pocketbase/pb_data` directory is writable
  </Accordion>

  <Accordion title="Can't connect to server">
    Check:

    1. `PORT` isn't already in use (`lsof -i :3000`)
    2. `HOST` is set correctly for your environment
    3. Firewall allows traffic on the port
  </Accordion>

  <Accordion title="Settings not taking effect">
    Environment variables are read at startup. After changing `.env`:

    * **Development**: Restart `npm run dev`
    * **PM2**: Run `pm2 restart tinykit`
    * **Docker**: Recreate the container
    * **systemd**: Run `sudo systemctl restart tinykit`
  </Accordion>
</AccordionGroup>
