Skip to Content
ModelsGPT ImageUse your own toolsGet a key

Generate images in your own tools

You don’t need to write code. Connect GPT Image to a tool you already use, and you can generate images right there.

Step 1: Get a key

What this step does: a key works like your account password. Your tool uses it to call OfoxAI.

  1. Open the OfoxAI console , go to Settings → API Keys and click Create New Key.
  2. Copy it right away and keep it somewhere safe. The key is shown only once, when you create it. Once you close the dialog, you can’t see it again.

Create a key just for this tool. If you stop using it or worry it leaked, delete that one key — nothing else is affected.

Roughly what it costs: billing depends on quality. At OpenAI’s official reference prices, one 1024×1024 image costs less than 1 cent at the lowest quality, and about 21 cents with gpt-image-2 at high quality. Try the lowest quality first and go higher once you’re happy. See Quality and price.

Only enter the key in your tool’s settings, or in the file your coding agent points you to. Don’t send it in a chat, and don’t share screenshots of it.

Next: work out which kind of tool you have.

Step 2: Work out which kind of tool you have

What this step does: different tools connect in different ways, so first find where yours fits.

Your toolExamplesHow to connect
Chat or image client: has a UI and lets you add your own model providerCherry Studio, LobeHub, etc.Fill in a few settings
AI assistant / coding agent: you chat with it to write code or operate your computerClaude Code, Codex, ZCode, OpenClaw, WorkBuddy, etc.Copy a prompt and send it

Common tools (checked 2026-09-30):

ToolHow to connect
Cherry StudioChat and image clients. When you add the model, set “Endpoint Type” to “Image Generation (OpenAI)”, or the model won’t show up under “Paintings”. To add the provider, see Cherry Studio setup
LobeHubChat and image clients, but use its built-in “OpenAI” provider. Models you add yourself in LobeHub can’t be set to the image type, so don’t create a new provider: in the built-in OpenAI provider, change the API Proxy URL to https://api.ofox.io/v1, enter your key, and pick GPT Image 2 when generating images. The two 2.5 models are not in its built-in list yet
ChatboxNot supported yet. Its image generation currently only works with Chatbox’s own service and can’t use an external provider
WorkBuddyAI assistants and coding agents. Its model settings only accept chat models. First connect it with WorkBuddy setup, then send it the prompt below
Claude Code, Codex, ZCode, OpenClawAI assistants and coding agents. Send it the prompt below directly

Still not sure? If the settings have an option like “Add provider” or “Custom API”, follow Chat and image clients. If you usually have it write code or do tasks for you, follow AI assistants and coding agents.

Next: jump to the matching method.

Chat and image clients

Check that your tool can generate images

What this step does: makes sure your tool can use an external image model. Not every tool can.

Both of these must be true:

  • The tool has an entry point such as “Paintings”, “Image generation” or “Draw”.
  • In that entry point, you can pick a provider and model you added yourself.

Some tools’ drawing features only work with their built-in models and don’t let you pick a provider you added. Those tools can’t use GPT Image. If you’re not sure, check the tool’s own docs. If your tool doesn’t qualify, follow AI assistants and coding agents instead.

Add OfoxAI as a provider

What this step does: tells the tool where to send requests and which key to use.

Already connected OfoxAI chat models in this tool? Use that provider and skip to the next step.

Not yet? Follow the tool’s setup guide, which has screenshots for every step: Cherry Studio · LobeHub · All tools. The key fields are:

Fill these in when adding the provider
Provider typeOpenAIIf there is no OpenAI option, choose "OpenAI compatible"
API URLhttps://api.ofox.io/v1A few tools (such as NextChat) need it without the trailing /v1 — follow that tool's setup guide
API keyPaste the key you copied in step 1

On LobeHub, don’t create a new provider. Models you add yourself in LobeHub can’t be set to the image type, so use its built-in “OpenAI” provider instead:

LobeHub: fill these in on the built-in OpenAI provider
API Proxy URLhttps://api.ofox.io/v1
API keyPaste the key you copied in step 1
Pick when generatingGPT Image 2The two 2.5 models are not in LobeHub's built-in list yet

Add an image model

What this step does: tells the tool which model to use for images.

Add a model to this provider manually and copy one of these model IDs:

Fill these in when adding the model
Model IDopenai/gpt-image-2.5-flareEveryday image generation, fast — start with this one
Model IDopenai/gpt-image-2.5-sunburstEditing, closer to the original image
Model typeImage generationIn Cherry Studio this is "Endpoint Type" → "Image Generation (OpenAI)"; elsewhere pick an image generation option, not chat

