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

# Improve Prompt - AI Prompt Enhancement API | Magnific API

> Enhance text prompts for AI image and video generation. Transform basic descriptions into detailed, optimized prompts with language support. Improve generation results automatically.

<Card title="AI-powered prompt enhancement" icon="pen-fancy">
  Transform simple text descriptions into optimized prompts for AI image and video generation, improving output quality automatically.
</Card>

Improve Prompt is an AI-powered prompt enhancement API that transforms basic text descriptions into detailed, optimized prompts for AI generation. Submit a simple prompt like "a cat" and receive an enhanced version with specific details about lighting, composition, style, and atmosphere. The API supports both image and video generation prompts, with multi-language output capabilities.

### Key capabilities

* **Dual-mode enhancement**: Optimize prompts for either image or video generation with mode-specific improvements
* **Multi-language support**: Output enhanced prompts in any language using ISO 639-1 codes (e.g., `en`, `es`, `fr`, `de`)
* **Creative generation**: Submit an empty prompt to generate creative ideas from scratch
* **Maximum prompt length**: Input prompts up to 2,500 characters for comprehensive enhancement
* **Context-aware improvements**: Adds relevant details for lighting, composition, style, mood, and technical parameters
* **Async processing**: Webhook notifications or polling for task completion

### Use cases

* **Text-to-image workflows**: Enhance prompts before sending to Flux, Mystic, or other image generation APIs
* **Video generation preparation**: Optimize prompts for Kling, WAN, or other video generation models
* **Creative brainstorming**: Generate detailed creative prompts from minimal input or ideas
* **Non-English content creation**: Create prompts in your preferred language for localized projects
* **Batch processing pipelines**: Automate prompt enhancement in production workflows
* **Quality improvement**: Consistently achieve better AI generation results with optimized prompts

### Enhance prompts with Improve Prompt

Submit a text prompt with the target generation type (image or video). The service returns a task ID for async polling or webhook notification.

<div className="my-11">
  <Columns cols={2}>
    <Card title="POST /v1/ai/improve-prompt" icon="pen-fancy" href="/api-reference/improve-prompt/post-improve-prompt">
      Create a new prompt enhancement task
    </Card>

    <Card title="GET /v1/ai/improve-prompt" icon="list" href="/api-reference/improve-prompt/get-improve-prompt">
      List all prompt enhancement tasks
    </Card>

    <Card title="GET /v1/ai/improve-prompt/{task-id}" icon="magnifying-glass" href="/api-reference/improve-prompt/get-{task-id}-by-id">
      Get task status and results by ID
    </Card>
  </Columns>
</div>

### Parameters

| Parameter     | Type     | Required | Default | Description                                                                                                             |
| ------------- | -------- | -------- | ------- | ----------------------------------------------------------------------------------------------------------------------- |
| `prompt`      | `string` | Yes      | -       | Text prompt to improve for AI generation. Can be empty to generate a creative prompt. Maximum length: 2,500 characters. |
| `type`        | `string` | Yes      | -       | Type of generation to optimize for: `"image"` or `"video"`                                                              |
| `language`    | `string` | No       | `"en"`  | Language code for the improved prompt (ISO 639-1 format, e.g., `"en"`, `"es"`, `"fr"`)                                  |
| `webhook_url` | `string` | No       | -       | URL for task completion notification                                                                                    |

## Frequently Asked Questions

<AccordionGroup>
  <Accordion title="What is Improve Prompt and how does it work?">
    Improve Prompt is an AI-powered API that enhances basic text descriptions into detailed, optimized prompts for AI image or video generation. You submit a simple prompt (e.g., "a sunset") with the target type (image or video), receive a task ID immediately, then poll for results or receive a webhook notification. The output is an enhanced prompt with added details about composition, lighting, style, and technical parameters.
  </Accordion>

  <Accordion title="What is the difference between image and video prompt types?">
    The `type` parameter determines how the prompt is optimized. For `"image"` prompts, the API adds details about composition, lighting, color palette, and visual style. For `"video"` prompts, it includes motion descriptions, camera movements, temporal flow, and cinematic elements that help video generation models produce better results.
  </Accordion>

  <Accordion title="Can I generate prompts in languages other than English?">
    Yes. Use the `language` parameter with any ISO 639-1 language code (e.g., `"es"` for Spanish, `"fr"` for French, `"de"` for German, `"ja"` for Japanese). The enhanced prompt will be returned in your specified language. Default is English (`"en"`).
  </Accordion>

  <Accordion title="What happens if I submit an empty prompt?">
    When you submit an empty prompt, the API generates a creative prompt from scratch. This is useful for brainstorming or when you want AI-generated creative ideas for image or video generation.
  </Accordion>

  <Accordion title="What is the maximum prompt length?">
    Input prompts can be up to 2,500 characters. This allows you to provide detailed context that the API will further enhance and optimize.
  </Accordion>

  <Accordion title="How long does prompt enhancement take?">
    Prompt enhancement typically completes within 2-5 seconds. For production workflows, use webhooks instead of polling to receive immediate notification when tasks complete.
  </Accordion>

  <Accordion title="What are the rate limits for Improve Prompt?">
    Rate limits vary by subscription tier. See [Rate Limits](/ratelimits) for current limits.
  </Accordion>

  <Accordion title="How much does Improve Prompt cost?">
    See the [Pricing page](/pricing) for current rates and subscription options.
  </Accordion>
</AccordionGroup>

## Best practices

* **Be specific**: Even simple prompts benefit from context - include subject, action, or mood hints
* **Choose the right type**: Use `"image"` for static visuals and `"video"` for motion content
* **Language matching**: Set the language parameter to match your target audience or downstream model preferences
* **Chain with generation**: Pipe enhanced prompts directly to Flux, Mystic, Kling, or other generation APIs
* **Production integration**: Use webhooks instead of polling for scalable applications
* **Error handling**: Implement retry logic with exponential backoff for 503 errors

## Related APIs

* **[Magnific Mystic](/api-reference/mystic/mystic)**: Generate photorealistic images in 1K/2K/4K with LoRA styles
* **[Flux Pro](/api-reference/text-to-image/flux-pro-v1-1/post-flux-pro-v1-1)**: High-quality text-to-image generation with Flux Pro
* **[Kling 2.6 Pro](/api-reference/image-to-video/kling-v2.5-pro/overview)**: Generate videos from images with Kling
* **[Image to Prompt](/api-reference/image-to-prompt/post-image-to-prompt)**: Reverse process - generate prompts from images
