Skip to content

Batch API: Bulk Async Workloads

Run async workloads at 50% cost with the Batch API. Ideal for labeling, content generation, and evals.

Şükrü Yusuf KAYA
10 min read
Intermediate
Batch API: çok sayıda görev tek dosyada

Batch API

Anlık cevap gerekmiyorsa görevleri tek dosyada Batch API'ye yolla. 24 saat içinde işlenir, %50 indirim.
python
# Batch API iskeleti
batch = client.messages.batches.create(requests=[
{
"custom_id":"label-001",
"params":{
"model":"claude-sonnet-4-6",
"max_tokens":256,
"messages":[{"role":"user","content":"Şu mesajı kategorile: ..."}],
},
},
# ... 999 daha
])
print(batch.id, batch.status)
 
# Daha sonra sonuçları kontrol et
batch = client.messages.batches.retrieve(batch.id)
if batch.status == "ended":
for line in client.messages.batches.results(batch.id):
print(line["custom_id"], line["result"]["message"]["content"])
Batch API basit kullanım.
Boşluk doldur · text
Batch API anlık olmayan iş yükleri için _____ indirim sağlar. SLA tipik olarak _____ saatlik penceredir. Etiketleme ve _____ üretimi en yaygın kullanım.

Frequently Asked Questions

That line is marked as error in the result; others are unaffected. You re-submit the failed ones.

Yorumlar & Soru-Cevap

(0)
Yorum yazmak için giriş yap.
Yorumlar yükleniyor...

Related Content