Create Response

Create Response API

The Create Response API allows you to generate AI-powered responses with support for both text and image inputs. It supports both streaming and non-streaming response modes.

Endpoint

POST https://api.aeronpay.co.in/payal-api/api/serviceapi-prod/api/ai/create-response

Request Structure

Headers

Content-Type: application/json
client-id: YOUR_CLIENT_ID
client-secret: YOUR_CLIENT_SECRET

Request Body Example

{
  "client_referenceId": "ref123456",
  "user": {
    "text": "This is a test message",
    "images": [
      "https://example.com/image1.jpg",
      "https://example.com/image2.png"
    ]
  },
  "stream": true,
  "context_token": "apay_abc123XYZ"
}

Response Examples

Non-Stream Response

When stream is set to false or not provided, you'll receive a complete response:

{
  "status": "SUCCESS",
  "status_code": "200",
  "message": "Response generation successful.",
  "response_status": "completed",
  "context_token": "apay_68946e7042d481a3829228037001395f08ecc0bf999ba6b7",
  "parent_context_token": null,
  "system": {
    "msg_id": "msg_68946e718b8c81a388c1b442e9be4ef408ecc0bf999ba6b7",
    "text": "India is a diverse and vibrant country in South Asia, known for its rich cultural heritage, ancient history, and democratic governance. It is the world's second-most populous nation and features a variety of languages, religions, and traditions. India is a rapidly developing economy with significant contributions in technology, agriculture, and industry."
  }
}

Stream Response

When stream is set to true, you'll receive multiple events:

Event: response_initiated

{
  "status": "PENDING",
  "status_code": "102",
  "message": "Response generation initiated.",
  "event": "response_initiated",
  "response_status": "initiated",
  "context_token": "apay_68946f93d7d48192a20ca597945780fd03f17a6a593fca89",
  "parent_context_token": null,
  "system": []
}

Event: response_output

{
  "status": "PROCESSING",
  "status_code": "206",
  "event": "response_output",
  "sequence_no": 2,
  "system": {
    "msg_id": "msg_68946f948cdc8192bec8a22fda97dca403f17a6a593fca89",
    "text_chunk": "Laravel"
  }
}

Event: response_completed

{
  "status": "SUCCESS",
  "status_code": "200",
  "message": "Response generation successful.",
  "event": "response_completed",
  "response_status": "completed",
  "context_token": "apay_68946f93d7d48192a20ca597945780fd03f17a6a593fca89",
  "parent_context_token": null,
  "system": {
    "msg_id": "msg_68946f948cdc8192bec8a22fda97dca403f17a6a593fca89",
    "text": "**Laravel** is a popular open-source PHP web framework designed for building modern, secure, and scalable web applications. It follows the MVC (Model-View-Controller) architectural pattern and offers an elegant syntax, robust tools, and built-in features like routing, authentication, ORM (Eloquent), caching, and queue management to streamline development."
  }
}

Request Parameters

FieldTypeRequiredDescription
client_referenceIdstringYesUnique client reference ID (max 30 characters)
userobjectYesUser object containing text and images
user.textstringYesText input associated with the user
user.imagesarrayNoAn array of image URLs. Minimum 1 if provided
user.images[*]stringYes if images parameter mentionedEach image must be a valid image URL (.jpg, .jpeg, .png, .webp, .gif). Required if user.images is present.
streambooleanNoWhether to stream the response. Defaults to false if not provided
context_tokenstringNoOptional token. The unique token of the previous response to create multi-turn conversations. Must match format apay_ followed by alphanumeric chars

Response Fields

Common Response Fields

  • status - Response status (SUCCESS, PENDING, PROCESSING, FAILED)
  • status_code - HTTP status code
  • message - Response message
  • context_token - Unique token for this response (used for multi-turn conversations)
  • parent_context_token - Token of the previous request in the conversation chain

Non-Stream Specific Fields

  • response_status - Always "completed" for non-stream responses
  • system.text - Complete response text
  • system.msg_id - Unique message identifier

Stream Specific Fields

  • event - Event type (response_initiated, response_output, response_completed)
  • response_status - Current status (initiated, processing, completed)
  • sequence_no - Sequence number for ordered processing
  • system.text_chunk - Partial response text (in response_output events)
Language
Click Try It! to start a request and see the response here!