Dokumentasi API AI Super

Integrasikan API AI Super langsung ke library OpenAI tanpa perlu konfigurasi khusus.

1. Kredensial

Base URL yang digunakan:

https://aisuper.my.id/v1

Kunci API didapatkan melalui Dashboard setelah pembelian token.

2. Chat Completions (REST API)

Endpoint: POST /v1/chat/completions

curl https://aisuper.my.id/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer " \
  -d '{
    "model": "gcli/grok-4.7",
    "messages": [
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user", "content": "Halo AI Super!"}
    ],
    "stream": false
  }'

3. Streaming SSE (Server-Sent Events)

Kirim parameter "stream": true pada payload JSON:

curl -N https://aisuper.my.id/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer " \
  -d '{
    "model": "gcli/grok-4.7",
    "messages": [{"role": "user", "content": "Buat 1 puisi singkat"}],
    "stream": true
  }'

4. Daftar Model

Endpoint: GET /v1/models

curl https://aisuper.my.id/v1/models \
  -H "Authorization: Bearer "

5. Integrasi Python SDK (OpenAI)

from openai import OpenAI

client = OpenAI(
    base_url="https://aisuper.my.id/v1",
    api_key=""
)

response = client.chat.completions.create(
    model="gcli/grok-4.7",
    messages=[{"role": "user", "content": "Jelaskan apa itu AI Gateway!"}],
    stream=True
)

for chunk in response:
    content = chunk.choices[0].delta.content or ""
    print(content, end="", flush=True)

6. Integrasi Cursor IDE / Cline

Buka Settings AI di editor, aktifkan OpenAI Compatible Mode: