Text-to-Image Task
How to define and submit a text-to-image or image-edit Raw Task
An Image Task is a JSON document (ImageTaskArgs) that describes one Diffusers image generation or edit job. Crynux nodes resolve the pipeline from the base model's model_index.json and run text-to-image, image-to-image, or native image editing from the same schema.
If you only need a simple OpenAI-style generate or edit call, use the OpenAI-Compatible Image API. Use the Raw Task API when you need full ImageTaskArgs control, batch create, long queue_timeout Flexible Pricing, or fields such as steps, negative_prompt, lora, and dtype.
The examples below use the Crynux AS Raw Task API. If you need more complex control—such as setting task_fee yourself, owning the application wallet and Relay Account, or configuring Bridge repeat tasks—you can deploy your own Crynux Bridge and call its Raw / Batch APIs directly.
Sending Image Tasks via Crynux AS (Raw Task API)
Create one task
POST /api/<endpoint_token>/v1/inference_tasks
Create up to 100 tasks
POST /api/<endpoint_token>/v1/inference_tasks/batch
Get status
GET /api/<endpoint_token>/v1/inference_tasks/<client_task_id>
Batch status
POST /api/<endpoint_token>/v1/inference_tasks/batch/status
Download PNG
GET /api/<endpoint_token>/v1/inference_tasks/<client_task_id>/images/<index>
Authenticate with Authorization: Bearer <api-key-or-owner-jwt>.
Top-level request fields (outside task_args)
task_type
Yes
Must be 0 for Image tasks
task_args
Yes
JSON string of ImageTaskArgs
min_vram
No
Minimum GPU VRAM in GB. When omitted, Crynux AS resolves a default from the Image loaded-models cache. With a concrete dtype, an exact cache hit can supply min_vram; otherwise AS may use the configured default. With dtype omitted or "auto", AS selects a matching loaded-models row and may fill concrete dtype / omitted quantization_config / components from that row
task_version
No
Task version string, for example "3.7.1"
queue_timeout
No
Queue wait budget in seconds (Flexible Pricing). Positive integer. Not part of task_args
Do not send task_fee. Crynux AS owns pricing from the project Cost Level.
Flexible Pricing with queue_timeout
Crynux schedules queued tasks by task fee. A higher Cost Level / task fee ranks higher; a lower Cost Level / task fee ranks lower.
Set a low project Cost Level and a long queue_timeout (for example 43200 for 12 hours) so large batches that do not need an immediate result can wait for quieter network periods at lower cost.
Synchronous OpenAI Images APIs hold one HTTP request until the job finishes (about 10 minutes by default). They cannot wait for long queues. For low Cost Level + long queue_timeout, use this asynchronous Raw Task API (single create or POST /inference_tasks/batch) and poll until status is success or failed.
Status response fields
id
Public client task ID (task_jobs.id)
status
running, success, or failed
phase
queued, running, validating, uploading, finalizing, success, or failed
estimated_completion_at
Present when phase is running and an estimate is known
error_message
Present only when status is failed and an error was stored
Create, poll, and download
Batch create and batch status
task_args Schema (ImageTaskArgs)
version
Schema version string, for example "3.7.1"
base_model
{"name": "<hf_repo_id>", "revision": null}. name must be a Hugging Face Diffusers repo with model_index.json. Absolute URLs are rejected
dtype
"float16", "bfloat16", "float32", or "auto" (default "auto"). Concrete values are kept as-is. "auto" lets Crynux AS / the node resolve a concrete dtype from loaded-models matching when applicable
prompt
Required positive prompt
negative_prompt
Optional. Effective when the pipeline supports CFG / true CFG and guidance is greater than 1
images
Optional list of data URLs ("data:image/png;base64,..."). Empty or omitted → text-to-image. Non-empty → image edit / img2img. Total string byte length of all entries must not exceed 1 MB (1,048,576)
strength
Optional float in 0–1. Used only when the resolved img2img pipeline accepts strength
task_config
See below
lora
Optional {"model": "<hf_repo_id>", "weight_file_name": "", "weight": 100}
components
Optional map of component name → replacement source (format "gguf" or "diffusers"). See Model Quantization
quantization_config
Optional object or null. See Model Quantization
task_config
image_width
Default 1024
image_height
Default 1024
steps
Integer 1–100, default 30
seed
Integer 0–2147483647. If omitted on Crynux AS create, AS fills a random value in that range
num_images_per_prompt
Integer 1–10, default 1
guidance_scale
Optional float >= 0. Mapped at runtime to the pipeline's guidance_scale or true_cfg_scale
Comprehensive Examples
1. Basic text-to-image
2. Text-to-image with negative_prompt
3. Image editing (reference images, no strength)
Use models that natively accept edit / conditioning images (for example Qwen/Qwen-Image-2.1, Qwen/Qwen-Image-Edit, black-forest-labs/FLUX.2-klein-4B).
4. Classic image-to-image (images + strength)
5. LoRA adapter
6. Component replacement (components)
6a. GGUF transformer
6b. Standalone Diffusers VAE
6c. Diffusers component with subfolder
6d. Multiple components
7. Task-time quantization (quantization_config)
For BitsAndBytes, GGUF, Nunchaku Lite, and platform scheduling rules, see Model Quantization.
Last updated