# Create Image

The `Create Image` tool is part of AgentiPy. Based on its name and implementation, it is used for generating images using OpenAI's DALL·E models. The tool requires an OpenAI API key to be configured within the `SolanaAgentKit`.

## Functionality

This tool is implemented in the `ImageGenerator` class.

### Key Methods:

* `create_image(agent: SolanaAgentKit, prompt: str, size: str = "1024x1024", n: int = 1)`:
  * Takes a `SolanaAgentKit` instance (which should have `openai_api_key` set), a text `prompt` for the image generation, the desired `size` (defaulting to "1024x1024"), and the number of images `n` to generate (defaulting to 1).
  * Checks if the `openai_api_key` is present in the agent's configuration.
  * Uses the `openai.Image.create` method (from the `openai` library) to request image generation based on the provided parameters.
  * Returns a dictionary containing a list of URLs for the generated images.

##

**Note:** This tool interacts with the OpenAI API and requires a valid API key. Ensure that the `openai` library is installed and that your API key has the necessary permissions and quota for image generation.

## Source Code

You can find the source code for this tool on GitHub: <https://github.com/niceberginc/agentipy/blob/main/agentipy/tools/create_image.py>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.agentipy.fun/tools/create-image.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
