Semua model
xAITersedia256K context

Grok 4

Grok 4 tersedia di Hostlinku lewat satu API yang kompatibel dengan OpenAI.

Harga · per 1M token
USD
Input / 1M token$3.00
Output / 1M token$15.00

Contoh: 1M masuk / 1M keluar

$18.00

Tentang Grok 4

Grok 4 tersedia di Hostlinku lewat satu API yang kompatibel dengan OpenAI.

Contoh kode

Hubungi Grok 4 lewat OpenAI SDK — cukup arahkan base URL ke Hostlinku dan gunakan kunci API kamu.

example.ts
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.hostlinku.dev/v1",
  apiKey: process.env.HOSTLINKU_API_KEY,
});

const reply = await client.chat.completions.create({
  model: "grok-4",
  messages: [
    { role: "system", content: "You are a helpful assistant." },
    { role: "user", content: "Halo, Grok 4!" },
  ],
});

console.log(reply.choices[0].message.content);
example.py
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.hostlinku.dev/v1",
    api_key=os.environ["HOSTLINKU_API_KEY"],
)

reply = client.chat.completions.create(
    model="grok-4",
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Halo, Grok 4!"},
    ],
)

print(reply.choices[0].message.content)
terminal
curl https://api.hostlinku.dev/v1/chat/completions \
  -H "Authorization: Bearer $HOSTLINKU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "grok-4",
    "messages": [
      { "role": "user", "content": "Halo, Grok 4!" }
    ]
  }'

Pertanyaan yang sering diajukan

Belum ada model lain dari xAI di marketplace — cek lagi nanti.

Lihat semua model