API referansı
Eski metin tamamlama API’si
prompt gönderen ve choices[].text okuyan istemcileri bağla.
POST /v1/completions
cURL
curl "https://kavren.dev/v1/completions" \
-H "Authorization: Bearer $KAVREN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-v4.1-flash-fast",
"prompt": "Bir gezegen adı yaz.",
"max_tokens": 64
}'Örnek yanıt · seçili alanlar
{
"object": "text_completion",
"model": "deepseek-v4.1-flash-fast",
"choices": [
{
"index": 0,
"text": "Mars",
"finish_reason": "stop"
}
]
}Metin dizisi satır sonlarıyla birleştirilip tek istem olarak gönderilir. Chat Completions tarifesi ve anahtar limitleri geçerlidir. Araç çağrıları için Chat Completions kullan.
Metin akışı
cURL
curl -N "https://kavren.dev/v1/completions" \
-H "Authorization: Bearer $KAVREN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-v4.1-flash-fast",
"prompt": "Bir gezegen adı yaz.",
"stream": true,
"max_tokens": 64
}'SSE parçalarındaki choices[].text alanlarını [DONE] gelene kadar birleştir. Aynı Idempotency-Key ile tekrar denendiğinde kayıt mevcutsa akış baştan sunulur.