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

# Saldo & batas akun

> Cek kredit, status paket Unlimited, job aktif, dan sisa kuota video harian satu akun.

Satu panggilan ringan untuk mengetahui apakah akunmu siap mengirim permintaan berikutnya. Cocok dipakai sebagai gerbang sebelum batch.

### Authorizations

**Authorization** `string` *required*

API key berformat `Bearer vg_...`.

```bash cURL theme={null} theme={null}
curl https://vigen.id/api/v1/user/credits \
  -H "Authorization: Bearer vg_4b1a82f3c9d0e1f2a3b4c5d6e7f80912"
```

```js Node.js theme={null} theme={null}
const info = await (
  await fetch("https://vigen.id/api/v1/user/credits", {
    headers: { Authorization: `Bearer ${process.env.VIGEN_API_KEY}` },
  })
).json();

if (info.user.credits < 10 || info.limits.dailyVideosRemaining === 0) {
  console.warn("tidak layak mengirim batch");
}
```

```python Python theme={null} theme={null}
info = requests.get(
    "https://vigen.id/api/v1/user/credits",
    headers={"Authorization": f"Bearer {api_key}"},
).json()

print(info["user"]["credits"], info["unlimited"], info["limits"])
```

### Responses

**success** `boolean` *required*

`true` saat data terbaca.

**user** `object` *required*

**isi user**

**uid** `string` *required*

Id internal akun. Stabil dan aman dipakai sebagai kunci basis data kamu.

**email** `string`

Email akun Google pemilik key.

**credits** `number` *required*

Saldo kredit saat ini. Bisa berupa pecahan (misal `1.5`).

**unlimited** `object` *required*

Status paket Unlimited. Tidak ada kredit yang dipotong untuk model yang memenuhi syarat selama `active` bernilai `true`.

**isi unlimited**

**active** `boolean` *required*

`true` bila kuota masih berlaku.

**daysLeft** `number`

Sisa hari. Pembelian berulang menumpuk, jadi nilainya bisa lebih dari durasi satu paket.

**expiresAt** `string (ISO 8601) | null`

Waktu kedaluwarsa; `null` bila tidak ada paket aktif.

**limits** `object` *required*

Batas yang akan menentukan apakah permintaan berikutnya diterima.

**isi limits**

**maxConcurrentJobs** `number` *required*

Proses bersamaan yang diizinkan untuk pemakaian kuota Unlimited. Saat ini `2`.

**currentActiveJobs** `number` *required*

Job milik akunmu yang masih `queued`, `dispatching`, atau `processing`.

**dailyVideoLimit** `number` *required*

Batas video sukses per hari. Saat ini `50`.

**dailyVideosGenerated** `number` *required*

Sudah terpakai hari ini. Job gagal tidak dihitung.

**dailyVideosRemaining** `number` *required*

Sisa hari ini, minimal `0`.

**resetsAt** `string` *required*

`"00:00 WIB"` — reset memakai waktu Indonesia Barat, bukan UTC.

```json 200 theme={null} theme={null}
{
  "success": true,
  "user": {
    "uid": "0f7c9a1e-42b3-4c9a-9d0f-8a3e2b1c5d64",
    "email": "saya@tokokamu.com",
    "credits": 128
  },
  "unlimited": {
    "active": true,
    "daysLeft": 1,
    "expiresAt": "2026-11-05T03:41:12.000Z"
  },
  "limits": {
    "maxConcurrentJobs": 2,
    "currentActiveJobs": 1,
    "dailyVideoLimit": 50,
    "dailyVideosGenerated": 12,
    "dailyVideosRemaining": 38,
    "resetsAt": "00:00 WIB"
  }
}
```

```json 401 theme={null} theme={null}
{ "error": "API Key tidak valid atau telah dicabut." }
```

```json 503 theme={null} theme={null}
{ "error": "Vigen sedang dalam pemeliharaan. Penggunaan API key dinonaktifkan sementara." }
```

## Pola pakai yang lazim

> [tab] Gerbang sebelum batch
>
> ```js theme={null} theme={null}
> async function canSubmit(model, parameters) {
>   const [{ limits }, models] = await Promise.all([vigen.credits(), vigen.models()]);
>   const m = models.video.find((x) => x.id === model);
>   const harga = perkirakanHarga(m, parameters);
>
>   return (
>     limits.dailyVideosRemaining > 0 &&
>     limits.currentActiveJobs < limits.maxConcurrentJobs &&
>     (await vigen.credits()).user.credits >= harga
>   );
> }
> ```

> [tab] Alert saldo menipis
>
> ```js theme={null} theme={null}
> // jalankan tiap jam dari cron
> const { user, unlimited } = await vigen.credits();
>
> if (!unlimited.active && user.credits < 20) {
>   await notifyOwner(`Sisa kredit ${user.credits}. Beli lagi di https://vigen.id/billing`);
> }
> ```

> [tab] Pantau kuota harian
>
> ```js theme={null} theme={null}
> const { limits } = await vigen.credits();
>
> if (limits.dailyVideosRemaining <= 5) {
>   scheduler.pauseNewVideoJobsUntil(nextWibMidnight());
> }
> ```

> [!WARNING]
>
> Angka `maxConcurrentJobs` hanya menentukan penolakan ketika permintaanmu dibiayai kuota Unlimited. Pemakaian per kredit bisa memiliki lebih dari dua job aktif, tetapi akan mengantre lebih lama.


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