Semua model
MistralTersedia32K context

Codestral

Codestral tersedia di Hostlinku lewat satu API yang kompatibel dengan OpenAI.

Harga · per 1M token
USD
Input / 1M token$0.30
Output / 1M token$0.90

Contoh: 1M masuk / 1M keluar

$1.20

Tentang Codestral

Codestral tersedia di Hostlinku lewat satu API yang kompatibel dengan OpenAI.

Contoh kode

Hubungi Codestral 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: "codestral",
  messages: [
    { role: "system", content: "You are a helpful assistant." },
    { role: "user", content: "Halo, Codestral!" },
  ],
});

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="codestral",
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Halo, Codestral!"},
    ],
)

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": "codestral",
    "messages": [
      { "role": "user", "content": "Halo, Codestral!" }
    ]
  }'

Pertanyaan yang sering diajukan

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

Lihat semua model