AITRE API Documents(English)
  1. Auto Completions Interface(Completions)
AITRE API Documents(English)
  • AITRE Introduction
  • Project Description
  • Send Request
  • Openai's format(Chat)
    • Gpt-4o-image(Generate Image)
      POST
    • Chat Completions Interface
      POST
  • Audio Interface(Audio)
    • TTS(speech-to-text)
      POST
    • Transcriptions
      POST
    • Translations
      POST
  • Embeddings Interface(Embeddings)
    • Embeddings
    • Create Embeddings
      POST
  • Images Generations(Images)
    • Openai's format Gpt-image-1
      POST
    • Openai's format Flux
      POST
    • Openai's format DALL·E 3
      POST
  • Models Interface(Models)
    • Model
      GET
  • Auto Completions Interface(Completions)
    • Completions
      POST
  • MidJourney
    • Description
    • Fetch task by id
      GET
    • Action
      POST
    • Blend(image to image)
      POST
    • Describe (image to text)
      POST
    • Imagine (text to image/image to image)
      POST
    • Modal(Partial redrawing、ZOOM)
      POST
    • Shorten(prompt analysis)
      POST
  1. Auto Completions Interface(Completions)

Completions

POST
{{BASE_URL}}/v1/completions
Given a prompt, the model will return the completion of one or more predictions and can also return the probability of alternative markers for each position.
The prompts and parameter creation provided have been completed

Request

Header Params
Authorization
string 
required
Provide your bearer token in the Authorization header when making requests to protected resources.
Example:
Authorization: Bearer ********************
Example:
Bearer {{YOUR_API_KEY}}
Body Params application/json
model
string 
required
The ID of the model to be used. You can use [List models]( https://platform.openai.com/docs/api-reference/models/list )API to view all available models, or view our [Model Overview]( https://platform.openai.com/docs/models/overview )To understand their descriptions.
prompt
string 
required

Generate a prompt for completion, encoded as a string, string array, tag array, or tag array array. Please note<| Endoftext |>is the document delimiter that the model sees during training, so if no prompt is specified, the model will generate the beginning of a new document.

best_of
integer 
optional
By default, generate best_of completion on the server side and return the 'best' completion (the one with the highest log probability for each token). Unable to stream results. When used with n, best_of controls the number of candidate completion, where n specifies the number to be returned - best_of must be greater than n. Note: Because this parameter generates a lot of completion, it can quickly consume your token quota. Please use with caution and ensure that you have reasonable settings for max_token and stop.
echo
boolean 
optional
Default to false. In addition to completion, it also displays a prompt
frequency_penalty
number 
optional
The default is a number between 0-2.0 and 2.0. Punish new tokens based on the current frequency of the text, reducing the possibility of the model repeating the same line word for word.
logit_bias
object 
optional

The default value is null, and the probability of the specified token appearing during modification is specified. Accept a JSON object that maps a token (specified by the token ID in the GPT tokenizer) to an associated bias value ranging from -100 to 100. You can use this tokenizer tool (applicable to GPT-2 and GPT-3) to convert text into token IDs. Mathematically speaking, bias is added to the generated logit before sampling the model. The exact effect varies depending on the model, but values between -1 and 1 should decrease or increase the likelihood of selection; Values like -100 or 100 should result in the disabling or exclusive selection of the relevant token. For example, you can pass {"50256": -100} to prevent the generation of<| endoftext |>tokens.

logprobs
null 
optional
Default to null
Including the log probabilities of logprobes' most likely tokens and the selected tokens. For example, if logprobes is 5, the API will return a list of 5 most likely tokens. The API always returns the logprob of the sampling token, so there may be a maximum of 1 logprobs element in the response.
The maximum value of logprobes is 5.
max_tokens
integer 
optional
Default is 16
The maximum number of tokens generated during completion.
The token count plus max_token cannot exceed the context length of the model. Python code example for counting tokens.
n
integer 
optional
Default is 1
The number of completion generated for each prompt.
Note: Because this parameter generates a lot of completion, it can quickly consume your token quota. Please use with caution and ensure that you have reasonable settings for max_token and stop.
presence_penalty
number 
optional
The default is a number between 0-2.0 and 2.0. Punish new tokens based on whether they appear in the current text, increasing the likelihood of the model discussing new topics. For more information about frequency and existence penalties, please refer to.
seed
integer 
optional
If specified, our system will make every effort to sample deterministically so that repeated requests using the same seeds and parameters should return the same results. We do not guarantee certainty, you should refer to the system_fingerprint response parameter to monitor backend changes.
stop
string 
optional
The default is null for up to 4 sequences, and the API will stop generating more tokens within them. The returned text will not contain a stop sequence.
stream
boolean 
optional
Default is false, whether to flow back partial progress. If set, the token will be sent as a data only server event when available, and the stream will be terminated by a data: [DONE] message. Object message terminated. Python code example.
suffix
string 
optional
The default suffix is null, which appears after the completion of inserting text.
temperature
integer 
optional
The default sampling temperature to be used is 1, between 0 and 2. A higher value (such as 0.8) will make the output more random, while a lower value (such as 0.2) will make it more concentrated and deterministic. We usually recommend changing this or top_p, rather than both.
user
string 
required
top_p
integer 
optional
Representing the unique identifier of the end user, which can help OpenAI monitor and detect abuse. Learn more.
Example
{
  "model": "gpt-3.5-turbo-instruct",
  "prompt": "Say this is a test",
  "max_tokens": 7,
  "temperature": 0
}

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 -g --request POST '{{BASE_URL}}/v1/completions' \
--header 'Authorization: Bearer {{YOUR_API_KEY}}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "gpt-3.5-turbo-instruct",
    "prompt": "Say this is a test",
    "max_tokens": 7,
    "temperature": 0
  }'

Responses

🟢200Ok
application/json
Body
id
string 
required
object
string 
required
created
integer 
required
model
string 
required
system_fingerprint
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": "gpt-3.5-turbo-instruct",
  "system_fingerprint": "fp_44709d6fcb",
  "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
  }
}
Modified at 2025-03-30 03:49:38
Previous
Model
Next
Description
Built with