> For the complete documentation index, see [llms.txt](https://developers.alpha.wtf/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.alpha.wtf/prompts.md).

# Prompts

#### Prerequisites

* **Account Requirement:**
  * Developers need a valid account for integration. It's recommended to create a separate account specifically for handling custom prompts, distinct from your main account.

#### Registration Process

1. **Accessing the Platform:**
   * Log in to Alpha.
   * Navigate to the 'Apps' section.
   * Select 'Create Prompts'.
2. **Prompt Registration:**
   * In the 'Create Prompts' section, register your custom prompt and the corresponding endpoint URL.
   * Set the pricing for each use of your prompt during the registration process.
   * Payment for using your prompt is made using a specific token of your account. This will be sent to your community treasury.
   * Generate and register an `x-api-key` to secure your endpoint. This key will be used by the system to authenticate requests sent to your endpoint.

#### Handling Incoming Requests

* **Request Triggering:**
  * When a user's message matches your registered prompt, the system sends a POST request to your specified endpoint.
* **Request Format:**
  * The POST request will be structured as follows:

```html
POST https://[your registered endpoint] HTTP/1.1
Content-Type: application/json
x-api-key: [your registered api key]

{
	"prompt": "[your registered prompt]",
	"data": "all the text, including your /prompt",
}
```

#### Responding to Requests

* **Response Structure:**
  * Your endpoint should respond with the following JSON object:

```json
{
	"msg": "your custom message",
	"data": {"type":"image","data":"data:image/jpeg;base64,abcxyz"}
}
```

#### Example Scenario

* **Scenario: Echo Prompt**
  * User sends `/echo GM`.
  * System sends a POST request to `https://alpha.wtf`:

```
POST https://alpha.wtf HTTP/1.1
Content-Type: application/json
{
	"prompt": "echo",
	"data": "/echo GM",
}
```

Your endpoint responds:

```
{
	"msg": "GM"
}
```

#### Demo

* **GitHub Demo:**
  * For a practical demonstration, check out the `prompt-demo` repository on GitHub:
    * [TrustlessComputer/prompt-demo](https://github.com/TrustlessComputer/prompt-demo)
  * This demo provides a clear example of how to set up and handle custom prompts.

#### Notes

* Ensure endpoint capability for POST requests and JSON format response.
* The `x-api-key` is essential for security. Generate, register, and handle it with care.
* Prompt and standard-compliant responses are crucial.

By following these instructions, developers can effectively integrate their custom prompts with our system, ensuring seamless interaction and response handling.
