AIU. - Artificial Intelligence Utility

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > AI - Artificial Intelligence Commands > AIU. - OpenAI API > !Image Generation >

AIU. - Artificial Intelligence Utility

AIU.GenerateURL

Previous Top Next


MiniRobotLanguage (MRL)

 

AIU.GenerateURL
Generate an Image and Return a URL

 

Intention

 

GenerateURL Command: Creating Images via URL
 
The GenerateURL command enables you to generate an image based on a text prompt and receive a URL linking to the created image.

This is ideal for applications where you need quick access to an image hosted online without saving it locally.

It’s part of the AIU - OpenAI API suite.

 

What is the GenerateURL Command?

 

The GenerateURL command sends a text prompt to the OpenAI API, which generates an image and returns a URL pointing to it.

You can store the URL in a variable or copy it to the clipboard for immediate use. The image generation settings (size, quality, etc.) are configurable via related AIU commands.

 

Why Do You Need It?

 

This command is essential when you need to:

Generate visuals dynamically for web applications or online content.

Avoid local storage overhead by accessing images via URLs.

Integrate AI-generated images into workflows with minimal setup.

 

How to Use the GenerateURL Command?

 

Provide a text prompt describing the desired image, and optionally specify a variable to store the URL and a flag to copy it to the clipboard.

Image generation settings like size and quality must be preconfigured using commands such as AIU.SetImageSize and AIU.SetImageQuality.

Available models and their prices (as of March 18, 2025, from OpenAI’s pricing page) include:

gpt-4o: $5.00/1M input tokens, $15.00/1M output tokens (multimodal, 128K context).

gpt-4o-mini: $0.15/1M input tokens, $0.60/1M output tokens (cost-effective, 128K context).

gpt-4-turbo: $10.00/1M input tokens, $30.00/1M output tokens (high performance, 128K context).

gpt-3.5-turbo: $0.50/1M input tokens, $1.50/1M output tokens (dialog-optimized, 16K context).

o1-preview: $15.00/1M input tokens, $60.00/1M output tokens (advanced reasoning, 128K context).

o1-mini: $3.00/1M input tokens, $12.00/1M output tokens (reasoning, cost-effective, 128K context).

 

Example Usage

 

AIU.GenerateURL|A serene beach sunset|$$URL|1

DBP.Generated Image URL: $$URL

 

This example generates an image of a serene beach sunset, stores the URL in $$URL, and copies it to the clipboard.

 

Illustration

 

┌────────────────────────────┐

│ Prompt: "A serene beach"   │

├────────────────────────────┤

│ URL: https://example.com/  │

└────────────────────────────┘

The command converts a prompt into a URL linking to the generated image.

 

Syntax

 

AIU.GenerateURL|P1[|P2][|P3]

AIU.Generate_URL|P1[|P2][|P3]

 

Parameter Explanation

 

P1 - The text prompt describing the image to generate (required).

P2 - (Optional) The variable to store the generated URL. If omitted, the URL is placed on the Top of Stack (TOS).

P3 - (Optional) A flag (1 or 0). If 1, the URL is copied to the clipboard; if 0 or omitted, it is not.

 

Example

 

AIU.SetImageSize|1024x1024

AIU.GenerateURL|A majestic mountain landscape|$$URL|1

DBP.Image URL: $$URL

ENR.

 

Remarks

 

- Ensure the API key is set using AIU.SetKey before using this command.

- The URL’s lifespan depends on OpenAI’s hosting policies.

 

Limitations

 

- Requires a valid OpenAI API key and internet connection.

- Image generation is subject to OpenAI’s rate limits and costs.

 

See also:

 

AIU.GenerateFile

AIU.SetImageSize

AIU.SetImageQuality

Image Generation