logoPofano

Text Completions

Legacy text completion endpoint.

POST /v1/completions

Traditional text completion endpoint. Given a prompt, the model generates text that continues from where the prompt leaves off. This is the legacy completion format — for conversational AI, prefer using Chat Completions.

Parameters#

ParameterTypeRequiredDescription
modelstringYesThe model ID to use.
promptstring/arrayYesThe prompt to generate completions for.
max_tokensintegerNoMaximum number of tokens to generate.
temperaturenumberNoSampling temperature between 0 and 2.
top_pnumberNoNucleus sampling parameter.
nintegerNoNumber of completions to generate.
streambooleanNoIf true, response is streamed.
stopstring/arrayNoSequences where generation stops.

Example Requests#

cURL#

curl https://ai.pofano.com/v1/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "gpt-3.5-turbo-instruct",
    "prompt": "Once upon a time in a land far away,",
    "max_tokens": 100,
    "temperature": 0.8
  }'

Python#

import requests

response = requests.post(
    "https://ai.pofano.com/v1/completions",
    headers={
        "Authorization": "Bearer YOUR_API_KEY",
        "Content-Type": "application/json"
    },
    json={
        "model": "gpt-3.5-turbo-instruct",
        "prompt": "Once upon a time in a land far away,",
        "max_tokens": 100,
        "temperature": 0.8
    }
)

print(response.json())

JavaScript#

const response = await fetch("https://ai.pofano.com/v1/completions", {
  method: "POST",
  headers: {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    model: "gpt-3.5-turbo-instruct",
    prompt: "Once upon a time in a land far away,",
    max_tokens: 100,
    temperature: 0.8
  })
});

const data = await response.json();
console.log(data);

On this page