Recraft: Recraft V4
Recraft V4 generates 1K raster images with a focus on composition, colour relationships and detailed creative direction. It covers illustration, photorealistic scenes and graphic design concepts, with optional style inputs and a separate image-to-image workflow.
About the model
This description covers the model’s capabilities. Available in Ailoot inputs, outputs and options are listed for the selected method below.
Recraft V4 is the standard raster model in Recraft’s V4 generation. The manufacturer emphasises design judgement: balanced composition, coherent colour relationships and detail that supports the visual intent. It can work with stylised illustration, photographic scenes and graphic design concepts. Use it when the brief calls for an image that combines aesthetic choices with prompt accuracy, whether exploring a mood from a short direction or specifying an intentional layout in detail.
The exact model code is recraftv4. Its producer reference lists 1K raster output in lossless WebP or PNG. A square image is 1024 × 1024 pixels, 16:9 is 1344 × 768 and 2:3 is 832 × 1280; other supported ratios use their own dimensions. V4 Pro is the separate 2K raster edition, while V4 Vector and Pro Vector return editable SVG. Select the exact V4 variant for the intended deliverable rather than combining these different output properties.
The manufacturer guide distinguishes brief interpretive prompts from structured creative direction. A short phrase can leave room to explore form, mood and framing. A structured brief can name the subject, setting, pose, material, secondary elements, lighting and visual hierarchy. For a narrative illustration, describe a cyclist crossing a small bridge, bold simplified shapes, warm muted colours and a clear left-to-right movement. These content and composition decisions are more actionable than a long list of unrelated style adjectives.
V4’s range includes illustration, dimensional imagery and photorealistic visuals. The guide recommends describing drawing logic for illustration and material, light, camera and depth for a 3D-looking image. The latter remains a raster visual rather than an editable mesh. For a poster or packaging concept, state which words are primary, where they belong and how the image and typography interact. The manufacturer highlights readable short and medium-length text; inspect the actual wording and arrangement in the returned image before using it.
Generation supports prompts up to 10,000 characters, a random seed, one to six outputs, preferred colours and a desired background colour. Optional compatible custom styles and reference images can guide the visual treatment through flexible or precise matching. Choose a clean reference or a set that belongs to one visual world, then let the prompt describe the new subject and scene. Reference-to-output colour matching is not guaranteed, so keep the required palette explicit and compare the result with it. For reference-style generation, use one to ten PNG, JPG or WebP images, no more than 64 MB in total and under 20 MB each. Each reference needs a shortest side of at least 256 pixels, a longest side of no more than 4,096 pixels and a resolution of no more than 16 megapixels. Use either these references or a compatible saved style, rather than both.
The documented image-to-image operation combines an existing image and a prompt, with strength from 0 to 1 determining how far the new output moves from the source. It does not accept V4 style controls in that operation. The current generation reference also excludes curated style names, negative_prompt, text_layout, artistic_level and no_text. Prepare a positive description of the desired result and evaluate the asset within its target composition. Standard V4 provides a focused raster design interpretation, with a specific edition, format and output size. For image-to-image, supply PNG, JPG, WebP or SVG under 20 MB, no more than 16 megapixels, with both sides between 256 and 4,096 pixels.
Ailoot Ultra · Images POST /v1/images/generations recraft/recraft-v4
recraft/recraft-v4Overview
Recraft V4 generates 1K raster images with a focus on composition, colour relationships and detailed creative direction. It covers illustration, photorealistic scenes and graphic design concepts, with optional style inputs and a separate image-to-image workflow.
- Accepted inputs
- Text · Images
- Results
- Images
Available in Ailoot · inputs & methods
Ailoot Ultra · Images POST /v1/images/generations
- Input types
text,image- Output types
image- Output format
- Image file
| Field | Type | Requirement | Values & limits | Default |
|---|---|---|---|---|
Fieldmodel | Typestring | RequirementRequired | Values & limits recraft/recraft-v4 | Default— |
Fieldprompt | Typestring | RequirementRequired | Values & limits Minimum length: 1 | Default— |
Fieldn | Typeinteger | RequirementOptional | Values & limits Minimum: 1 Maximum: 6 | Default— |
Fieldaspect_ratio | Typestring | RequirementOptional | Values & limits 1:1, 4:3, 3:4, 16:9, 9:16, auto | Default— |
Fieldinput_references | Typearray | RequirementOptional | Values & limits Minimum items: 0 Maximum items: 1 | Default— |
Input material combinations
Text to image · Required: prompt
reference_guided_image · Required: prompt, actual image reference
Method parameters and lifecycle
| Parameter | Contract |
|---|---|
Parametercontent_type | Contractapplication/json |
Parameterrequired | Contractmodel, prompt |
Parametermaterial_types | Contracttext, image |
Parameteroptional_controls | Contractn, aspect_ratio, input_references |
Parametern | Contract{"minimum":1,"maximum":6} |
Parameterreference_images | Contract{"minimum":0,"maximum":1,"source":"actual customer supplied material"} |
Parameterprovider_specific_options | ContractOnly saved exact endpoint allowlist style/controls/text_layout; no guessed shapes. |
Method aliases: /v1/images
Lifecycle: synchronous_result_then_owned_library
GET /v1/media/tasks/{task_id} · actual returned task_id or media library record
GET /v1/media/assets/{asset_id}/content
GET /v1/media/assets
GET /v1/media/assets/{asset_id}
Prompt-only example preserves the official ImageGenerationRequest structure.
Keep every returned image and the full response; output quantity is actual, not requested n.
Pricing
How the final charge is calculated
The displayed rates estimate the cost before generation. The final charge is calculated from the cost recorded for the original generation. Measured output duration and forecast quantities are not the final billable quantity.
Tariff references do not add request options. Supported parameters are listed for the selected method.
- Fast mode
- Not specified When fast mode is selected
- Flex mode
- Not specified When flex mode is selected
- Maximum reasoning effort
- Not specified When maximum reasoning effort uses the default adjustment
Estimated rates for comparison
Prices by configuration
Match each charge to the conditions shown. Use one rate for each set of alternative configurations.
| Configuration | Rate schedule | Forecast quantity | Billing unit | Charge |
|---|---|---|---|---|
| ConfigurationBase token rates | Rate scheduleBase rate | Forecast quantity— | Billing unit— | Charge Input · Input tokens · Estimate for comparison only — / 1K tokens Output · Output tokens · Estimate for comparison only — / 1K tokens Input · Cache read · Estimate for comparison only — / 1K tokens Input · Cache write · Estimate for comparison only — / 1K tokens Input · Cache write, 1 hour · Estimate for comparison only — / 1K tokens |
| ConfigurationUltra | Rate schedule— | Forecast quantity— | Billing unitper image output | Charge Output · output image · Estimate for comparison only $0.08 per image output |
| ConfigurationEstimated generation cost | Rate schedule— | Forecast quantityone generation estimate | Billing unit— | Charge Output · Estimated generation cost · Estimate for comparison only $0.08 estimate before generation This estimate is not an additional charge or a fixed rate for the completed generation. |
Ailoot reserves an estimated amount before a request. After the result, it settles the final charge from measured usage. Streaming settlement uses the final usage record. How reservation and settlement work →
Reference tariff details
Model-level reference schedules do not change method selection, quotes or charges. Active charges use the selected Ailoot method rates.
Image pricing configurations
Prices by configuration
| Configuration | Billing conditions | Charge |
|---|---|---|
| ConfigurationOutput image | Billing conditionsNo pricing variant is declared. | Charge Output · Output image $0.08 per image Equivalent listings describe the same charge; they do not add a second fee. |
Example requests
Ailoot Ultra · Images
set -eu
: "${AILOOT_API_KEY:?Set your Ailoot API key}"
export AILOOT_API_KEY
python3 - <<'PY_REQUEST'
import json,os
from pathlib import Path
p={'model': 'recraft/recraft-v4', 'prompt': 'a red panda astronaut floating in space, studio lighting'}
Path("request.json").write_text(json.dumps(p,ensure_ascii=False))
PY_REQUEST
curl --fail-with-body --silent --show-error https://api.ailoot.ai/v1/images/generations \
-H "Authorization: Bearer $AILOOT_API_KEY" -H 'Content-Type: application/json' \
--data-binary @request.json -D response-headers.txt -o result.json
python3 - <<'PY_RESULT'
import base64, json, os, subprocess
from pathlib import Path
from urllib.parse import urlsplit, urljoin
def save_images(items):
if not items: raise SystemExit("No completed images; retain the full response")
for index, item in enumerate(items):
encoded=item.get("b64_json")
uri=item.get("url", "")
if not encoded and uri.startswith("data:image/"):
header, separator, encoded=uri.partition(",")
if not separator or ";base64" not in header: raise SystemExit("Unsupported image data URI")
if encoded:
raw=base64.b64decode(encoded,validate=True)
elif uri:
uri=urljoin("https://api.ailoot.ai",uri)
parsed=urlsplit(uri)
if parsed.scheme!="https" or not parsed.netloc or parsed.username or parsed.password:
raise SystemExit("Invalid returned image URL")
owned=parsed.netloc=="api.ailoot.ai" and parsed.path.startswith("/v1/media/assets/") and parsed.path.endswith("/content")
args=["curl","--fail-with-body","--silent","--show-error",uri]
if owned: args += ["-H","Authorization: Bearer "+os.environ["AILOOT_API_KEY"]]
temporary=Path(f"image-{index}.bin")
subprocess.run(args+["-o",str(temporary)],check=True)
raw=temporary.read_bytes()
temporary.unlink()
else: raise SystemExit("Image has neither bytes nor URL")
if not raw: raise SystemExit("Empty image result")
ext="png" if raw.startswith(b"\x89PNG") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4]==b"RIFF" and raw[8:12]==b"WEBP" else "svg" if raw.lstrip().startswith((b"<svg",b"<?xml")) else "bin"
Path(f"image-{index}.{ext}").write_bytes(raw)
print("Every returned image saved; complete response metadata retained")
save_images(json.loads(Path("result.json").read_text())["data"])
PY_RESULT
from openai import OpenAI
import base64, json, os, subprocess
from pathlib import Path
from urllib.parse import urlsplit, urljoin
def save_images(items):
if not items: raise SystemExit("No completed images; retain the full response")
for index, item in enumerate(items):
encoded=item.get("b64_json")
uri=item.get("url", "")
if not encoded and uri.startswith("data:image/"):
header, separator, encoded=uri.partition(",")
if not separator or ";base64" not in header: raise SystemExit("Unsupported image data URI")
if encoded:
raw=base64.b64decode(encoded,validate=True)
elif uri:
uri=urljoin("https://api.ailoot.ai",uri)
parsed=urlsplit(uri)
if parsed.scheme!="https" or not parsed.netloc or parsed.username or parsed.password:
raise SystemExit("Invalid returned image URL")
owned=parsed.netloc=="api.ailoot.ai" and parsed.path.startswith("/v1/media/assets/") and parsed.path.endswith("/content")
args=["curl","--fail-with-body","--silent","--show-error",uri]
if owned: args += ["-H","Authorization: Bearer "+os.environ["AILOOT_API_KEY"]]
temporary=Path(f"image-{index}.bin")
subprocess.run(args+["-o",str(temporary)],check=True)
raw=temporary.read_bytes()
temporary.unlink()
else: raise SystemExit("Image has neither bytes nor URL")
if not raw: raise SystemExit("Empty image result")
ext="png" if raw.startswith(b"\x89PNG") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4]==b"RIFF" and raw[8:12]==b"WEBP" else "svg" if raw.lstrip().startswith((b"<svg",b"<?xml")) else "bin"
Path(f"image-{index}.{ext}").write_bytes(raw)
print("Every returned image saved; complete response metadata retained")
request={'model': 'recraft/recraft-v4', 'prompt': 'a red panda astronaut floating in space, studio lighting'}
client=OpenAI(base_url="https://api.ailoot.ai/v1",api_key=os.environ["AILOOT_API_KEY"],max_retries=0)
result=client.images.generate(**request)
Path("sdk-result.txt").write_text(str(result),encoding="utf-8")
save_images([{"b64_json":getattr(item,"b64_json",None),"url":getattr(item,"url",None)} for item in result.data])
import OpenAI from "openai";
import { readFileSync, writeFileSync } from "node:fs";
const key=process.env.AILOOT_API_KEY;
if(!key) throw new Error("Set your actual Ailoot API key");
const client=new OpenAI({baseURL:"https://api.ailoot.ai/v1",apiKey:key,maxRetries:0});
const request={"model": "recraft/recraft-v4", "prompt": "a red panda astronaut floating in space, studio lighting"};
const result=await client.images.generate(request);
writeFileSync("sdk-result.json",JSON.stringify(result,null,2));
if(!result.data?.length) throw new Error("No completed images");
for(let index=0;index<result.data.length;index++) {
const item=result.data[index];let encoded=item.b64_json,uri=item.url||"",raw;
if(!encoded && uri.startsWith("data:image/")) {
const comma=uri.indexOf(",");if(comma<0 || !uri.slice(0,comma).includes(";base64")) throw new Error("Unsupported image data URI");
encoded=uri.slice(comma+1);
}
if(encoded) {
if(encoded.length%4!==0 || !/^[A-Za-z0-9+/]*={0,2}$/.test(encoded)) throw new Error("Invalid Base64");
raw=Buffer.from(encoded,"base64");
} else if(uri) {
const u=new URL(uri,"https://api.ailoot.ai");
if(u.protocol!=="https:" || u.username || u.password) throw new Error("Invalid returned URL");
const owned=u.origin==="https://api.ailoot.ai" && u.pathname.startsWith("/v1/media/assets/") && u.pathname.endsWith("/content");
const response=await fetch(u,{headers:owned?{Authorization:"Bearer "+key}:{},redirect:"manual"});
if(!response.ok) throw new Error("Image content download failed: "+response.status);
raw=Buffer.from(await response.arrayBuffer());
} else throw new Error("Image has neither bytes nor URL");
if(!raw.length) throw new Error("Empty image result");
const ext=raw.subarray(0,4).equals(Buffer.from([137,80,78,71]))?"png":raw[0]===255&&raw[1]===216?"jpg":raw.toString("ascii",0,4)==="RIFF"&&raw.toString("ascii",8,12)==="WEBP"?"webp":raw.toString("utf8").trimStart().startsWith("<svg")||raw.toString("utf8").trimStart().startsWith("<?xml")?"svg":"bin";
writeFileSync(`image-${index}.${ext}`,raw);
}
console.log("Every returned image saved; sdk-result.json retains complete metadata");
Receive and save results
Ailoot Ultra · Images
Download each returned image or save its Base64 contents
GET /v1/media/tasks/{task_id}GET /v1/media/assets/{asset_id}/contentGET /v1/media/assetsGET /v1/media/assets/{asset_id}
Keep all completed results
Save every completed image; retrieve each returned URL or decode its Base64 contents.
Retain every data item and complete usage; own and save all actual returned images. No invented URLs or IDs.
If the original response needs checking
If an image generation or edit result requires a check, keep the original operation_id/X-Client-Request-ID and returned result information. Recover existing owned results through the media library using actual task_id or asset_id values. Do not resubmit the generation/edit request or construct a polling URL from operation_id.
Response fields
| Field | Type |
|---|---|
Fieldcreated | Typeinteger |
Fielddata[].url | Typestring |
Fielddata[].b64_json | Typebase64 string |
Fieldusage | Typeobject |
Errors and next steps
| Response | Condition | Next step |
|---|---|---|
Response400 · invalid_request_error | ConditionInvalid required fields, material representation or parameter value | Next stepCorrect the indicated fields before a new creation request. |
Responseserver_error | ConditionThe returned response says the operation or result requires a check | Next stepKeep the original returned operation/task ID, request headers and response; continue supported reads of that original operation. Do not resubmit the creation request. |
Aliases
Model aliases
Ailoot Ultra recraft/recraft-v4
Method path aliases
/v1/images
Related caller IDs
FAQ · Recraft: Recraft V4
- What inputs and results are available?
POST /v1/images/generations·recraft/recraft-v4:text,image→image- Which fields does the request use?
POST /v1/images/generations·recraft/recraft-v4:model,prompt,n,aspect_ratio,input_references- What limits apply?
POST /v1/images/generations·recraft/recraft-v4:n.minimum:1;n.maximum:6