Create completion

post/v1/completions

Create a text completion from a given prompt.

Authentication

Send your OLETOKEN API key as a Bearer token. Keys are created on the API Keys page of the console.

Authorization: Bearer $OLETOKEN_API_KEY

Request body

Content-Type:application/json

FieldTypeRequiredDescription
modelstring
promptstring | string[]
max_tokensinteger
temperaturenumber
top_pnumber
ninteger
streamboolean
stopstring | string[]
suffixstring
echoboolean

Responses

200Response created

FieldTypeRequiredDescription
idstring
objectstring
createdinteger
modelstring
choicesobject[]
textstring
indexinteger
finish_reasonstring
usageUsage
prompt_tokensintegerNumber of prompt tokens
completion_tokensintegerNumber of completion tokens
total_tokensintegerTotal number of tokens
prompt_tokens_detailsobject
cached_tokensinteger
text_tokensinteger
audio_tokensinteger
image_tokensinteger
completion_tokens_detailsobject
text_tokensinteger
audio_tokensinteger
reasoning_tokensinteger

Example request

curl -X POST 'https://api.oletoken.ai/v1/completions' \
  -H "Authorization: Bearer $OLETOKEN_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "string",
    "prompt": "string"
  }'