1. Cara Menggunakan Garz AI (Chat & Coding)

Chat dengan AI

1

Buka Halaman Chat

Klik menu "Chat" di navbar atau buka langsung /chats

2

Ketik Pertanyaan

Tanyakan apa saja: pertanyaan umum, minta bikin kode, debugging, brainstorming, dll.

3

Dapatkan Jawaban Instan

Garz AI akan merespons dengan cepat dan akurat, termasuk kode lengkap jika Anda minta.

๐Ÿ“ Contoh Prompt yang Bisa Dicoba
"Buatkan saya website portofolio sederhana dengan HTML, CSS, dan JavaScript yang responsive"
"Buatkan fungsi bubble sort di Python dengan penjelasan"
"Apa perbedaan antara REST API dan GraphQL?"
2. Cara Menggunakan API Key

Dapatkan API Key

1

Buka Halaman API Key

Klik menu "API Key" di navbar atau buka /keys

2

Salin API Key

Salin API key yang tersedia atau buat key baru dengan nama yang mudah diingat.

3

Integrasikan ke Aplikasi

Gunakan API key untuk mengakses Garz AI dari aplikasi atau script Anda.

Contoh Kode Integrasi API

๐Ÿ Python
import requests

url = "https://api.garz.ai/v1/chat"
headers = {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
}
data = {
    "prompt": "Halo Garz AI, apa kabar?"
}

response = requests.post(url, headers=headers, json=data)
print(response.json())
๐Ÿ“œ JavaScript (Node.js)
const fetch = require('node-fetch');

async function chatWithGarzAI() {
    const response = await fetch('https://api.garz.ai/v1/chat', {
        method: 'POST',
        headers: {
            'Authorization': 'Bearer YOUR_API_KEY',
            'Content-Type': 'application/json'
        },
        body: JSON.stringify({ prompt: "Halo Garz AI!" })
    });
    const data = await response.json();
    console.log(data);
}

chatWithGarzAI();
๐ŸŒ cURL
curl -X POST https://api.garz.ai/v1/chat \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"prompt":"Halo Garz AI"}'
๐Ÿ’ป PHP
<?php
$ch = curl_init('https://api.garz.ai/v1/chat');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer YOUR_API_KEY',
    'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['prompt' => 'Halo Garz AI']));
$response = curl_exec($ch);
echo $response;
?>
3. Cara Run Server Lokal (Backend Integration)

Node.js (Express)

server.js
const express = require('express');
const fetch = require('node-fetch');
const app = express();
app.use(express.json());

const GARZ_API_KEY = 'YOUR_API_KEY';

app.post('/api/chat', async (req, res) => {
    const { prompt } = req.body;
    const response = await fetch('https://api.garz.ai/v1/chat', {
        method: 'POST',
        headers: {
            'Authorization': `Bearer ${GARZ_API_KEY}`,
            'Content-Type': 'application/json'
        },
        body: JSON.stringify({ prompt })
    });
    const data = await response.json();
    res.json(data);
});

app.listen(3000, () => {
    console.log('Server running on http://localhost:3000');
});
1

Install dependencies

npm install express node-fetch

2

Jalankan server

node server.js

Python (Flask)

app.py
from flask import Flask, request, jsonify
import requests

app = Flask(__name__)
GARZ_API_KEY = 'YOUR_API_KEY'

@app.route('/api/chat', methods=['POST'])
def chat():
    prompt = request.json.get('prompt')
    response = requests.post(
        'https://api.garz.ai/v1/chat',
        headers={'Authorization': f'Bearer {GARZ_API_KEY}'},
        json={'prompt': prompt}
    )
    return jsonify(response.json())

if __name__ == '__main__':
    app.run(port=5000, debug=True)
1

Install dependencies

pip install flask requests

2

Jalankan server

python app.py

PHP (Native)

api.php
<?php
header('Content-Type: application/json');

$apiKey = 'YOUR_API_KEY';
$input = json_decode(file_get_contents('php://input'), true);
$prompt = $input['prompt'] ?? '';

$ch = curl_init('https://api.garz.ai/v1/chat');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer ' . $apiKey,
    'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['prompt' => $prompt]));

$response = curl_exec($ch);
echo $response;
?>
1

Simpan file

Simpan sebagai api.php di folder htdocs (XAMPP) atau public_html

2

Jalankan server

Gunakan XAMPP, WAMP, atau php -S localhost:8000

Frontend (HTML/JS)

index.html
<!DOCTYPE html>
<html>
<head><title>Garz AI Chat</title></head>
<body>
    <input type="text" id="prompt" placeholder="Tanya Garz AI...">
    <button onclick="chat()">Kirim</button>
    <div id="response"></div>

    <script>
    async function chat() {
        const prompt = document.getElementById('prompt').value;
        const response = await fetch('/api/chat', {
            method: 'POST',
            headers: { 'Content-Type': 'application/json' },
            body: JSON.stringify({ prompt })
        });
        const data = await response.json();
        document.getElementById('response').innerText = data.reply;
    }
    </script>
</body>
</html>
โš ๏ธ Catatan: Backend server harus berjalan di localhost:3000 (Node), 5000 (Python), atau 8000 (PHP) agar frontend bisa terhubung.
4. Cara Menggunakan Console Editor

Console Editor

1

Buka Console Editor

Klik menu "Console" di navbar atau buka /console

2

Tulis Kode

Tulis kode Python atau JavaScript di area editor.

3

Klik Run

Tekan tombol "Run Code" untuk menjalankan kode dan melihat hasilnya.

๐Ÿ“ Contoh Kode yang Bisa Dicoba
# Python
print("Hello Garz AI!")
for i in range(5):
    print(f"Angka ke-{i}")
// JavaScript
const nama = "Garz AI";
console.log(`Selamat datang di ${nama}!`);
5. Tips & Trik

Prompt yang Efektif

  • โœ… Jelaskan detail yang Anda inginkan
  • โœ… Sebutkan bahasa pemrograman yang diinginkan
  • โœ… Minta penjelasan jika perlu
  • โœ… Contoh: "Buatkan fungsi sorting di Python dengan komentar"

Keamanan API Key

  • ๐Ÿ”’ Jangan bagikan API key di publik
  • ๐Ÿ”’ Simpan di environment variable
  • ๐Ÿ”’ Gunakan key terpisah untuk production
  • ๐Ÿ”’ Regenerate key jika terduga bocor
โœ… Selesai! Sekarang Anda sudah bisa menggunakan Garz AI dengan maksimal. Mulai chat atau integrasikan API key ke aplikasi Anda.