{"id":29195689,"url":"https://github.com/gptscript-ai/dalle-image-generation","last_synced_at":"2025-07-02T05:05:30.808Z","repository":{"id":223739310,"uuid":"761394009","full_name":"gptscript-ai/dalle-image-generation","owner":"gptscript-ai","description":"Tool built with GPTScript in mind to generate images","archived":false,"fork":false,"pushed_at":"2024-08-11T16:05:57.000Z","size":6900,"stargazers_count":21,"open_issues_count":1,"forks_count":26,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-28T23:42:48.256Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gptscript-ai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-21T19:37:24.000Z","updated_at":"2025-03-06T23:18:25.000Z","dependencies_parsed_at":"2024-02-22T16:27:25.739Z","dependency_job_id":"a3c2643a-0387-44f3-bff9-9cf0a00f3fc1","html_url":"https://github.com/gptscript-ai/dalle-image-generation","commit_stats":null,"previous_names":["tylerslaton/gptscript-image-generation","gptscript-ai/image-generation","gptscript-ai/dalle-image-generation"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gptscript-ai/dalle-image-generation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gptscript-ai%2Fdalle-image-generation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gptscript-ai%2Fdalle-image-generation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gptscript-ai%2Fdalle-image-generation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gptscript-ai%2Fdalle-image-generation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gptscript-ai","download_url":"https://codeload.github.com/gptscript-ai/dalle-image-generation/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gptscript-ai%2Fdalle-image-generation/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263077632,"owners_count":23410167,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-07-02T05:05:29.956Z","updated_at":"2025-07-02T05:05:30.790Z","avatar_url":"https://github.com/gptscript-ai.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# image-generation\n\nThis CLI tool is a simple command-line interface for interacting with the OpenAI API. It was specifically created as a tool that GPTScript can leverage in order to provide the langauge with image generation capabilities.\nIt allows users to input a text prompt and get a response generated by OpenAI's GPT models.\nUsers can provide the API key directly as a command-line argument or set it through the credential tool.\n\n## Features\n\n- Accepts an OpenAI API key through the command line or environment variable.\n- Accepts a text prompt for image generation and displays the resulting images.\n- Supports image generation using a specified model, image size, quality, and the number of images to generate.\n\n## Prerequisites\n\n- Python 3.x\n- OpenAI API key\n\n## How to Build\n\nThis CLI tool does not require a build step, as it is a simple Python script. The only requirement is to install the necessary Python dependencies.\n\n## Installation\n\n1. Clone this repository or download the source code:\n\n    ```bash\n    git clone https://github.com/your-username/your-repo.git\n    cd your-repo\n    ```\n\n2. Install the required Python packages:\n\n    ```bash\n    pip install -r requirements.txt\n    ```\n\n## Usage\n\nYou can run this CLI tool using the following command format:\n\n```bash\npython cli.py --api-key YOUR_API_KEY --prompt \"Your text prompt here\" --model MODEL_NAME --size IMAGE_SIZE --quality IMAGE_QUALITY --number NUMBER_OF_IMAGES\n```\n\n### CLI Arguments\n| Argument | Short Command | Description | Example |\n|----------|---------------|-------------|---------|\n| API Key           | `-k` / `--api-key`   | Optional: Your OpenAI API key. Can also be set with OPENAI_API_KEY environment variable. Command-line option takes precedence.       | `--api-key YOUR_API_KEY`                  |\n| Prompt            | `-p` / `--prompt`    | Required: The text prompt for image generation.                                                                                    | `--prompt \"Your text prompt here\"`        |\n| Model             | `-m` / `--model`     | Optional: The model to use for image generation. Default is \"dall-e-3\".                                                            | `--model MODEL_NAME`                      |\n| Size              | `-s` / `--size`      | Optional: The size of the image to generate, in the format WxH (e.g., 1024x1024). Default is 1024x1024.                           | `--size IMAGE_SIZE`                       |\n| Quality           | `-q` / `--quality`   | Optional: The quality of the generated image. Allowed values are \"standard\" or \"hd\". Default is \"standard\".                        | `--quality IMAGE_QUALITY`                 |\n| Number | `-n` / `--number`    | Optional: The number of images to generate. Default is 1.                                                                          | `--number NUMBER`               |\n\n## Authentication\n\nAn OpenAI API key is needed in order to authenticate. When running the tool with GPTScript, the credential tool will\nprompt you to provide a key if you have not done so already. When running the Python program directly, you can provide\nit as a command-line argument or set it as an environment variable.\n\n### Setting the API Key as an Environment Variable\n\nOn Unix-like systems, you can set the environment variable like this:\n\n```bash\nexport OPENAI_API_KEY=\"your-api-key-here\"\n```\n\nOn Windows, you can set the environment variable like this:\n\n```cmd\nset OPENAI_API_KEY=your-api-key-here\n```\n\nAfter setting the environment variable, you only need to provide the prompt argument when running the tool:\n\n```bash\npython cli.py --prompt \"Describe a futuristic city.\"\n```\n\n## Examples\n\n### Tool Usage\nThis repository is made to integrate nicely with GPTScript. Accordingly, a [tool.gpt](./tool.gpt) file is provided that allows other GPTScripts to usage this tool.\nThe following is an example of how to use this tool in a GPTScript where it assumes that the tool is located in the parent directory of the GPTScript file:\n\n```gpt\ntools: ./tool.gpt\n\nYou are an expert in image generation. Please generate a cartoon lion standing proudly in the savannah.\n```\n\nYou can find this specific example in the [examples](./examples/example.gpt) file.\n\n### Images\n#### Cartoon lion standing proudly in the savannah\n```bash\npython cli.py --prompt \"Cartoon lion standing proudly in the savannah\" --quality \"standard\"\n```\n![Cartoon lion](./examples/lion.png)\n\n#### A realistic photograph of a squirrel writing some code in a peaceful meadow\n```bash\npython cli.py --prompt \"A realistic photograph of a squirrel writing some code in a peaceful meadow\" --quality \"hd\"\n```\n![Squirrel developer](./examples/squirrel-developer.png)\n\n\n#### The eiffel tower rendered photorealistically at night with a swirling sky as the background\n```bash\npython cli.py --prompt \"The eiffel tower rendered photorealistically at night with a swirling sky as the background\" --quality \"hd\"\n```\n![Eiffel tower](./examples/eiffel-tower.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgptscript-ai%2Fdalle-image-generation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgptscript-ai%2Fdalle-image-generation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgptscript-ai%2Fdalle-image-generation/lists"}