POST
/
v1
/
completions
curl --request POST \
  --url https://nano-gpt.com/api/v1/completions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "chatgpt-4o-latest",
  "prompt": "<string>",
  "max_tokens": 4000,
  "temperature": 0.7,
  "top_p": 1,
  "stream": false,
  "stop": "<string>",
  "frequency_penalty": 0,
  "presence_penalty": 0
}'
{
  "id": "<string>",
  "object": "<string>",
  "created": 123,
  "model": "<string>",
  "choices": [
    {
      "text": "<string>",
      "index": 123,
      "logprobs": {},
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 123,
    "completion_tokens": 123,
    "total_tokens": 123
  }
}

Authorizations

Authorization
string
header
required

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

Body

application/json
Parameters for text completion
model
string
default:chatgpt-4o-latest
required

The model to use for completion

prompt
string
required

The text prompt to complete

max_tokens
integer
default:4000

Maximum number of tokens to generate

temperature
number
default:0.7

Controls randomness (0-2)

top_p
number
default:1

Nucleus sampling parameter (0-1)

stream
boolean
default:false

Whether to stream the response

stop

Up to 4 sequences where the API will stop generating

frequency_penalty
number
default:0

Penalty for frequency of tokens (-2 to 2)

presence_penalty
number
default:0

Penalty for presence of tokens (-2 to 2)

Response

200
application/json
Text completion response
id
string

Unique identifier for the completion

object
string

Object type, always 'text_completion'

created
integer

Unix timestamp of when the completion was created

model
string

Model used for completion

choices
object[]

Array of completion choices

usage
object