Generation, not retrieval
Image-generation models create graphical data from a natural-language text prompt. The key point: the image is original — generated by the model from its training, not retrieved from a database or catalog. It is not a search system.
Key concept · Models in Foundry
Foundry supports several image-generation models, including the OpenAI gpt-image-1 series and the Black Forest Labs FLUX series. Find them in the Model Catalog by filtering the inference task to "text to image." Input is everyday descriptive language — e.g. "A robot eating spaghetti" yields an original illustration of that scene.
Experiment before you code
After creating a Foundry project, the Images playground lets you experiment with a deployed model: submit prompts, view the generated images, set the resolution/size, and — where the model supports it — provide a reference image the model uses as a basis for its output.
Key concept · Model-dependent features
Capabilities like image size/resolution control and reference-image input are subject to model support — not every model exposes every option. The playground is where you confirm what a given model offers before wiring it into an app, and it can surface sample code for the client.
Generate and save in code
Developers build image apps with language-specific SDKs (OpenAI Python SDK, Azure OpenAI .NET SDK).
Key concept · images.generate and its parameters
Call client.images.generate(model=…, prompt=…, n=1, size="1024x1024"). Parameters: model (e.g. "FLUX.1-Kontext-pro"), prompt (the description), n (how many images), and size (dimensions). The API returns a binary stream — typically Base64-encoded in data[0].b64_json — which you Base64-decode and write to a file such as image.png.
Chapter 24 quiz
Fourteen questions on image models, the playground, and the client app. Answer first, then expand Show answer.
Part A · Multiple choice
How does an image-generation model produce its output?
- A It generates an original image from the prompt
- B It searches a catalog for a matching photo
- C It edits a stock image
- D It downloads from the web
Show answer
A. Original generation, not retrieval or search.
Which model series are available for image generation in Foundry?
- A gpt-image-1 and FLUX
- B Sora-2 and gpt-4o-tts
- C Phi-4 and Whisper
- D DALL·E only
Show answer
A. OpenAI gpt-image-1 and Black Forest Labs FLUX.
How do you find image-generation models in the Model Catalog?
- A Filter the inference task to "text to image"
- B Search "audio"
- C Filter by "embeddings"
- D They aren't in the catalog
Show answer
A — "text to image."
What can the Images playground let you provide as a basis for output (model permitting)?
- A A reference image
- B A SAS URL
- C An SSML document
- D A vector index
Show answer
A — a reference image. Plus prompt and resolution.
Which method generates an image in the OpenAI Python SDK?
- A client.images.generate
- B client.videos.create
- C client.audio.speech.create
- D client.responses.create
Show answer
A — client.images.generate.
Which parameter sets how many images to generate?
- A n
- B size
- C seconds
- D voice
Show answer
A — n. size sets the dimensions.
Part B · True or false
Image-generation models retrieve existing images that match the prompt.
Show answer
False. They generate new, original images.
Features like resolution control and reference images are model-dependent.
Show answer
True. Not every model exposes every option.
The API returns the generated image as a binary stream you decode and save.
Show answer
True. Base64-decode data[0].b64_json, then write to a file.
You can use the Azure OpenAI .NET SDK to build an image-generation app.
Show answer
True. Or the OpenAI Python SDK.
The prompt for image generation must be written in a special code syntax.
Show answer
False. It's natural, descriptive language.
Part C · Short answer
Name the four parameters of images.generate shown in the module.
Show answer
model, prompt, n, and size.
Where in the API response is the encoded image found?
Show answer
data[0].b64_json — Base64, decoded before saving.
What's the core distinction between an image-generation model and image search?
Show answer
Generation creates a new original image; search retrieves an existing one.