Uç noktalar
Completions
POST /completions ile ham prompt metnini gönderip üretilen metni alın; temel modeller ve eski entegrasyonlar için parametreler ve yanıt yapısı.
Playground’da deneEski completions uç noktası ham bir prompt dizesi alır ve sohbet şablonu uygulamadan üretilen metni döndürür. Temel modeller, fill-in-the-middle ve eski entegrasyonlar için kullanışlıdır. Yeni kod için Chat completions kullanın.
POST https://api14.com/api/v1/completions
Authorization: Bearer sk-api14-...
Content-Type: application/json
İstek
| Parametre | Tür | Açıklama |
|---|---|---|
model | string, zorunlu | Model kimliği, örn. meta-llama/llama-3.1-8b-instruct. |
prompt | string, zorunlu | Devam ettirilecek metin. |
max_tokens | integer | Üretilecek token sayısının üst sınırı. |
temperature, top_p, top_k | number | Örnekleme ayarları. |
stop | string | string[] | Durdurma dizileri. |
seed | integer | En iyi çabayla deterministik örnekleme. |
logprobs | integer | Model destekliyorsa en olası token'lar için log olasılıklarını döndürür. |
stream | boolean | Metin parçalarını SSE ile stream eder. |
provider, models, transforms | Chat completions ile aynı ağ geçidi uzantıları. |
curl https://api14.com/api/v1/completions \
-H "Authorization: Bearer $API14_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-3.5-turbo-instruct",
"prompt": "The three primary colors are",
"max_tokens": 20
}'
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api14.com/api/v1",
apiKey: process.env.API14_API_KEY,
});
const result = await client.chat.completions.create({
"model": "openai/gpt-5-mini",
"messages": [
{
"role": "user",
"content": "Explain vector databases in two sentences."
}
]
});
console.log(result.choices[0].message.content);
Yanıt
{
"id": "gen-1760000000-xyz789",
"object": "text_completion",
"created": 1760000000,
"model": "openai/gpt-3.5-turbo-instruct",
"choices": [
{ "index": 0, "text": " red, yellow and blue.", "finish_reason": "stop" }
],
"usage": {
"prompt_tokens": 6,
"completion_tokens": 7,
"total_tokens": 13,
"cost": 0.0000195
}
}
Hatalar
400 model_required, 400 invalid_json, 401 invalid_api_key, 402 insufficient_balance, 403 model_not_allowed / plan_required, 404 model_not_found, 413 payload_too_large, 429 rate_limited, 502 upstream_unavailable. Sağlayıcıdan gelen hatalar özgün durum koduyla aynen iletilir. Bkz. Hatalar.