v5 only
The OpenAI Chat Completions API enables chat interactions with OpenAI Large Language Models (LLMs). It can be used in systems that need to integrate chatbots or other language interactions based on Artificial Intelligence and offers a high degree of customization and control over the model's behavior.
In addition, to help structure and monitor requests and responses, the API has the following interceptors already configured in its flow:
To use the OpenAI Chat Completions API, you first need to import it into your Platform by following the steps below:
Download the API documentation.
Unzip the OpenAI_Chat_Completions_API.zip folder.
Import the OpenAI_Chat_Completions_API.yaml file into the Platform by using the Import/Export feature.
Deploy the API in an environment.
NOTEFor authentication, you must insert the API key received from OpenAI in the header of the request.
/v1POST in the endpoint /chat/completionsThe endpoint /chat/completions allows you to generate a chat interaction.
It:
Receives a list of messages in JSON format.
Uses these messages to interact with a language model chosen by the client.
Returns the replies generated by the model.
Format: JSON
Main fields:
model (string, required): Defines which language model will be used (e.g. gpt-4o).messages (array, required): List of messages in the conversation, in which each message contains:
role (string): Role of the author of the message, such as user, system or assistant.content (string): Textual content of the message.max_tokens (integer, optional): Limits the number of tokens generated in the reply.temperature (number, optional): Controls the creativity of the reply (smaller values generate more deterministic replies).top_p (number, optional): Nucleus sampling to limit the cumulative probability of the generated words.n (integer, optional): Number of replies that should be generated.stop (array, optional): Defines sequences that terminate the text generation.presence_penalty and frequency_penalty (numbers, optional): Penalize repetition and encourage originality.logit_bias (object, optional): Adjusts the probability of specific words.user (string, optional): Unique identifier to track a user's interaction.Status codes:
id (string): Unique identifier of the reply.choices (array): List of the generated replies, each with:
message: Message generated by the model, with role and content.finish_reason: Reason for ending the generation (e.g. stop).usage: Usage metrics for tokens (prompt, completion, total).AVAILABLE).Authorization header.We use cookies to enhance your experience on our site. By continuing to browse, you agree to our use of cookies.Learn more