curl https://compute.prentis.ai/v1/completions \
-H "Authorization: Bearer $PRENTIS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-v4.1-flash",
"prompt": "def fibonacci(n):",
"max_tokens": 128,
"stop": ["\n\n"]
}'import os
from openai import OpenAI
client = OpenAI(base_url="https://compute.prentis.ai/v1", api_key=os.environ["PRENTIS_API_KEY"])
resp = client.completions.create(
model="deepseek-v4.1-flash",
prompt="def fibonacci(n):",
max_tokens=128,
stop=["\n\n"],
)
print(resp.choices[0].text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
prompt: '<string>',
stream: false,
stream_options: {include_usage: true},
max_tokens: 2,
temperature: 1,
top_p: 0.5,
stop: '<string>',
seed: 123,
frequency_penalty: 0,
presence_penalty: 0,
user: '<string>',
n: 123,
best_of: 123,
logprobs: 123,
echo: true,
suffix: '<string>'
})
};
fetch('https://compute.prentis.ai/v1/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://compute.prentis.ai/v1/completions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => '<string>',
'prompt' => '<string>',
'stream' => false,
'stream_options' => [
'include_usage' => true
],
'max_tokens' => 2,
'temperature' => 1,
'top_p' => 0.5,
'stop' => '<string>',
'seed' => 123,
'frequency_penalty' => 0,
'presence_penalty' => 0,
'user' => '<string>',
'n' => 123,
'best_of' => 123,
'logprobs' => 123,
'echo' => true,
'suffix' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://compute.prentis.ai/v1/completions"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"stream\": false,\n \"stream_options\": {\n \"include_usage\": true\n },\n \"max_tokens\": 2,\n \"temperature\": 1,\n \"top_p\": 0.5,\n \"stop\": \"<string>\",\n \"seed\": 123,\n \"frequency_penalty\": 0,\n \"presence_penalty\": 0,\n \"user\": \"<string>\",\n \"n\": 123,\n \"best_of\": 123,\n \"logprobs\": 123,\n \"echo\": true,\n \"suffix\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://compute.prentis.ai/v1/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"stream\": false,\n \"stream_options\": {\n \"include_usage\": true\n },\n \"max_tokens\": 2,\n \"temperature\": 1,\n \"top_p\": 0.5,\n \"stop\": \"<string>\",\n \"seed\": 123,\n \"frequency_penalty\": 0,\n \"presence_penalty\": 0,\n \"user\": \"<string>\",\n \"n\": 123,\n \"best_of\": 123,\n \"logprobs\": 123,\n \"echo\": true,\n \"suffix\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://compute.prentis.ai/v1/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"stream\": false,\n \"stream_options\": {\n \"include_usage\": true\n },\n \"max_tokens\": 2,\n \"temperature\": 1,\n \"top_p\": 0.5,\n \"stop\": \"<string>\",\n \"seed\": 123,\n \"frequency_penalty\": 0,\n \"presence_penalty\": 0,\n \"user\": \"<string>\",\n \"n\": 123,\n \"best_of\": 123,\n \"logprobs\": 123,\n \"echo\": true,\n \"suffix\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "cmpl-01K5S8PJ7D3M",
"object": "text_completion",
"created": 1789286400,
"model": "deepseek-v4.1-flash",
"choices": [
{
"index": 0,
"text": "\n a, b = 0, 1\n for _ in range(n):\n a, b = b, a + b\n return a",
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 6,
"completion_tokens": 34,
"total_tokens": 40
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"code": "INVALID_API_KEY",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"code": "INVALID_API_KEY",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"code": "INVALID_API_KEY",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"code": "INVALID_API_KEY",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"code": "INVALID_API_KEY",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"code": "INVALID_API_KEY",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"code": "INVALID_API_KEY",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"code": "INVALID_API_KEY",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"code": "INVALID_API_KEY",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"code": "INVALID_API_KEY",
"param": "<string>"
}
}Completions
Legacy text completion, for prompts that are not a conversation. Only models that declare the text-completion capability accept it; the rest return MODEL_CAPABILITY_UNSUPPORTED.
curl https://compute.prentis.ai/v1/completions \
-H "Authorization: Bearer $PRENTIS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-v4.1-flash",
"prompt": "def fibonacci(n):",
"max_tokens": 128,
"stop": ["\n\n"]
}'import os
from openai import OpenAI
client = OpenAI(base_url="https://compute.prentis.ai/v1", api_key=os.environ["PRENTIS_API_KEY"])
resp = client.completions.create(
model="deepseek-v4.1-flash",
prompt="def fibonacci(n):",
max_tokens=128,
stop=["\n\n"],
)
print(resp.choices[0].text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
prompt: '<string>',
stream: false,
stream_options: {include_usage: true},
max_tokens: 2,
temperature: 1,
top_p: 0.5,
stop: '<string>',
seed: 123,
frequency_penalty: 0,
presence_penalty: 0,
user: '<string>',
n: 123,
best_of: 123,
logprobs: 123,
echo: true,
suffix: '<string>'
})
};
fetch('https://compute.prentis.ai/v1/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://compute.prentis.ai/v1/completions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => '<string>',
'prompt' => '<string>',
'stream' => false,
'stream_options' => [
'include_usage' => true
],
'max_tokens' => 2,
'temperature' => 1,
'top_p' => 0.5,
'stop' => '<string>',
'seed' => 123,
'frequency_penalty' => 0,
'presence_penalty' => 0,
'user' => '<string>',
'n' => 123,
'best_of' => 123,
'logprobs' => 123,
'echo' => true,
'suffix' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://compute.prentis.ai/v1/completions"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"stream\": false,\n \"stream_options\": {\n \"include_usage\": true\n },\n \"max_tokens\": 2,\n \"temperature\": 1,\n \"top_p\": 0.5,\n \"stop\": \"<string>\",\n \"seed\": 123,\n \"frequency_penalty\": 0,\n \"presence_penalty\": 0,\n \"user\": \"<string>\",\n \"n\": 123,\n \"best_of\": 123,\n \"logprobs\": 123,\n \"echo\": true,\n \"suffix\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://compute.prentis.ai/v1/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"stream\": false,\n \"stream_options\": {\n \"include_usage\": true\n },\n \"max_tokens\": 2,\n \"temperature\": 1,\n \"top_p\": 0.5,\n \"stop\": \"<string>\",\n \"seed\": 123,\n \"frequency_penalty\": 0,\n \"presence_penalty\": 0,\n \"user\": \"<string>\",\n \"n\": 123,\n \"best_of\": 123,\n \"logprobs\": 123,\n \"echo\": true,\n \"suffix\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://compute.prentis.ai/v1/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"stream\": false,\n \"stream_options\": {\n \"include_usage\": true\n },\n \"max_tokens\": 2,\n \"temperature\": 1,\n \"top_p\": 0.5,\n \"stop\": \"<string>\",\n \"seed\": 123,\n \"frequency_penalty\": 0,\n \"presence_penalty\": 0,\n \"user\": \"<string>\",\n \"n\": 123,\n \"best_of\": 123,\n \"logprobs\": 123,\n \"echo\": true,\n \"suffix\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "cmpl-01K5S8PJ7D3M",
"object": "text_completion",
"created": 1789286400,
"model": "deepseek-v4.1-flash",
"choices": [
{
"index": 0,
"text": "\n a, b = 0, 1\n for _ in range(n):\n a, b = b, a + b\n return a",
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 6,
"completion_tokens": 34,
"total_tokens": 40
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"code": "INVALID_API_KEY",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"code": "INVALID_API_KEY",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"code": "INVALID_API_KEY",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"code": "INVALID_API_KEY",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"code": "INVALID_API_KEY",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"code": "INVALID_API_KEY",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"code": "INVALID_API_KEY",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"code": "INVALID_API_KEY",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"code": "INVALID_API_KEY",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"code": "INVALID_API_KEY",
"param": "<string>"
}
}Which models accept this
Only models that declare the text-completion capability. Everything else returnsMODEL_CAPABILITY_UNSUPPORTED, because answering a raw-prompt request on a model shaped
for conversation produces output that looks fine and is not what you asked for.
Most models here are chat models. If you are starting something new, use
chat completions — this endpoint exists so that code
written against the older shape keeps working.
One prompt per call
prompt takes a string, or an array holding exactly one string. Several prompts in one
call are rejected rather than partly answered.Authorizations
Authorization: Bearer <your API key>. On /v1/messages, the Anthropic-style x-api-key: <your API key> header is accepted instead.
Headers
Your own key for making a retry safe (up to 255 characters). It is accepted and echoed back today; de-duplication of replays arrives in a later release, so a retry is currently a second billable call.
255Body
Which model answers the call. A bare slug for platform models (deepseek-v4.1-flash), or a full resource name for something your account owns (accounts/{account}/models/{model}, or a deployment). Never an upstream vendor's own name.
The text to continue. A string, or an array holding exactly one string -- several prompts in one call are rejected rather than partly answered.
Return the answer as server-sent events as it is generated, instead of one response at the end. The last data event carries the usage numbers either way.
Streaming options. include_usage is accepted for compatibility; usage arrives on the final event whether or not you ask for it.
Show child attributes
Show child attributes
Ceiling on how many tokens may be generated. Omit it to use the model's own default.
x >= 1How much randomness to allow when picking each token. Lower is more repeatable, higher is more varied.
0 <= x <= 2Nucleus sampling: only consider the most likely tokens up to this share of the probability mass. Tune this or temperature, not both.
0 <= x <= 1Up to 4 strings that end generation as soon as the model produces one. The matched string is not included in the output.
Best effort repeatability: the same seed with the same parameters returns the same answer on models that support it.
Pushes the model away from tokens it has already used often in this answer. Negative values do the opposite.
-2 <= x <= 2Pushes the model away from tokens that have appeared at all in this answer, which tends to move it on to new ground.
-2 <= x <= 2Your own identifier for the end user behind the call. It is echoed back in this request's log line so you can correlate the two; it is not kept on the usage record.
How many completions to return.
Not supported. Sending it returns INVALID_REQUEST.
Sample several completions server-side and return the best one.
Not supported. Sending it returns INVALID_REQUEST.
Per-token log probabilities.
Not supported. Sending it returns INVALID_REQUEST.
Repeat the prompt back at the start of the completion.
Not supported. Sending it returns INVALID_REQUEST.
Text that should follow the completion (fill-in-the-middle).
Not supported. Sending it returns INVALID_REQUEST.
Response
OK. With stream: true the same call answers text/event-stream instead, one chunk per event, terminated by data: [DONE]; the last data event carries usage whether or not you asked for it.