Create new chat
API Documentation: Create Chat Completion
Endpoint
Description
This endpoint creates a chat completion based on a conversation between the user and the AI model.
Request
cURL Example:
Replace {API_KEY}
with your actual API key.
Request Body:
messages
: (array) A list of message objects with:role
: (string) "user" or "system".content
: (string) The text content of the message.
Response
The response will be a JSON object containing the AI's reply and metadata:
text
: The generated text response.cost
: The amount charged for this interaction.role
: The role from which the response originates (typically "system").chat_id
: A unique identifier for the conversation session. can be user later to continue conversation for that topic.model
: The name of the model used to generate the completion.
Notes
Ensure you send valid JSON in your request body.
Costs depend on model usage and token counts.
Using
"model": "auto"
allows automatic selection based on request text you send.
Last updated