Lewati ke konten
Semua model

Claude Sonnet 4

Anthropic Chat

Model unggulan untuk penalaran, penulisan kode, dan alur kerja agentik dengan hasil yang konsisten.

Spesifikasi

Provider
Anthropic
Jenis model
Chat
Context window
200.000 token
Output maksimum
64.000 token
Input yang didukung
Teks, Gambar
Output
Teks
Kemampuan
  • Text
  • Vision
  • Tool calling
  • Streaming
  • JSON mode

Harga

Input

per 1 juta token

Rp59.400
Output

per 1 juta token

Rp297.000
Input tersimpan (cached)

per 1 juta token

Rp5.940

Harga dalam Rupiah. Tagihan dihitung dari jumlah token yang dilaporkan untuk setiap request dan dipotong dari saldo Anda.

Contoh API

Chat Completions

curl "https://www.astranesia.com/v1/chat/completions" \
  -H "Authorization: Bearer $AI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "anthropic/claude-sonnet-4",
    "messages": [
      { "role": "system", "content": "Jawab dengan singkat dalam Bahasa Indonesia." },
      { "role": "user", "content": "Halo!" }
    ]
  }'

Streaming

curl -N "https://www.astranesia.com/v1/chat/completions" \
  -H "Authorization: Bearer $AI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "anthropic/claude-sonnet-4",
    "stream": true,
    "stream_options": { "include_usage": true },
    "messages": [{ "role": "user", "content": "Ceritakan tentang Nusantara." }]
  }'

Input gambar

curl "https://www.astranesia.com/v1/chat/completions" \
  -H "Authorization: Bearer $AI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "anthropic/claude-sonnet-4",
    "messages": [
      {
        "role": "user",
        "content": [
          { "type": "text", "text": "Apa yang ada pada gambar ini?" },
          { "type": "image_url", "image_url": { "url": "https://example.com/foto.jpg" } }
        ]
      }
    ]
  }'

Tool calling

curl "https://www.astranesia.com/v1/chat/completions" \
  -H "Authorization: Bearer $AI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "anthropic/claude-sonnet-4",
    "messages": [{ "role": "user", "content": "Cuaca di Jakarta?" }],
    "tools": [
      {
        "type": "function",
        "function": {
          "name": "get_weather",
          "description": "Ambil cuaca terkini untuk sebuah kota.",
          "parameters": {
            "type": "object",
            "properties": { "city": { "type": "string" } },
            "required": ["city"]
          }
        }
      }
    ]
  }'

Batasan request

  • Context window maksimum 200.000 token (input dan output).
  • Output maksimum 64.000 token. Nilai max_tokens di atas batas ini ditolak.
  • Jika max_tokens tidak diisi, batas output 4.096 token diterapkan.
  • Parameter n hanya mendukung nilai 1.
  • Streaming SSE didukung dengan stream: true.
  • Gambar dikirim lewat URL https:// atau data URL base64 (png, jpeg, gif, webp).
  • Ukuran request maksimum 3,8 MB.
  • Batas 60 request per menit dan 5 request bersamaan untuk setiap akun.
  • Saldo harus mencukupi perkiraan biaya maksimum request sebelum request diproses.
Claude Sonnet 4 | Astranesia AI