# inference.moss-image.sft.txt2img.v1

Source: https://docs.prodia.com/job-types/inference-moss-image-sft-txt2img-v1/

The `inference.moss-image.sft.txt2img.v1` job generates an image from a text
prompt with MOSS-Image, OpenMOSS's open-weight text-to-image model. It is
strong at rendering long English and Chinese text and accepts JSON layouts
that place text and objects at exact positions. Output is 1024x1024 by
default.

```json
{
    "type": "inference.moss-image.sft.txt2img.v1",
    "config": {
        "prompt": "A wide view of a refrigerator beside a kitchen counter with a fruit bowl. A small sticky note on the refrigerator door is handwritten: \"Buy milk and eggs!\""
    }
}
```

## Prompting

The prompt is used exactly as written. It can be natural language (English
works best, Chinese and other languages are supported), a tag sequence, or a
JSON layout. Put the exact text to render in quotes and use line breaks
(`\n`) where the text should break. The model reads at most 4096 tokens
(about 16,000 characters of English, fewer for Chinese); anything beyond that
is cut off.

`negative_prompt` (empty by default) describes what to avoid, e.g.
`worst quality, bad anatomy, watermark, jpeg artifact`.

`guidance_scale` (1-10, default 3) sets how strongly the prompt is followed:
3 suits long prompts, short prompts can benefit from up to 6.

## Layouts

A layout prompt is a JSON object with a `summary.caption` for the whole scene
and `items`, each with a `label` (`text` or `object`), a `caption`, the
`text` to render and a `bbox`. Boxes are `[y_min, x_min, y_max, x_max]` in
pixels with the image center as the origin (`bbox_format: "yxyx"`,
`bbox_coord_space: "abs_centralized"`), so on a 1024x1024 image both axes run
from -512 to 512. Send the same `width` and `height` the layout was drawn
for.

## Size

`width` and `height` can each be any integer from 512 to 2048 (default
1024\). The model works best at 1-4 megapixels.

## Seed

The same `seed` reproduces the same image.

## Latency

Typical latency on a warm worker is about 4.5 s at 1024x1024 and 25 s at
2048x2048.

## Schema

```json
{
	"type": "object",
	"required": [
		"type",
		"config"
	],
	"additionalProperties": false,
	"properties": {
		"type": {
			"type": "string",
			"enum": [
				"inference.moss-image.sft.txt2img.v1"
			]
		},
		"config": {
			"type": "object",
			"required": [
				"prompt"
			],
			"additionalProperties": false,
			"properties": {
				"prompt": {
					"type": "string",
					"minLength": 1,
					"maxLength": 16384,
					"examples": [
						"A wide view of a refrigerator beside a kitchen counter with a fruit bowl. A small sticky note on the refrigerator door is handwritten: \"Buy milk and eggs!\""
					],
					"description": "The prompt to generate an image from, used verbatim: natural language, a tag sequence or a JSON layout. Text beyond the model's 4096-token limit (about 16,000 characters of English, fewer for Chinese) is cut off."
				},
				"negative_prompt": {
					"type": "string",
					"maxLength": 16384,
					"default": "",
					"examples": [
						"worst quality, bad anatomy, watermark, jpeg artifact"
					],
					"description": "What to steer away from. Empty by default; also cut off at 4096 tokens."
				},
				"width": {
					"type": "integer",
					"minimum": 512,
					"maximum": 2048,
					"default": 1024,
					"description": "Output image width in pixels, 512 to 2048."
				},
				"height": {
					"type": "integer",
					"minimum": 512,
					"maximum": 2048,
					"default": 1024,
					"description": "Output image height in pixels, 512 to 2048."
				},
				"guidance_scale": {
					"type": "number",
					"minimum": 1,
					"maximum": 10,
					"default": 3,
					"description": "Guidance scale for classifier-free guidance. 3 suits long prompts; short prompts can benefit from up to 6."
				},
				"seed": {
					"type": "integer",
					"minimum": 0,
					"maximum": 2147483647,
					"description": "Random seed for reproducible results."
				}
			}
		}
	}
}
```
