- Introduction
- Quick Start Guide
- Make a request
- Chat Models
- ChatGpt
- ChatGPT (Audio)
- ChatGPT (Chat)
- Chat completion object
- Create chat completion (streaming)
- Create chat completion (non-streaming)
- Create chat image recognition (streaming)
- Create chat image recognition (streaming) base64
- Create chat image recognition (non-streaming)
- Function calling
- N choices
- Create chat function call (only non-streaming)
- Create structured output
- ChatGPT (Completions)
- ChatGPT(Embeddings)
- Anthropic Claude
- Gemini
- Image Models
- MJ
- Ideogram
- Kling Image
- DALL·E 3POST
- Flux (OpenAI dall-e-3 format)POST
- Video Models
- Music Model - Suno
- Illustrate
- Parameter
- Task submission
- Query interface
- Python Samples
- python openai official library (using AutoGPT, langchain, etc.)
- Python uses speech to text
- Python uses text to speech
- Python uses Embeddings
- python calls DALL·E
- python simple call openai function-calling demo
- python langchain
- python llama_index
- Python uses gpt-4o to identify pictures-local pictures
- python library streaming output
- Python uses gpt-4o to identify images
- Plug-in/software usage tutorials
- Help Center
Creation completed
Complete creation for the provided prompts and parameters
Request
Generates a completed prompt, encoded as a string, an array of strings, an array of tokens, or an array of token arrays. Note that <|endoftext|> is the document delimiter that the model sees during training, so if no hints are specified, the model will generate the beginning of a new document.
Defaults to null The probability of occurrence of the specified token in modification completion. Accepts a JSON object that maps a token (specified by the token ID in the GPT tokenizer) to an associated bias value, -100 to 100. You can use this tokenizer tool (available for GPT-2 and GPT-3) to convert text into token IDs. Mathematically speaking, the bias is added to the resulting logit before sampling the model. The exact effect varies from model to model, but values between -1 and 1 should reduce or increase the likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the token in question. For example, you can pass {"50256": -100} to prevent the <|endoftext|> token from being generated.
Includes the log probabilities of the logprobs most likely tokens, as well as the selected token. For example, if logprobs is 5, the API will return a list of the 5 most likely tokens. The API always returns the logprob of the sampled token, so there may be at most logprobs+1 elements in the response.
The maximum number of tokens generated in completion.
The number of completions generated for each prompt.
{
"model": "gpt-3.5-turbo-instruct",
"prompt": "hi,",
"max_tokens": 30,
"temperature": 0
}
Request samples
curl --location --request POST '/v1/completions' \
--header 'Authorization: Bearer {{YOUR_API_KEY}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "gpt-3.5-turbo-instruct",
"prompt": "hi,",
"max_tokens": 30,
"temperature": 0
}'
Responses
{
"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
}
}