Generate an image

What this step does: in the image entry point, pick the model you just added, enter a description, and generate a test image.

If the tool lets you choose quality, start with low (low) and go higher once you know it works. Higher quality costs more and takes longer; high-quality images may take several minutes.

No image? See the FAQ.

AI assistants and coding agents

If you haven’t installed a coding agent yet, follow a guide first: Claude Code, Codex, OpenClaw.

A coding agent can do one of two things for you. Pick the one you need:

  • Generate images for me: you describe the image in chat, and it generates it and saves it on your computer.
  • Add it to my project: for example, you’re building a website or mini program and want it to generate images.

Send the prompt to your coding agent

What this step does: tells the coding agent what to do and how to do it safely. It will first help you store the key, then get to work.

Copy the prompt that fits your need and send it to Claude Code, Codex, ZCode, OpenClaw or WorkBuddy:

Generate images for me

Copy this if you want to chat with it to generate images.

I want to generate images with OfoxAI's GPT Image models. I have already created an API key in the OfoxAI console. I'm not very technical, so please walk me through it step by step. Before each step, tell me in plain language what you're doing and what comes next.

[Step 1: help me store the key safely]
1. Create a .env file in the current folder containing one line: OFOX_API_KEY= (leave the value empty). If the current folder is a code repository, add .env to .gitignore.
2. Tell me where the file is and how to open it, so I can paste the key after the = sign myself and save it.
3. Don't ask me to send the key in this chat. If I paste it by mistake, remind me to delete that key in the console and create a new one.
4. Wait until I tell you "done" before continuing.

[Step 2: get ready to generate images]
5. Write a small script that reads OFOX_API_KEY from .env and calls POST https://api.ofox.io/v1/images/generations to generate an image.
6. Use the model openai/gpt-image-2.5-flare, quality low, size 1024x1024, and set the client timeout to 600 seconds.
7. The returned data[0].b64_json is plain base64. Decode it and save it as a PNG in an images folder inside the current folder.
8. Don't print the key, and don't write it into the script.

[Step 3: try one image]
9. First generate "a red apple on a white table", then tell me where the image was saved and how to open it.
10. After that, each time I describe an image, generate one with this script and tell me where it was saved. If I say "higher quality", change quality to medium or high, and remind me that it costs more and takes longer.

[When something fails]
11. Print the HTTP status and the full error (including error.message and request_id), look up the cause in https://ofox.io/docs/develop/models/gpt-image#errors, and change only one thing before trying again.
12. If the same error survives two fixes, stop, explain the problem to me in plain language, and give me the request_id and the exact error message so I can contact OfoxAI.
13. Generate one image at a time, and don't retry in batches on your own (every request is billed).

Add it to my project

Copy this if you want your website or app to generate images.

I want to add OfoxAI GPT Image generation to this project. I have already created an API key in the OfoxAI console. I'm not very technical, so please walk me through it step by step. Before each step, tell me in plain language what you're doing and what comes next.

[Step 1: help me store the key safely]
1. Create a .env file in the project containing one line: OFOX_API_KEY= (leave the value empty).
2. Add .env to .gitignore so it is never committed or uploaded.
3. Tell me where the file is and how to open it, so I can paste the key after the = sign myself and save it.
4. Don't ask me to send the key in this chat. If I paste it by mistake, remind me to delete that key in the console and create a new one.
5. Wait until I tell you "done" before continuing.

[Step 2: write the code]
6. Use the official OpenAI SDK against OfoxAI's image endpoints with base_url https://api.ofox.io/v1, reading the key from OFOX_API_KEY in .env.
 - Text to image: POST /v1/images/generations
 - Editing, combining images, inpainting: POST /v1/images/edits (multipart upload)
7. Use full model IDs: openai/gpt-image-2.5-flare (openai/gpt-image-2.5-sunburst for editing).
8. Always pass quality explicitly; use low during development. If omitted, the model picks a tier itself.
9. size must satisfy all of: width and height divisible by 16, longest edge ≤ 3840, aspect ratio between 1:3 and 3:1, total pixels ≥ 655,360.
10. The result is in data[0].b64_json as plain base64 without a data: prefix; decode it and save it as an image file.
11. Set the client timeout to 600 seconds.
12. Do not send response_format, input_fidelity or style.
13. Never write the key into code, logs or error messages; mask the Authorization header when printing requests.

