Guide
recraft-v4.1-flash Text-to-Image API Getting Started Guide: Capabilities, Pricing, and Best Practices
From capability boundaries to integration costs, helping developers quickly decide whether it's worth integrating
Who this model is for: capability boundaries and positioning
recraft-v4.1-flash/text-to-image is an image generation model provided by Recraft. Its output type is image, and its capability scope is strictly limited to the text-to-image path. The name includes flash, positioning it as fast and lightweight. A more reasonable expectation is to use it for high-frequency, low-cost image generation where results are good enough.
Suitable scenarios
- Batch generation of operational materials, draft illustrations, and social media thumbnails—tasks that don't demand extreme per-image finesse.
- Placeholders and demos that require instant imagery in product prototypes or internal tools.
- A/B exploration: batch-generate multiple variants from the same prompt, see the direction first, then decide whether to refine.
- Upstream steps in the development pipeline—e.g., generate sketches for human screening before proceeding to more costly downstream processes.
Unsuitable scenarios
- Commercial materials requiring precise text rendering or complex layout control—such needs should first verify the model's stability with text and layout; if unstable, switch to a dedicated solution.
- Tasks requiring image editing, inpainting, image-to-image, or other multimodal capabilities: this model declares only text-to-image, and editing capabilities are out of scope.
- Scenarios that demand a very high quality floor for every generation and cannot rely on human screening as a fallback.
Selection judgment
Break requirements into three dimensions: "generation frequency," "quality floor," and "whether editing is needed." If frequency is high, the quality floor can tolerate human screening, and no editing is needed, then try recraft-v4.1-flash first; otherwise, evaluate other image models. Don't treat it as a general-purpose all-in-one image model—its value lies in reliably completing pure text-to-image conversion at a lower per-call cost.

Interface conventions to confirm before calling
The most common pitfall before integration is writing request bodies from memory or guesswork. Different image models vary greatly in field naming, enum values, and response structures. It's recommended to check item by item against the HiAPI.ai unified API documentation before writing code.
What to check at the request level
- Authentication method: Which request header the API Key goes in, and whether there is a prefix convention.
- Model identifier: The model name in the request must exactly match the registered name
recraft-v4.1-flash/text-to-image. Do not spell it yourself or abbreviate it. - Required and optional parameters: At minimum, confirm the prompt field name, how image size/aspect ratio is passed (width and height numbers or preset enums), and whether the number of images per generation is configurable.
- Parameter value ranges: The legal range for size, whether custom width/height is supported, and whether out-of-range values cause an error or are auto-corrected.
- Request body format: Whether it is JSON and how the content-type header should be set.
What to check at the response level
- How images are returned: URL or base64, and whether the URL has an expiration—this directly determines whether you download and re-store immediately or store the link.
- The field path where image results appear in the response structure, and whether metadata (such as actual size and generation status) is also returned.
- The error response structure: the mapping between status codes and error codes, to facilitate categorized handling.
A practical approach
First run a minimal request (required parameters only), print the full raw response, record the response field paths, then add parameters incrementally. This avoids the difficulty of troubleshooting caused by piling on parameters all at once and helps catch discrepancies between documentation and reality early.

