export const metadata = {
    title: 'Image',
    description: 'Generate images',
}

# Image

Generate images from text. {{ className: 'lead' }}

---

<Row>
    <Col>

        ## Create image {{tag:'POST', label:'http://localhost:33322/v1/image/generations'}}

        Given a text prompt, generate 1 or more images according to the prompt.

        ### Required attributes

        <Properties>
            <Property name="prompt" type="string">
                A description of the images to be generated.
            </Property>
        </Properties>

        <Properties>
            <Property name="model" type="string">
                The model used for image generations. (WARNING: At the moment only "stable-diffusion-2-1" is allowed)
                <ul>
                    <li>
                        If the model name is "default", the chat model from the configuration is used (see [Documentation &raquo; Configuration](/documentation/configuration) for details).
                    </li>
                    <li>
                        If the model name is a valid model name recognized by Edgen, it is what is used.
                    </li>
                </ul>

            </Property>
        </Properties>

        ### Optional attributes

        <Properties>
            <Property name="width" type="integer">
                The width of the generated image.
            </Property>
        </Properties>

        <Properties>
            <Property name="height" type="integer">
                The height of the generated image.
            </Property>
        </Properties>

        <Properties>
            <Property name="uncond_prompt" type="string">
                The optional unconditional prompt.
            </Property>
        </Properties>

        <Properties>
            <Property name="steps" type="integer">
                The number of steps to be used in the diffusion process.
            </Property>
        </Properties>

        <Properties>
            <Property name="images" type="integer">
                The number of images to generate.
                Default: 1
            </Property>
        </Properties>

        <Properties>
            <Property name="seed" type="integer">
                The random number generator seed to use for the generation.
                By default, a random seed is used.
            </Property>
        </Properties>

        <Properties>
            <Property name="guidance_scale" type="float">
                The guidance scale to use for generation, that is, how much should the model follow the prompt.
                Values below 1 disable guidance. (the prompt is ignored)
            </Property>
        </Properties>

        <Properties>
            <Property name="vae_scale" type="float">
                The Variational Auto-Encoder scale to use for generation.
                Required if `model` is not a pre-made descriptor name.
                This value should probably not be set, if `model` is a pre-made descriptor name.
            </Property>
        </Properties>

    </Col>
    <Col sticky>

        <ButtonRow types={["Default"]}>

            <div>
                <CodeGroup title="Request" tag="POST" label="/v1/chat/completions">

                    ```bash {{ title: 'cURL' }}
                    curl http://localhost:33322/v1/image/generations \
                    -H "Content-Type: application/json" \
                    -H "Authorization: Bearer no-key-required" \
                    -d '{
                    "model": "stable-diffusion-2-1",
                    "prompt": "A rusty robot"
                }'
                    ```

                    ```python
                    API NOT DONE YET
                    ```

                    ```ts
                    API NOT DONE YET
                    ```

                </CodeGroup>

                ```json {{ title: 'Response' }}
                {"images": [[123, 234, ..., 231, 213]]}
                ```
            </div>
        </ButtonRow>

    </Col>
</Row>
