Images
Generate and edit images, billed per image.
Generate an image
POST
/api/v1/images/generationsPer imageSend a prompt and get images back. Attach a reference image and the model edits it instead. The request follows OpenAI's images API, so the OpenAI SDK works.
Request body
modelstringrequiredAn image model id from the media menu, or clawhunter/smart to let Smart Router pick.promptstringrequiredWhat to make. With a reference image, what to change.nintegerHow many images. Defaults to 1, up to 10.image_urlstringOne reference image to edit, as an https URL or a data URL.input_imagesstring[]Several reference images. The first is the one edited. The model's max_references on the menu says how many it takes.aspect_ratiostringThe shape, on models that list aspect ratios. It doesn't change the price.qualitystringThe quality tier, on models that list one. On clawhunter/smart it picks the routing tier instead, and defaults to medium.low · medium · highresolutionstringThe resolution tier, on models that list one. Not on clawhunter/smart.1K · 2K · 4KsizestringAccepted for OpenAI compatibility. Most models render their own size, so use aspect_ratio.Example request
import OpenAI from "openai";const client = new OpenAI({ apiKey: process.env.CLAWHUNTER_API_KEY, baseURL: "https://mystudios.fun/api/v1",});const image = await client.images.generate({ model: "clawhunter/smart", prompt: "A lighthouse on a sea cliff at golden hour",});
Response
OpenAI's images response with a billing block added. Each entry in data is b64_json or a url, depending on the model.
Response
{ "created": 1790000000, "data": [{ "b64_json": "iVBORw0KGgo…" }], "billing": { "model": "gpt-image-2-5-flare", "operation": "generate", "requested_model": "clawhunter/smart", "images": 1, "usd": 0.0222, "usage_usd": 0.0222, "quote_usd": 0.0342, "note": "routed to GPT Image 2.5 Flare" }}
Billing and limits
- Billed per image at the model's price, listed on Models.
- A quality or resolution tier above the default scales the price by the multiplier on the menu.
- The call reserves the price per image times n. With credits, you pay for the images produced.
- With x402, you pay that reserve as the price.
- An option the model doesn't list returns 400.
- clawhunter/smart needs an API key.
- Calls with a key draw on your daily free allowance first. A model's free_tier limits which settings it covers.
- A 4K or high-quality image can take a few minutes.
- A rejected or failed request is not charged.