[Step 3: test]
14. Make one real call with quality=low and size=1024x1024, confirm it returns 200 and the image opens, then tell me where the image was saved.
15. Generate one image at a time while testing; don't write loops that batch-test (every request is billed).

[When something fails]
16. Print the HTTP status and the full response body (including error.message and request_id), and look up the cause in https://ofox.io/docs/develop/models/gpt-image#errors
17. For 429, wait and retry; for other errors, fix the request first instead of retrying it unchanged.
18. If the same error survives two fixes, stop, explain the problem to me in plain language, and give me the request_id and the exact error message so I can contact OfoxAI.

[Pre-launch self-check]
19. When I say "ready to go live", check each item and tell me the result: no key in the code or commit history; .env is in .gitignore; every request passes quality; the timeout is ≥ 600 seconds; errors print the status code, the raw error text and the request_id.

References:
- Values and constraints for this family: https://ofox.io/docs/develop/models/gpt-image
- Shared endpoint structure: https://ofox.io/docs/api/openai/images

Paste the key into the file when it asks

What this step does: keeps the key only in a file on your computer, never in the chat.

The coding agent will tell you where the .env file is. Open it, paste your key after OFOX_API_KEY=, save it, and reply “done”.

Watch it generate the first image

What this step does: confirms everything is connected.

The coding agent generates a test image first and tells you where it was saved. If you can open it, you’re set. From then on, just tell it in chat what image you want.

What these two prompts save you from

RequirementWhat happens without it
Key in .env, never sent in the chatThe key may end up in your code or uploaded online
Model ID copied from the docsA wrong case returns 404
Low quality by defaultThe model picks a tier; quality and cost drift
600-second timeoutHigh quality may take several minutes; disconnecting early loses the image, but the request is still billed
Print the full errorThe coding agent only sees “request failed” and has to guess
Stop after two failed triesThe coding agent keeps retrying, paying each time

If something goes wrong

What this step does: lets the coding agent find the cause and fix it itself. For most errors, it can solve the problem once it sees the actual error text.

When something fails, send it this:

Debugging prompt

Send this to your coding agent when image generation fails.

The last image request failed. Please debug it in this order and explain the result to me in plain language:
1. Print the HTTP status and the full error of that request (mask the Authorization header).
2. Read error.message and find the cause in https://ofox.io/docs/develop/models/gpt-image#errors
3. Change one thing only, and retry once with quality=low and size=1024x1024.
4. If it still fails, stop, tell me what went wrong, and give me the request_id and the exact error message.

Still stuck? Contact OfoxAI with the request_id and the error message the coding agent gave you, so we can look up that exact request. Never send the key itself.

FAQ

Can my tool generate images with GPT Image?

A chat or image client needs two things: an entry point like "Paintings" or "Image generation", and the ability to pick a provider and model you added yourself in that entry point. Some tools can only draw with their built-in models, and those tools can’t be connected. Coding agents like Claude Code, Codex, ZCode and OpenClaw all work: send one the prompt on this page, and it will write a small script to generate images for you.

How do I set up GPT Image for Paintings in Cherry Studio?

Add an OpenAI-type provider in Cherry Studio with API address https://api.ofox.io/v1 and your key. Then add the model openai/gpt-image-2.5-flare by hand, and set its Endpoint Type to Image Generation (OpenAI) so it shows up under Paintings.

Can LobeHub generate images with GPT Image?

Yes, through its built-in OpenAI provider: change the API Proxy URL to https://api.ofox.io/v1, enter your key, and pick GPT Image 2 when generating images. Models you add yourself in LobeHub cannot be set to the image type, so do not create a new provider. The two GPT Image 2.5 models are not in its built-in list yet.

What if my tool reports a connection failure or 404?

Check three things: the API URL is https://api.ofox.io/v1 (a few tools, such as NextChat, need it without /v1); the key was copied in full with no extra spaces; and the model ID was copied exactly from the docs, with the right case.

How much does one image cost, and how long does it take?

Billing depends on quality. At OpenAI official reference prices, one 1024x1024 image costs less than 1 cent at low, and about 21 cents with gpt-image-2 at high. Latency varies with quality and size; high quality may take several minutes. What you are actually charged is the usage of each request; live OfoxAI prices are on the model pages. Start with low to confirm it works, then go higher as needed.

What if I accidentally sent my key in a chat?

Delete that key in the OfoxAI console, create a new one, and enter it in your tool settings or .env file as described above. Once deleted, the old key stops working.

Last updated on