Generate textures, icons and concept art for Unreal Engine 5 from a prompt with any OpenRouter image model, on your own API key. How to add the OpenRouter key with cfa keys, pick a model, pass parameters such as a transparent background or an aspect ratio, generate in bulk, and import the result as a texture.
CodeFizz Editor Agent can make images from a text prompt: textures, UI icons, concept art. It uses any image model on OpenRouter, saves each picture as a PNG or JPEG file, and can import it into your Unreal project as a texture in the same step. You pay OpenRouter directly with your own API key. CodeFizz adds no fee.
It needs cfa 3.1.0 or later. It works the same on Unreal Engine 5.6, 5.7 and 5.8 and needs no plugin update, because these commands run in the CLI itself. The editor only has to be open when you import.
The short version
1. Save your OpenRouter API key (you paste it, the screen shows stars):
bash
cfa keys set openrouter
2. See the image models you can use today:
bash
cfa list_image_models
3. Make a picture and import it as a texture:
bash
cfa generate_image --model recraft/recraft-v4.1-flash --prompt "a wooden crate with iron bands, game prop" --import-to /Game/Generated
Add your OpenRouter API key
1
Create a key on OpenRouter
Sign in at openrouter.ai/keys, create an API key, and add some credits to the account. Image requests are paid from those credits.
2
Save it with cfa
Run this in your own terminal and paste the key when it asks. Each character shows as a star, so the key never appears on screen, in a command flag or in your shell history.
bash
cfa keys set openrouter
3
Check it
The list shows each provider and only the last four characters of its key.
The key is saved in %LOCALAPPDATA%\CodeFizz\UnrealMCP\openrouter.key, encrypted with Windows DPAPI for your Windows user. A copy of that file is useless on another account or another machine. The key is sent only to OpenRouter, and cfa never prints it.
If you keep secrets in the environment, or you run in CI, set OPENROUTER_API_KEY instead. When that variable is set it wins over the saved key.
Your AI assistant cannot set the key. cfa keys is a terminal command only and is not offered to AI tools over MCP. Do not paste your key into an AI chat.
Pick a model from the live list
Image models change every month, so the list is read from OpenRouter at the moment you ask. A model released today shows up today. No key is needed to read it.
Every image model, with the parameter names each one takes:
bash
cfa list_image_models
Only models whose name or id contains a word:
bash
cfa list_image_models --filter flux
Only models that can make a transparent background:
bash
cfa list_image_models --parameter background --max-results 50
Read a model's parameters and price
Every model takes its own set of parameters with its own allowed values. One model allows a 16:9 picture, another does not. Ask the model before you pass anything:
One model's parameters, their allowed values, and its price list:
bash
cfa describe_image_model --model openai/gpt-image-1-mini
A parameter comes back as one of three rules: a list of allowed values, a minimum and maximum, or "any value" (a seed number, for example). Prices are set by OpenRouter and its providers, and they are shown per image, per megapixel or per token depending on the model.
Generate an image
One picture, wide format:
bash
cfa generate_image --model recraft/recraft-v4.1-flash --prompt "a small stone castle on a green hill at sunrise, game concept art" --params '{"aspect_ratio":"16:9"}'
An icon with a transparent background:
bash
cfa generate_image --model openai/gpt-image-1-mini --prompt "a red health potion in a round glass bottle, game item icon" --params '{"background":"transparent","aspect_ratio":"3:2","quality":"low"}' --name potion
The model names on this page were live when it was written. If one is gone, run cfa list_image_models and use a name from today's list.
Windows PowerShell 5.1 and the --params quotes
The examples work as written in PowerShell 7, Git Bash, and for an AI assistant. The older Windows PowerShell 5.1 strips the double quotes inside the JSON, and the command answers that --params must be a JSON object. There, put a backslash before each inner quote, '{\"aspect_ratio\":\"16:9\"}', or write the whole request to a file and pass --json '@request.json'.
Nothing is sent when something is wrong
Every model name and every parameter is checked against the model's own published rules before any request goes out. One wrong value stops the whole call and names every problem, so you do not pay for a request that would be refused.
a wrong parameter costs nothing
nothing was sent. Fix these and try again:
- job 1: openai/gpt-image-1-mini: aspect_ratio = "16:9" is not allowed. Allowed: 1:1, 3:2, 2:3, auto
- job 1: openai/gpt-image-1-mini: background = "see-through" is not allowed. Allowed: auto, transparent, opaque
Check the key, the models and every parameter, then send nothing:
bash
cfa generate_image --model openai/gpt-image-1-mini --prompt "a red potion icon" --params '{"background":"transparent"}' --dry-run
Many images in one call
Give several prompts and several models, and every prompt runs on every model. Requests run side by side (four at a time by default, up to eight with --concurrency), and the result keeps your order with the file and the cost of each picture. One call takes up to 64 jobs.
Two prompts on two models makes four pictures:
bash
cfa generate_image --prompts '["a wooden crate, game prop","a hanging paper lantern, game prop"]' --models '["recraft/recraft-v4.1-flash","black-forest-labs/flux.2-klein-4b"]'
Full control: a model, parameters and a file name for each picture:
bash
cfa generate_image --json '{"jobs":[{"name":"potion","model":"openai/gpt-image-1-mini","prompt":"a red health potion icon","params":{"background":"transparent"}},{"name":"castle","model":"recraft/recraft-v4.1-flash","prompt":"a stone castle on a hill","params":{"aspect_ratio":"16:9"}}]}'
A request that was already sent cannot be taken back. If some jobs fail after others worked, the result lists both, and each failed job carries its own error.
The project is found from the folder your terminal is in. Outside a project the files go to ./cfa-images/<date_time>/. Use --output-dir to pick any folder. The result always gives the folder as output_dir and the full path of each picture in files.
Every file is a PNG or a JPEG. Some models answer in WebP, which Unreal cannot import, so those pictures are converted to PNG for you with no loss.
Import the pictures into Unreal
With the editor open, add --import-to and each picture also lands in your project as a texture named T_<file name>. The command checks that the editor answers before it sends anything, so you are not charged for pictures that could not be imported.
Generate and import in one call:
bash
cfa generate_image --model openai/gpt-image-1-mini --prompt "a red health potion icon" --params '{"background":"transparent"}' --import-to /Game/UI/Icons
Or look at the files first, then import one later with the normal import command:
bash
cfa import_asset --source-file "C:/MyGame/Saved/CodeFizzEditorAgent/Images/20261010_113814/01_potion.png" --destination-path /Game/UI/Icons --destination-name T_Potion
Use reference images
Models that take pictures as input can be guided by your own images. describe_image_model says whether a model takes them and how many. Pass local files or web addresses:
Image to image, from a local file:
bash
cfa generate_image --model black-forest-labs/flux.2-klein-4b --prompt "the same shield, but made of gold" --reference-images "C:/Art/shield.png"
Or just ask your AI assistant
You do not have to type any of this. The skill that ships with the CLI teaches your assistant the same steps: read the live model list, read the model's parameters and price, check with a dry run, then generate. After the key is saved, you can ask in plain words:
things you can ask
Make a health potion icon with a transparent background, use the cheapest model that supports it, and import it into /Game/UI/Icons.
Generate four concept art options for a desert market stall, 16:9, on two different models, and tell me what it cost.
Make a stone wall texture, import it, and use it in the wall material.
If your assistant does not know these commands yet, update its skill with cfa skill install. See The AI Skill.
What it costs
You pay OpenRouter for each picture from your own credits. Every result carries cost_usd for each job and total_cost_usd for the call, as reported by OpenRouter. As a guide, in tests on 10 October 2026 a 1024 by 1024 picture on recraft/recraft-v4.1-flash cost $0.007, and a low quality transparent 1536 by 1024 icon on openai/gpt-image-1-mini cost about $0.003. Prices change, so read them with describe_image_model.
Common errors
no OpenRouter API key is set
Run cfa keys set openrouter in a terminal, or set OPENROUTER_API_KEY.
The key was refused (401)
The key is wrong or was deleted on OpenRouter. Check it with cfa keys, then save a new one.
Your OpenRouter account has no credits left (402)
Add credits on OpenRouter, then run the command again.
OpenRouter is limiting your rate (429)
Try again later, or lower --concurrency. Short limits are retried for you.
--import-to needs the Unreal editor
Open your project in Unreal, or leave --import-to out and import the files later. Nothing was sent.
Command summary
List your API keys, with only the last four characters shown:
bash
cfa keys
Save or remove the OpenRouter key:
bash
cfa keys set openrouter
cfa keys remove openrouter