Documentation
OpenAI Endpoints
OpenAI Responses API in mAuthor
The Responses API allows developers to integrate OpenAI capabilities directly into mAuthor. This set of endpoints handles the full lifecycle of an AI interaction, including creating conversation sessions, sending configurable prompts, and retrieving message history.
Base URL: /api/v2/openai/responses
Authentication
All requests require a valid JWT Token passed in the Authorization header.
Authorization: JWT <your_token_here>
Endpoints
1. Create Conversation
Initializes a new conversation session.
- Method:
POST - Endpoint:
/conversation
Example Request
curl --location --request POST '/api/v2/openai/responses/conversation' \
--header 'Authorization: JWT ' \
--header 'Content-Type: application/json'
2. Send Message
Sends a user message to the AI model. This endpoint allows for full configuration of the AI persona and generation parameters per message.
- **Method: POST
- **Endpoint:
/send_message
Request Body Parameters
| Parameter | Type | Description | Example |
|---|---|---|---|
model | string | The OpenAI model identifier to be used for generating the response. | "gpt-4" |
instructions | string | The system prompt or persona definition that guides the AI's behavior. | "You are a helpful physics tutor." |
text | string | The actual input message or query from the user. | "Explain gravity." |
temperature | float | Controls the randomness of the output. Range: 0.0 (deterministic) to 2.0 (creative). | 0.7 |
top_p | float | An alternative to sampling with temperature, called nucleus sampling. | 1.0 |
conversation_id | string | The unique ID of the active conversation session. | "conv_69283..." |
Example Request
curl --location --request POST '/api/v2/openai/responses/send_message' \
--header 'Authorization: JWT ' \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "gpt-4",
"instructions": "You are a helpful assistant.",
"text": "Test message",
"temperature": 0.7,
"top_p": 1.0,
"conversation_id": "conv_69283d925c2c81979096cd829e5ac3c70db1094e30cbd5d7"
}'
3. Get Conversation History
Retrieves the full history of messages exchanged in a specific conversation.
- **Method: GET
- **Endpoint:
/conversation/{conversation_id}
URL Parameters
conversation_id (string): The unique identifier of the conversation to retrieve.
Example Request
curl --location --request GET '/api/v2/openai/responses/conversation/conv_69283d925c2c81979096cd829e5ac3c70db1094e30cbd5d7' \
--header 'Authorization: JWT '