Build with Grok Imagine Image 2.0 Segment Edit
Make your first request
Use your Sorceress API key on your server. The playground uses your signed-in account; your application uses the same model with an API key.
curl -X POST 'https://sorceress.games/api/v1/jobs' \
-H 'Authorization: Bearer $SORCERESS_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"model": "grok-imagine-image-2-0-segment-edit",
"input": {
"prompt": "<prompt>",
"task_id": "<task_id>"
}
}'Inputs & settings
promptstringRequiredText prompt describing the desired image. Up to 65,000 characters.
task_idstringRequiredThe source task ID to use for image editing(This can be a task ID generated by the `grok-imagine-image-2-0/text-to-image` model, or a task ID generated by the `grok-imagine-image-2-0/segment-map` model by passing an `image_url`.).
mask_indexsarrayIndexes of the segments to edit, taken from resultObject.segments[].index of the segment-map task (0-based). Example: [0, 2].
Full input schema
{
"type": "object",
"required": [
"prompt",
"task_id"
],
"properties": {
"prompt": {
"type": "string",
"title": "Prompt",
"maxLength": 65000,
"description": "Text prompt describing the desired image. Up to 65,000 characters."
},
"task_id": {
"type": "string",
"title": "Task ID",
"description": "The source task ID to use for image editing(This can be a task ID generated by the `grok-imagine-image-2-0/text-to-image` model, or a task ID generated by the `grok-imagine-image-2-0/segment-map` model by passing an `image_url`.)."
},
"mask_indexs": {
"type": "array",
"items": {
"type": "integer",
"minimum": 0
},
"title": "Mask indexs",
"minItems": 1,
"description": "Indexes of the segments to edit, taken from resultObject.segments[].index of the segment-map task (0-based). Example: [0, 2]."
}
}
}Results, saved runs & billing
Media requests return a job ID. Poll GET /api/v1/jobs/:id until it succeeds or fails; keep the same ID while it is processing. Long chat requests can also return a saved job to poll. Completed outputs are stored in your account, and successful work is billed using your model's current rates.
A multi-step workflow may include separately billed successful actions. If a connection drops, check your saved run before submitting it again.






