Skip to main content

Create Completion

Creates a completion for the provided prompt and parameters.

Basic Parameters

ParameterDescription
Max TokensThe maximum number of tokens to generate in the completion.
ModelID of the model to use. You can use the List models API to see all of your available models, or see our Model overview for descriptions of them.
PromptThe 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.

Advanced Parameters

ParameterDescription
StopUp to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence.
TemperatureWhat 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.We generally recommend altering this or top_p but not both.
UserA unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. Learn more.

Example Output

{
"choices": [
{
"finish_reason": "string",
"index": 0,
"logprobs": {
"text_offset": [
0
],
"token_logprobs": [
0
],
"tokens": [
"string"
],
"top_logprobs": [
{}
]
},
"text": "string"
}
],
"created": 0,
"id": "string",
"model": "string",
"object": "string",
"usage": {
"completion_tokens": 0,
"prompt_tokens": 0,
"total_tokens": 0
}
}

Workflow Library Example

Create Completion with Openai and Send Results Via Email

Workflow LibraryPreview this Workflow on desktop