POST
/
inference
/
completions
curl --request POST \
  --url https://api.nugen.in/inference/completions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "max_tokens": 400,
  "model": "nugen-legal",
  "prompt": "The sky is",
  "temperature": 1
}'
{
  "choices": [
    {
      "finish_reason": "stop",
      "index": 0,
      "text": "The sky is blue."
    }
  ],
  "created": 1623645497,
  "id": "nugen-1234",
  "model": "nugen-legal",
  "usage": {
    "completion_tokens": 5,
    "prompt_tokens": 5,
    "total_tokens": 10
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
model
string
required

The name of the model to use.

Example:

"nugen-embed-legal"

prompt
required

The prompt to generate completions for. It can be a single string or a list of strings. It can also be an array of integers or an array of integer arrays, which allows to pass already tokenized prompt. If multiple prompts are specified, several choices with corresponding index will be returned in the output.

Example:

"The sky is"

max_tokens
integer | null
default:16

The maximum number of tokens to generate in the completion.

If the token count of your prompt plus max_tokens exceed the model's context length, max_tokens will be lowered to fit in the context window instead of returning an error.

Required range: x >= 0
Example:

400

temperature
number | null
default:1

What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.

Required range: 0 <= x <= 2
Example:

1

Response

200
application/json
Successful Response
id
string
required

A unique identifier of the response.

created
number
required

Timestamp when the response was generated.

model
string
required

The model used for the completion.

choices
object[]
required

The list of generated completion choices.

usage
object | null