Per-image billing: how to calculate the $0.01/image cost
This model is billed per image at $0.01/image (real-time terms and the latest price are subject to the site's pricing panel). Per-image billing means cost grows linearly with the number of images and is not directly tied to prompt length or resolution. This makes cost estimation simple but also easy to underestimate during batching and retries.
First calculate nominal cost
Nominal cost = number of requested images × unit price per image. For example, generating 4 images at once costs 4 unit prices; a batch of 1000 images costs 1000 unit prices. This step only reflects the number of "successful and adopted" images.
Then calculate real cost
Real cost includes two frequently overlooked increments:
- Retry cost: If failed calls have already incurred billing (e.g., the request was accepted but the result was unusable), retries mean paying again.
- Discard cost: In batch generation, the portion filtered out by human review and never making it into the product is also billed.
So a formula closer to reality is: real cost ≈ (successfully adopted images + retried images + discarded images) × unit price. If the acceptance pass rate is only half, the effective per-image cost doubles—this is the metric to quantify first when estimating budgets.
How to reduce costs
- Start with small batch trial runs, measure the prompt pass rate, then decide the batch size.
- Generating multiple variants at once is better for human screening than multiple single-image requests, reducing "blind retries."
- Cache reusable results to avoid repeated billing for identical prompts.
- Set budget caps (converted to image count) for batch tasks to prevent abnormal retries from burning through the budget.

Minimal viable integration flow
The goal is to complete the first successful generation via the shortest path and confirm that the entire chain (authentication → request → image output → storage) works.
Step 1: Prepare credentials
Create an API Key in the HiAPI.ai console and store it in environment variables. Do not hard-code it into the repository. Also confirm the account's available balance and calling permissions.
Step 2: Build a minimal request
Include only required fields: the model name recraft-v4.1-flash/text-to-image and the prompt. Use a specific, unambiguous prompt, for example, "an orange cat standing in front of a white background, front view, soft lighting."
curl -X POST "$HIAPI_BASE_URL" \
-H "Authorization: Bearer $HIAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "recraft-v4.1-flash/text-to-image",
"prompt": "一只站在白色背景前的橘猫,正面视角,柔和光线"
}'
The actual path, authentication headers, and field names are subject to the HiAPI.ai documentation; the above is only a skeleton illustration.
Step 3: Parse and store
Read the response and obtain the image result. If it is a URL, download and re-store it in your own object storage immediately, while recording the prompt, parameters, and generation time to form a traceable generation record.
Step 4: Verify the chain
Confirm three things: the returned status is normal, the image opens properly, and the record has been written. Run the same request again and observe whether it reproduces stably—this also verifies behavior on repeated calls.
Best practices for prompts and parameters
The uncertainty in image generation comes from the combination of prompts and parameters. A stable approach is to structure them rather than writing a casual sentence each time.
Prompt blocks
Organize by six blocks: "subject + action/state + scene/background + composition/viewpoint + style + quality constraints," selecting as needed:
- Subject and state determine the core of the image; be as specific as possible ("orange cat" is better than "animal").
- Composition and viewpoint control the visual language ("front view," "full body in frame").
- Be restrained with style words; stacking multiple conflicting style words often makes results less controllable.
Only tune meaningful parameters
- Size/aspect ratio: Align with the product's final display slot first to avoid heavy cropping after generation. If the documentation specifies legal ranges, do not pass values outside the boundaries.
- Number of images: During exploration, use multiple variants to improve hit rate; after the style is settled, narrow to a single image to reduce discard cost.
- Do not pass parameters by guesswork if they are not confirmed in the documentation, to avoid errors or unpredictable behavior.
Manage prompts as configuration
Turn validated prompt templates into variable-driven templates (subject, scene, and style replaceable) and version them in code. This lets you reuse high-pass-rate combinations and trace back "which version of the prompt caused the problem." Change only one variable per adjustment so you can determine which factor affected the result.
Acceptance, caching, and failure retry strategies
For generation APIs, the engineering focus is not the call itself but the quality gate and cost control of results.
Acceptance: automate first, then manual
The automated layer performs basic checks: whether the image can be decoded, whether the size matches expectations, and whether it is a blank image or obviously abnormal. After passing the automated layer, proceed to manual sampling or full inspection (depending on the quality floor requirements). It's recommended to record the pass rate per batch as a basis for deciding subsequent batch sizes.
Caching: match by input fingerprint
Compute a fingerprint from "model name + prompt + key parameters" as the cache key. Reuse on hit; call only on miss. This is especially effective for two cases:
- Repeated requests in development and test environments.
- Fixed assets frequently reused in production.
Caching should have an expiration policy so it naturally refreshes after image changes or prompt iterations.
Retries: bounded and distinguishable
- Retry only for retryable errors (timeouts, temporary server errors). Retrying parameter errors or authentication failures is meaningless and only incurs repeated billing.
- Retries should have caps and backoff, e.g., exponential backoff with a maximum count; beyond that, put failures into a queue for manual handling.
- Before retrying, determine whether a usable result has already been produced, to avoid duplicate charges from "actually succeeded but judged failed."
The principle linking all three: don't regenerate what can be cached, don't retry what can be determined, and don't send to manual review what can be automatically screened.
Pre-launch checklist
Checking off each item before production can avoid most issues that would otherwise only be discovered after launch.
Correctness
- The model name
recraft-v4.1-flash/text-to-imageis consistent in code and configuration, with no spelling divergence. - Size/aspect ratio parameters fall within the documented allowed range and match the frontend display slot.
- Response parsing paths have been verified with real responses, not assumptions.
- The storage and access chain for image results (download, re-store, CDN) is connected.
Cost
- The actual prompt pass rate has been measured, and the effective cost per valid image has been estimated accordingly.
- Batch tasks have budget caps and image count caps to prevent abnormal amplification.
- Caching is in effect and hit rate is monitored.
- Retries have count caps and backoff strategies, with no infinite retries.
Reliability
- Error codes are categorized: retryable / non-retryable / requires manual handling.
- API Keys come from environment variables, with rotation and least-privilege plans.
- Generation records are traceable (prompt, parameters, time, result status) for retrospective review and reconciliation.
- Monitoring and alerts exist: abnormal call volume, failure rate, pass rate, and unit cost can all be detected.
After completing the checklist, roll out gradually with small traffic, observe whether the real pass rate and bill match the estimates, and then decide whether to scale up. More API details can be verified in the HiAPI.ai model documentation.
Related articles
View all articles →-
Guide
Getting Started with seedream-5.0-pro/image-to-image: Capabilities, Pricing, and Integration Essentials
Capability boundaries, billing model, and engineering integration practices for ByteDance's image editing model
-
Guide
seedream-5.0-pro Text-to-Image Getting Started Guide: Capability Boundaries, API Integration, and Cost Control
A hands-on developer perspective: from key parameters to a cost estimate of $0.05 per image
-
Guide
Hailuo 2.3 Fast Image-to-Video Getting Started Guide: Capability Boundaries, Pricing, and Integration Practices
MiniMax image-to-video model selection and integration key points for developers