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

# Adding Custom Prompts

<Badge icon="arrow-left" color="gray">[Back to Prompts Library](/ai-for-service/generative-ai-tools/prompts-library)</Badge>

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](/ai-for-service/generative-ai-tools/llm-integration).

### 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**.

   <img src="https://mintcdn.com/koreai-apis/gjVE-XYJ79Rt43Ek/ai-for-service/generative-ai-tools/images/prl(13).png?fit=max&auto=format&n=gjVE-XYJ79Rt43Ek&q=85&s=1160848648692eddf2af8edc7788b5fe" alt="New prompt — name, feature, model" width="1922" height="846" data-path="ai-for-service/generative-ai-tools/images/prl(13).png" />

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

   <img src="https://mintcdn.com/koreai-apis/gjVE-XYJ79Rt43Ek/ai-for-service/generative-ai-tools/images/prl(3).png?fit=max&auto=format&n=gjVE-XYJ79Rt43Ek&q=85&s=2bd60c52d45c3793f6d513e186055ab6" alt="Configuration section" width="1857" height="600" data-path="ai-for-service/generative-ai-tools/images/prl(3).png" />

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

   <img src="https://mintcdn.com/koreai-apis/gjVE-XYJ79Rt43Ek/ai-for-service/generative-ai-tools/images/prl(9).png?fit=max&auto=format&n=gjVE-XYJ79Rt43Ek&q=85&s=b3c45d7489e9a7a47f5086c4b2910770" alt="Request section" width="1922" height="851" data-path="ai-for-service/generative-ai-tools/images/prl(9).png" />

   **To import an existing prompt:**

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

      <img src="https://mintcdn.com/koreai-apis/gjVE-XYJ79Rt43Ek/ai-for-service/generative-ai-tools/images/import-from-library.gif?s=4d260efc5269beaf55bdf990a69add16" alt="Import from Prompts and Requests Library" width="1910" height="824" data-path="ai-for-service/generative-ai-tools/images/import-from-library.gif" />

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

      <Note>You can interchange prompts between features.</Note>

   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.

   <img src="https://mintcdn.com/koreai-apis/gjVE-XYJ79Rt43Ek/ai-for-service/generative-ai-tools/images/prl(8).png?fit=max&auto=format&n=gjVE-XYJ79Rt43Ek&q=85&s=552bccfa6e27e38c62ca3ef92b9c08d7" alt="Start from scratch" width="1887" height="593" data-path="ai-for-service/generative-ai-tools/images/prl(8).png" />

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

   <img src="https://mintcdn.com/koreai-apis/gjVE-XYJ79Rt43Ek/ai-for-service/generative-ai-tools/images/stream-1.jpg?fit=max&auto=format&n=gjVE-XYJ79Rt43Ek&q=85&s=1201c853bf1e7b9cc4ffaae9b67e0b4d" alt="Stream Response toggle" width="1920" height="827" data-path="ai-for-service/generative-ai-tools/images/stream-1.jpg" />

<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.
</Note>

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

   <img src="https://mintcdn.com/koreai-apis/gjVE-XYJ79Rt43Ek/ai-for-service/generative-ai-tools/images/prl(6).png?fit=max&auto=format&n=gjVE-XYJ79Rt43Ek&q=85&s=18929bfd2a304dce0667e9f54aafd0aa" alt="Test response" width="1920" height="854" data-path="ai-for-service/generative-ai-tools/images/prl(6).png" />

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**.

   <img src="https://mintcdn.com/koreai-apis/gjVE-XYJ79Rt43Ek/ai-for-service/generative-ai-tools/images/selectkey.jpg?fit=max&auto=format&n=gjVE-XYJ79Rt43Ek&q=85&s=3b6bc497e13f9de3e9be0c59cc98b12d" alt="Select response key" width="1911" height="904" data-path="ai-for-service/generative-ai-tools/images/selectkey.jpg" />

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

   <img src="https://mintcdn.com/koreai-apis/gjVE-XYJ79Rt43Ek/ai-for-service/generative-ai-tools/images/responsepath.jpg?fit=max&auto=format&n=gjVE-XYJ79Rt43Ek&q=85&s=7f51379216edc7d974fede4b39e0bee7" alt="Response path" width="1909" height="910" data-path="ai-for-service/generative-ai-tools/images/responsepath.jpg" />

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

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

      <img src="https://mintcdn.com/koreai-apis/gjVE-XYJ79Rt43Ek/ai-for-service/generative-ai-tools/images/prl(2).png?fit=max&auto=format&n=gjVE-XYJ79Rt43Ek&q=85&s=fdeba3a13dcf09936bef0a0e7143673c" alt="Matching responses" width="1922" height="842" data-path="ai-for-service/generative-ai-tools/images/prl(2).png" />

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

      <img src="https://mintcdn.com/koreai-apis/gjVE-XYJ79Rt43Ek/ai-for-service/generative-ai-tools/images/prl(12).png?fit=max&auto=format&n=gjVE-XYJ79Rt43Ek&q=85&s=2f94c2562cece3b1c0dd77117aa03194" alt="Mismatched responses" width="1137" height="411" data-path="ai-for-service/generative-ai-tools/images/prl(12).png" />

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

         <img src="https://mintcdn.com/koreai-apis/gjVE-XYJ79Rt43Ek/ai-for-service/generative-ai-tools/images/prl(11).png?fit=max&auto=format&n=gjVE-XYJ79Rt43Ek&q=85&s=eed326a9cd190ec7873b8a09323f3099" alt="Post processor script" width="1536" height="842" data-path="ai-for-service/generative-ai-tools/images/prl(11).png" />

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

         <img src="https://mintcdn.com/koreai-apis/gjVE-XYJ79Rt43Ek/ai-for-service/generative-ai-tools/images/prl(4).png?fit=max&auto=format&n=gjVE-XYJ79Rt43Ek&q=85&s=2ff527db5d3c3d0ff85f79b80d5b89d6" alt="Post processor result" width="1542" height="840" data-path="ai-for-service/generative-ai-tools/images/prl(4).png" />

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`

    <img src="https://mintcdn.com/koreai-apis/gjVE-XYJ79Rt43Ek/ai-for-service/generative-ai-tools/images/token-mapping.png?fit=max&auto=format&n=gjVE-XYJ79Rt43Ek&q=85&s=688e354100519b2aabdd0e132f690c65" alt="Token key mapping" width="1920" height="717" data-path="ai-for-service/generative-ai-tools/images/token-mapping.png" />

    <Note>Without this mapping, the Platform can't calculate token consumption, which may lead to untracked usage and unexpected costs.</Note>

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