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

# Create a Prompt

> Step-by-step guide to creating effective prompts

This guide walks you through creating a new prompt for your endpoint.

## Prerequisites

Before creating a prompt, ensure you have:

* An endpoint created
* Input schema defined (so you know what data you'll receive)
* Output schema defined (optional, but recommended)

## Creating a Prompt

<Steps>
  <Step title="Navigate to the Endpoint">
    Open the endpoint you want to add a prompt to.
  </Step>

  <Step title="Go to Prompts Tab">
    Click the **Prompts** tab in the endpoint workspace.
  </Step>

  <Step title="Click Create Prompt">
    Click the **Create Prompt** button.
  </Step>

  <Step title="Configure Basic Settings">
    Fill in the prompt details:

    | Field           | Description                                    |
    | --------------- | ---------------------------------------------- |
    | **Name**        | Descriptive name (e.g., "Detailed Summary v2") |
    | **Model**       | Select the LLM to use                          |
    | **Temperature** | Randomness (0.0 - 1.0)                         |
    | **Max Tokens**  | Maximum response length                        |
  </Step>

  <Step title="Write the Template">
    Enter your prompt template using Liquid syntax.
  </Step>

  <Step title="Save">
    Click **Save** to create the prompt as a Draft.
  </Step>
</Steps>

## Prompt Settings Explained

### Model Selection

Choose from available models:

| Provider      | Models                           | Best For                          |
| ------------- | -------------------------------- | --------------------------------- |
| **OpenAI**    | GPT-4o, GPT-4, GPT-3.5-turbo     | General purpose, coding, analysis |
| **OpenAI**    | gpt-image-1                      | Image generation and editing      |
| **Anthropic** | Claude 3 Opus, Sonnet, Haiku     | Long context, nuanced responses   |
| **Google**    | Gemini 2.0 Flash, Gemini 2.5 Pro | Fast multimodal, vision           |

<Tip>
  Start with GPT-4o or Claude 3 Sonnet for the best balance of quality and speed. For image generation, use gpt-image-1.
</Tip>

<Note>
  Select an **image generation model** when your endpoint has image output fields. Select a **vision model** (GPT-4o, Claude 3, Gemini) when your endpoint has image inputs with text/JSON outputs.
</Note>

### Temperature

Controls randomness in responses:

| Value         | Behavior                  | Use Case                          |
| ------------- | ------------------------- | --------------------------------- |
| **0.0 - 0.3** | Deterministic, consistent | Classification, extraction, facts |
| **0.4 - 0.6** | Balanced                  | General tasks, summarization      |
| **0.7 - 1.0** | Creative, varied          | Creative writing, brainstorming   |

### Max Tokens

Maximum tokens in the response:

* **Short responses** (100-500): Classifications, extractions
* **Medium responses** (500-2000): Summaries, analyses
* **Long responses** (2000+): Detailed reports, long-form content

<Warning>
  Higher max tokens = higher costs. Set appropriate limits for your use case.
</Warning>

### Custom Parameters for Image Generation

When using an image generation model, use the **Custom Parameters** panel to configure provider-specific options like size, quality, and background.

Custom Parameters are defined as a JSON array of name/value pairs:

```json theme={null}
[
  { "name": "size", "value": "1024x1536" },
  { "name": "quality", "value": "high" },
  { "name": "background", "value": "transparent" }
]
```

**Parameter precedence:** Hardcoded defaults → Output Field Example Value → Custom Parameters

<Warning>
  These parameters are **model/provider-specific**. Check your provider's API documentation for supported values. For example, `background` is an OpenAI-specific parameter.
</Warning>

<Note>
  Image generation prompts don't need JSON output instructions — the prompt itself is the image description sent to the generation API.
</Note>

A system-level instruction that sets context:

```
You are a professional content editor with 20 years of experience. 
You always provide constructive, actionable feedback.
```

<Note>
  Not all models support system prompts. When unsupported, it's prepended to the main prompt.
</Note>

## Writing Effective Templates

### Structure Your Prompt

A well-structured prompt typically includes:

1. **Role/Context** — Who is the AI in this scenario
2. **Instructions** — What to do, step by step
3. **Input Data** — The user's data to process
4. **Output Format** — How to structure the response

### Example: Complete Prompt

```liquid theme={null}
You are an expert content analyst specializing in {{ inputs.industry | default: "general" }} content.

## Your Task
Analyze the provided text and extract key insights.

## Instructions
1. Read the content carefully
2. Identify the {{ inputs.num_insights | default: 3 }} most important insights
3. For each insight, provide:
   - A concise title
   - A brief explanation
   - Relevance score (1-10)

## Content to Analyze
{{ inputs.content | truncate: 10000 }}

{% if inputs.focus_areas %}
## Focus Areas
Pay special attention to:
{% for area in inputs.focus_areas %}
- {{ area }}
{% endfor %}
{% endif %}

## Output Format
Return a JSON object:
{
  "insights": [
    {
      "title": "string",
      "explanation": "string",
      "relevance": number
    }
  ],
  "overall_summary": "string"
}

Return only valid JSON, no additional text.
```

## Common Patterns

### Classification

```liquid theme={null}
Classify the following text into one of these categories:
{% for cat in inputs.categories %}
- {{ cat }}
{% endfor %}

Text: {{ inputs.text }}

Return JSON: {"category": "selected", "confidence": 0.0-1.0}
```

### Extraction

```liquid theme={null}
Extract the following information from the text:
- Names of people
- Dates mentioned
- Key actions or events

Text: {{ inputs.text }}

Return JSON with arrays for each type.
```

### Generation

```liquid theme={null}
Write a {{ inputs.tone }} {{ inputs.content_type }} about {{ inputs.topic }}.

Requirements:
- Length: approximately {{ inputs.word_count | default: 200 }} words
- Audience: {{ inputs.audience | default: "general" }}
{% if inputs.keywords %}
- Include these keywords: {{ inputs.keywords | join: ", " }}
{% endif %}
```

### Transformation

```liquid theme={null}
Rewrite the following text to be more {{ inputs.style }}.

Original:
{{ inputs.text }}

Maintain the core meaning while improving {{ inputs.focus }}.
```

## Testing Your Prompt

After saving, test immediately:

1. Click the **Test** button next to your prompt
2. Fill in the auto-generated form with sample data
3. Click **Run Test**
4. Review the response
5. Iterate on your template as needed

<Tip>
  Test with edge cases: empty optional fields, very long inputs, unusual values. Your prompt should handle them gracefully.
</Tip>

## Best Practices

<AccordionGroup>
  <Accordion title="Be explicit about output format" icon="brackets-curly">
    If you need JSON, say so explicitly and provide an example structure.
  </Accordion>

  <Accordion title="Use numbered instructions" icon="list-ol">
    LLMs follow numbered steps more reliably than prose paragraphs.
  </Accordion>

  <Accordion title="Set clear boundaries" icon="border-all">
    Tell the model what NOT to do: "Do not include explanations outside the JSON."
  </Accordion>

  <Accordion title="Provide examples" icon="lightbulb">
    Few-shot examples dramatically improve consistency for complex tasks.
  </Accordion>

  <Accordion title="Handle edge cases" icon="code-branch">
    Use conditionals to handle missing data: `{% if inputs.optional_field %}`
  </Accordion>
</AccordionGroup>

## Next Steps

<CardGroup cols={2}>
  <Card title="Testing Prompts" icon="flask" href="/prompts/testing">
    Learn to test prompts thoroughly
  </Card>

  <Card title="Prompt Versions" icon="code-branch" href="/prompts/versions">
    Understand versioning and promotion
  </Card>
</CardGroup>
