> ## Documentation Index
> Fetch the complete documentation index at: https://koreai.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Adding Custom Prompts

[Back to Prompts Library](https://koreai.mintlify.site/ai-for-service/generative-ai-tools/prompts-library.md)

Reference and procedures for managing Custom prompts in the Prompts Library.

***

## Add a Custom Prompt

### Prerequisites

Integrate a pre-built or custom LLM before creating a prompt. See [LLM Integration](https://koreai.mintlify.site/ai-for-service/generative-ai-tools/llm-integration.md).

### Steps

1. Go to **Generative AI Tools** > **Prompts Library**.

2. Click **+ New Prompt** (top right).

3. Enter the **Prompt Name**, then select the **Feature** and **Model**.

   ![New prompt — name, feature, model](https://mintcdn.com/koreai/-BaBa3k-bT6jIgtl/ai-for-service/generative-ai-tools/images/prl\(13\).png?fit=max\&auto=format\&n=-BaBa3k-bT6jIgtl\&q=85\&s=88195a7de3dc1b91ee5975c798b09194)

4. The **Configuration** section (endpoint URL, auth, headers) is auto-populated from the model integration and is read-only.

   ![Configuration section](https://mintcdn.com/koreai/-BaBa3k-bT6jIgtl/ai-for-service/generative-ai-tools/images/prl\(3\).png?fit=max\&auto=format\&n=-BaBa3k-bT6jIgtl\&q=85\&s=d1faff4e003ee3e2e8cb53b9d7f246a7)

5. In the **Request** section, create a prompt or import an existing one.

   ![Request section](https://mintcdn.com/koreai/-BaBa3k-bT6jIgtl/ai-for-service/generative-ai-tools/images/prl\(9\).png?fit=max\&auto=format\&n=-BaBa3k-bT6jIgtl\&q=85\&s=84a87370f17b20aeefbe48104e04a33c)

   **To import an existing prompt:**

   1. Click **Import from Prompts and Requests Library**.

      ![Import from Prompts and Requests Library](https://mintcdn.com/koreai/s3bkaKmzowgJ31et/ai-for-service/generative-ai-tools/images/import-from-library.gif?s=eef222817699f7e8c26391256f26eb40)

   2. Select the **Feature**, **Model**, and **Prompt**. Hover and click **Preview Prompt** to review before importing.

      > [!NOTE]
      >
      > You can interchange prompts between features.

   3. Click **Confirm** to import the prompt into the JSON body.

   **To create from scratch:**

   Click **Start from scratch** and enter the JSON request for the LLM.

   ![Start from scratch](https://mintcdn.com/koreai/-BaBa3k-bT6jIgtl/ai-for-service/generative-ai-tools/images/prl\(8\).png?fit=max\&auto=format\&n=-BaBa3k-bT6jIgtl\&q=85\&s=2e82d0b4033c3e253501ac7d0e449455)

6. (Optional) Toggle **Stream Response** to enable streaming. Responses are sent incrementally in real time instead of waiting for the full response.

   ![Stream Response toggle](https://mintcdn.com/koreai/s3bkaKmzowgJ31et/ai-for-service/generative-ai-tools/images/stream-1.jpg?fit=max\&auto=format\&n=s3bkaKmzowgJ31et\&q=85\&s=7793899d1eb7cadf9504237093056164)

> [!NOTE]
>
> * Add `"stream": true` to the custom prompt when streaming is enabled. The saved prompt displays a "streaming" tag.
> * Enabling streaming disables the "Exit Scenario" field.
>   Streaming applies only to Agent Node and Prompt Node features using OpenAI and Azure OpenAI models.

7. Fill in the **Sample Context Values** and click **Test**. If successful, the LLM response is displayed; otherwise an error appears. See [Dynamic Variables](https://koreai.mintlify.site/ai-for-service/automation/agent-node#reference-dynamic-variables)

   ![Test response](https://mintcdn.com/koreai/-BaBa3k-bT6jIgtl/ai-for-service/generative-ai-tools/images/prl\(6\).png?fit=max\&auto=format\&n=-BaBa3k-bT6jIgtl\&q=85\&s=e3a87d81753d4f9407d4f26680374fa8)

8. **Map the response key:** In the JSON response, double-click the key that holds the relevant information (for example, `content`). The Platform generates a **Response Path** for that location. Click **Save**.

   ![Select response key](https://mintcdn.com/koreai/s3bkaKmzowgJ31et/ai-for-service/generative-ai-tools/images/selectkey.jpg?fit=max\&auto=format\&n=s3bkaKmzowgJ31et\&q=85\&s=4a2e6f69bcfab1cd14ab5fbe129b999a)

9. Click **Lookup Path** to validate the path.

   ![Response path](https://mintcdn.com/koreai/s3bkaKmzowgJ31et/ai-for-service/generative-ai-tools/images/responsepath.jpg?fit=max\&auto=format\&n=s3bkaKmzowgJ31et\&q=85\&s=b93fc5e7a1a0025c32f390dc20bd8238)

10. Review the **Actual Response** and **Expected Response**:

    * **Green (match):** Click **Save**. Skip to step 12.

      ![Matching responses](https://mintcdn.com/koreai/-BaBa3k-bT6jIgtl/ai-for-service/generative-ai-tools/images/prl\(2\).png?fit=max\&auto=format\&n=-BaBa3k-bT6jIgtl\&q=85\&s=2448c2aed5f83fd974a55d19940ba6c7)

    * **Red (mismatch):** Click **Configure** to open the Post Processor Script editor.

      ![Mismatched responses](https://mintcdn.com/koreai/-BaBa3k-bT6jIgtl/ai-for-service/generative-ai-tools/images/prl\(12\).png?fit=max\&auto=format\&n=-BaBa3k-bT6jIgtl\&q=85\&s=8504e2dae1e177e655752c0630558872)

      1. Enter the **Post Processor Script** and click **Save & Test**.

         ![Post processor script](https://mintcdn.com/koreai/-BaBa3k-bT6jIgtl/ai-for-service/generative-ai-tools/images/prl\(11\).png?fit=max\&auto=format\&n=-BaBa3k-bT6jIgtl\&q=85\&s=9d6e3722df605c0254a6deb0612fc1fa)

      2. Verify the result, then click **Save**. The responses turn green.

         ![Post processor result](https://mintcdn.com/koreai/-BaBa3k-bT6jIgtl/ai-for-service/generative-ai-tools/images/prl\(4\).png?fit=max\&auto=format\&n=-BaBa3k-bT6jIgtl\&q=85\&s=63aea636d2e3473a3ce84815816084ad)

11. (Optional) If **Token Usage Limits** are enabled for your custom model, map the token keys for accurate tracking:

    * **Request Tokens key:** `usage.input_tokens`
    * **Response Tokens key:** `usage.output_tokens`

    ![Token key mapping](https://mintcdn.com/koreai/s3bkaKmzowgJ31et/ai-for-service/generative-ai-tools/images/token-mapping.png?fit=max\&auto=format\&n=s3bkaKmzowgJ31et\&q=85\&s=6b54a3dac98bec774c074e7d8561f12a)

    > [!NOTE]
    >
    > Without this mapping, the Platform can't calculate token consumption, which may lead to untracked usage and unexpected costs.

12. Click **Save**. The prompt appears in the Prompts Library.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.