Endpoints
Completions
Use POST /completions for legacy prompt-in, text-out completions with the OpenAI completions format, parameters and response fields.
Try it in the playgroundThe legacy completions endpoint takes a raw prompt string and returns generated text, with no chat template applied. It is useful for base models, fill-in-the-middle and older integrations. For new code, use Chat completions.
POST https://api14.com/api/v1/completions
Authorization: Bearer sk-api14-...
Content-Type: application/json
Request
| Parameter | Type | Description |
|---|---|---|
model | string, required | Model id, e.g. meta-llama/llama-3.1-8b-instruct. |
prompt | string, required | The text to continue. |
max_tokens | integer | Upper bound on generated tokens. |
temperature, top_p, top_k | number | Sampling controls. |
stop | string | string[] | Stop sequences. |
seed | integer | Best-effort deterministic sampling. |
logprobs | integer | Return log probabilities for the top tokens when the model supports it. |
stream | boolean | Stream text chunks over SSE. |
provider, models, transforms | Same gateway extensions as chat completions. |
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);
Response
{
"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
}
}
Errors
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. Errors from the provider are passed through with their original status. See Errors.