API AI PDPL

Dokumentasi All in One API Key

API AI PDPL kompatibel dengan OpenAI. Tinggal ganti Base URL dan API key, kode kamu langsung jalan. Satu API key untuk mengakses 20+ model AI siap pakai.

API AI PDPL

Satu API Key untuk semua model AI

Credential, paket token, usage, dan pembayaran dikelola dari satu Dashboard API. Gunakan Base URL dan API key API AI PDPL untuk menjalankan workflow OpenAI-compatible.

Buat API Access

Base URL

https://api.produkdigitalpalinglaris.web.id/v1

API Token

YOUR_API_TOKEN

Rate limit

60 req/menit

01 · API DOCS

Mulai Cepat

Ganti YOUR_API_TOKEN dengan credential dari Dashboard API, lalu jalankan contoh berikut.

cURL — Chat Completions

curl -X POST https://api.produkdigitalpalinglaris.web.id/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -d '{
    "model": "auto",
    "messages": [{"role":"user","content":"Halo, apa kabar?"}]
  }'

Python — OpenAI SDK

from openai import OpenAI

client = OpenAI(
    base_url="https://api.produkdigitalpalinglaris.web.id/v1",
    api_key="YOUR_API_TOKEN"
)

response = client.chat.completions.create(
    model="auto",
    messages=[{"role": "user", "content": "Halo!"}]
)

print(response.choices[0].message.content)

Node.js — OpenAI SDK

import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.produkdigitalpalinglaris.web.id/v1",
  apiKey: "YOUR_API_TOKEN"
});

const response = await client.chat.completions.create({
  model: "auto",
  messages: [{ role: "user", content: "Halo!" }]
});
console.log(response.choices[0].message.content);

Go — HTTP

package main

import (
  "bytes"
  "fmt"
  "io"
  "net/http"
)

func main() {
  body := []byte(`{"model":"auto","messages":[{"role":"user","content":"Halo!"}]}`)
  req, _ := http.NewRequest("POST", "https://api.produkdigitalpalinglaris.web.id/v1/chat/completions", bytes.NewBuffer(body))
  req.Header.Set("Content-Type", "application/json")
  req.Header.Set("Authorization", "Bearer YOUR_API_TOKEN")
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  data, _ := io.ReadAll(res.Body)
  fmt.Println(string(data))
}

02 · API DOCS

Overview

Gateway memvalidasi credential, akun, entitlement, model, rate limit, dan quota sebelum request diteruskan ke provider.

Credential

Bearer token diverifikasi dari hash dan dapat direvoke kapan saja.

Metering

Input token, output token, latency, provider, dan status request dicatat.

Quota

Token didebit dari entitlement aktif melalui ledger append-only.

03 · API DOCS

OpenCode

Arahkan provider OpenAI-compatible OpenCode ke Base URL API AI PDPL.

{
  "provider": {
    "pdpl": {
      "npm": "@ai-sdk/openai-compatible",
      "options": {
        "baseURL": "https://api.produkdigitalpalinglaris.web.id/v1",
        "apiKey": "YOUR_API_TOKEN"
      },
      "models": { "auto": { "name": "auto" } }
    }
  },
  "model": "pdpl/auto"
}

04 · API DOCS

Claude

Gunakan Claude melalui endpoint chat completions OpenAI-compatible. Native Anthropic /v1/messages belum diaktifkan pada gateway API AI PDPL.

from openai import OpenAI

client = OpenAI(
    base_url="https://api.produkdigitalpalinglaris.web.id/v1",
    api_key="YOUR_API_TOKEN"
)

response = client.chat.completions.create(
    model="auto",
    messages=[{"role": "user", "content": "Bantu jelaskan kode ini."}]
)

05 · API DOCS

9Router

Untuk router atau tool yang menerima provider OpenAI-compatible, gunakan Base URL dan Bearer Token berikut.

Base URL: https://api.produkdigitalpalinglaris.web.id/v1
API Key: YOUR_API_TOKEN
Model: auto
Endpoint: POST /chat/completions

06 · API DOCS

Hermes

Set provider Hermes ke endpoint API AI PDPL. Simpan API key di environment variable, bukan di source code.

export PDPL_BASE_URL="https://api.produkdigitalpalinglaris.web.id/v1"
export PDPL_API_KEY="YOUR_API_TOKEN"

# Gunakan model aktif dari katalog API AI PDPL
hermes --base-url "$PDPL_BASE_URL" --api-key "$PDPL_API_KEY" --model auto

07 · API DOCS

pi/omp

pi/omp dapat memakai gateway OpenAI-compatible melalui Base URL API AI PDPL dan model auto.

{
  "baseUrl": "https://api.produkdigitalpalinglaris.web.id/v1",
  "apiKey": "YOUR_API_TOKEN",
  "model": "auto"
}

08 · API DOCS

Models

Model yang dapat dipakai mengikuti katalog 20+ model AI aktif dan entitlement akun.

curl https://api.produkdigitalpalinglaris.web.id/v1/models \
  -H "Authorization: Bearer YOUR_API_TOKEN"

Katalog publik juga tersedia di halaman Model AI dan Top Model.

09 · API DOCS

Chat Completions

Gunakan model auto atau model ID yang tersedia dari endpoint models.

POST https://api.produkdigitalpalinglaris.web.id/v1/chat/completions
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json

{
  "model": "auto",
  "messages": [{"role": "user", "content": "Jelaskan API AI PDPL"}],
  "stream": false
}

Streaming belum tersedia pada gateway saat ini. Gunakan stream: false.

10 · API DOCS

Usage & Quota

Usage tersedia di Dashboard API dan bersumber langsung dari event gateway.

Cek usage

Lihat request, total token, input/output, HTTP status, dan latency.

Buka Usage

Aktifkan quota

Buat invoice dan payment paket dari Dashboard API → Billing.

Buka Billing

11 · API DOCS

Errors

Error dikembalikan dalam format JSON yang konsisten.

{
  "error": {
    "type": "quota_exceeded",
    "code": "quota_exceeded",
    "message": "Quota token API tidak mencukupi."
  }
}

401 — credential invalid/revoked.

402 — quota atau entitlement tidak aktif.

422 — payload request tidak valid.

429 — rate limit tercapai.

Jaga credential kamu

Jangan commit API Token ke repository. Jika token bocor, segera lakukan rotasi dari Dashboard API → API Access.