> For the complete documentation index, see [llms.txt](https://docs.haikaldev.my.id/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.haikaldev.my.id/tentang/instalasi.md).

# Instalasi dan Setup

Tutorial lengkap dari `git clone` sampai QR ter-scan. Waktu yang dibutuhkan: ±10 menit (di luar antre kuota QR 😄).

## Prasyarat

| Kebutuhan              | Keterangan                                                                                                                                                                                   |
| ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Node.js v18+**       | Dikembangkan & diuji di v25; produksi penulis jalan di v20. Cek: `node -v`                                                                                                                   |
| **API key OhhMyAgent** | **Wajib** — otak bot. Daftar di [ohhmyagent.com](https://ohhmyagent.com), lihat [OhhMyAgent](/koneksi-ai/ohhmyagent.md)                                                                      |
| **API key Gemini**     | Opsional tapi sangat disarankan — tanpa ini bot **tuli**. Gratis di [aistudio.google.com](https://aistudio.google.com/app/apikey), lihat [Google AI Studio](/koneksi-ai/google-ai-studio.md) |
| **Nomor WhatsApp**     | Nomor khusus bot lebih aman daripada nomor pribadi                                                                                                                                           |
| ffmpeg                 | **Tidak perlu** — sudah dibundel via `ffmpeg-static`                                                                                                                                         |
| Python 3               | Opsional — hanya untuk unduh sosmed (yt-dlp) dan runtime python workspace                                                                                                                    |

## Langkah demi langkah

{% stepper %}
{% step %}

### Clone & install

```bash
git clone https://github.com/AnakTentara/AI-Haikaru.git
cd AI-Haikaru
npm install
```

Kalau `npm install` gagal di paket native (sharp dsb.), pastikan versi Node-mu ≥18 dan arsitekturnya umum (x64/arm64) — paket-paket ini memakai prebuild, bukan kompilasi.
{% endstep %}

{% step %}

### Konfigurasi `.env`

```bash
cp .env.example .env
```

Minimum supaya hidup:

```env
API_KEY=sk-key-ohhmyagent-kamu
BASE_URL=https://ohhmyagent.com
MODEL=ohh/gpt-5.6
PREMIUM_MODEL=ohh/opus-5
```

Yang disarankan sekalian:

```env
# Telinga bot — tanpa ini voice note tidak pernah terbaca
GEMINI_API_KEYS=AIzaSy-key1,AIzaSy-key2
GEMINI_MODEL=gemini-3.1-flash-lite

# Hosting website workspace
PUBLIC_BASE_URL=https://domain-kamu.com
SITE_PORT=

# Portal /config di dashboard web — tanpa token, halamannya MATI (fail closed)
CONFIG_TOKEN=hasil-openssl-rand-hex-32
```

{% hint style="danger" %}
**Jangan pernah commit `.env`** — isinya kredensial asli. Sudah ada di `.gitignore`, biarkan begitu.
{% endhint %}

Penjelasan tiap variabel ada di [peta koneksi AI](/koneksi-ai/koneksi-ai.md).
{% endstep %}

{% step %}

### Sesuaikan `config.json`

```bash
cp config.example.json config.json
```

Isi yang perlu disentuh:

```json
{
  "prefix": ".",
  "botName": "AI-Haikaru",
  "targetUserIds": [
    "628xxxxxxxxxx"
  ],
  "port": 3000
}
```

`targetUserIds` adalah **identitas bot sendiri** (untuk deteksi mention). Setelah login pertama, tambahkan juga LID bot — angkanya muncul di log start (`myLID`).

{% hint style="warning" %}
Tanpa LID, mention di sebagian grup **tidak terdeteksi** — dan tidak ada error apa pun yang memberitahumu. Lihat [Troubleshooting](/referensi/troubleshooting.md).
{% endhint %}

{% hint style="info" %}
`config.json` **tidak dilacak git** — dashboard `/config` menulisinya, dan kalau ikut ter-commit maka `git pull` berikutnya gagal (dan API key mendarat di repo). Templatnya `config.example.json`; `run.sh` menyalinnya otomatis kalau belum ada.
{% endhint %}
{% endstep %}

{% step %}

### Jalankan

{% tabs %}
{% tab title="Development" %}

```bash
npm start
```

{% endtab %}

{% tab title="Produksi (Linux)" %}

```bash
./run.sh
```

Script ini juga memasang & menyegarkan yt-dlp otomatis, dan menyalin `config.example.json` kalau `config.json` belum ada.
{% endtab %}
{% endtabs %}
{% endstep %}

{% step %}

### Scan QR

1. Terminal menampilkan QR code (juga tersedia di `http://localhost:3000/` selama belum login)
2. WhatsApp di ponsel → **Pengaturan** → **Perangkat Tertaut** → **Tautkan Perangkat**
3. Scan → tunggu `Own LID session created successfully` di log
4. Kirim chat pribadi ke nomor bot: *"halo!"*

{% hint style="danger" %}
Sesi tersimpan di `data/baileys_auth/`. **Folder itu = akun WhatsApp bot** — siapa pun yang menyalinnya bisa mengambil alih akunnya. Jangan pernah dibagikan atau di-commit.
{% endhint %}

Restart tidak perlu scan ulang.
{% endstep %}
{% endstepper %}

## Verifikasi fitur

Urutan tes yang enak setelah bot hidup:

| Tes                  | Perintah                                                                                                           |
| -------------------- | ------------------------------------------------------------------------------------------------------------------ |
| Bot hidup            | `.ping`                                                                                                            |
| AI jalan             | "halo, kamu siapa?"                                                                                                |
| Vision               | kirim foto + "ini gambar apa?"                                                                                     |
| Audio (butuh Gemini) | kirim VN                                                                                                           |
| Workspace            | `/ws` lalu *"bikin project halo dunia pakai python, jalanin"*                                                      |
| Hosting              | *"bikinin website satu halaman terus hostingin"* — lihat [Hosting Website](/coding-and-hosting/hosting-website.md) |

## Struktur `data/` yang terbentuk

```
data/
├── baileys_auth/     # sesi WhatsApp — JANGAN disentuh/dibagikan
├── history/          # riwayat chat per chat (JSON)
├── memory/           # memori per chat
├── media/            # arsip media masuk (dibersihkan 30 hari)
├── generated/        # file buatan bot (dibersihkan 7 hari)
├── audio_archive/    # arsip voice note + transkrip
└── workspaces/       # workspace coding + situs
    ├── index/        # metadata per pemilik
    ├── files/<id>/   # isi tiap workspace
    ├── users.json    # tautan identitas nomor↔LID
    └── usernames.json# username publik untuk URL situs
```

{% hint style="warning" %}
Seluruh `data/` ada di `.gitignore` — di dalamnya ada percakapan asli orang. **Backup folder ini** kalau botmu menyimpan hal penting; jangan pernah meng-commit-nya.
{% endhint %}

## Berikutnya

* Produksi di panel: [Deploy di Pterodactyl](/tentang/deploy-pterodactyl.md)
* Semua perintah: [Referensi Perintah](/referensi/perintah.md)
* Ada masalah: [Troubleshooting](/referensi/troubleshooting.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.haikaldev.my.id/tentang/instalasi.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
