- Send Request
- Model List and Price
- Model APIs
- Chat API
- Chat Completions API
- Image API
- Embedding Vector Generation Interface (Embeddings)
- Audio
- Help Center
Chat Completions API
POST
https://api.gptnb.me/v1/completions
Request
Header Params
Authorization
string
optional
Example:
Bearer {{YOUR_API_KEY}}
Body Params application/json
model
string
required
prompt
string
optional
The prompt(s) to generate completions for, encoded as a string, array of strings, array of tokens, or array of token arrays. Note that <|endoftext|> is the document separator that the model sees during training, so if a prompt is not specified the model will generate as if from the beginning of a new document.
max_tokens
integer
optional
temperature
integer
optional
top_p
integer
optional
n
integer
optional
stream
boolean
optional
logprobs
null
optional
stop
string
optional
Example
{
"model": "gpt-3.5-turbo-instruct",
"prompt": "Say this is a test",
"max_tokens": 7,
"temperature": 0,
"top_p": 1,
"n": 1,
"stream": false,
"logprobs": null,
"stop": "\n"
}
Request samples
Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://api.gptnb.me/v1/completions' \
--header 'Authorization: Bearer ' \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "gpt-3.5-turbo-instruct",
"prompt": "Say this is a test",
"max_tokens": 7,
"temperature": 0,
"top_p": 1,
"n": 1,
"stream": false,
"logprobs": null,
"stop": "\n"
}'
Responses
🟢200Ok
application/json
Body
id
string
required
object
string
required
created
integer
required
model
string
required
choices
array [object {4}]
required
text
string
optional
index
integer
optional
logprobs
null
optional
finish_reason
string
optional
usage
object
required
prompt_tokens
integer
required
completion_tokens
integer
required
total_tokens
integer
required
Example
{
"id": "cmpl-uqkvlQyYK7bGYrRHQ0eXlWi7",
"object": "text_completion",
"created": 1589478378,
"model": "text-davinci-003",
"choices": [
{
"text": "\n\nThis is indeed a test",
"index": 0,
"logprobs": null,
"finish_reason": "length"
}
],
"usage": {
"prompt_tokens": 5,
"completion_tokens": 7,
"total_tokens": 12
}
}