Grok Imagine Image 2.0 Segment Map
This page is generated from the upstream official OpenAPI documentation. Endpoints, parameters and examples match the official docs; brand and API domain are replaced with ModelFold.
Endpoint
POST /jobs/createTask
Full URL: https://ai.modelfold.online/v1/jobs/createTask
Authentication: every request must include the
Authorization: Bearer <API_KEY>header.
Create Task
- Get Task Detail — After submitting a task, use the unified task detail endpoint to check progress and retrieve results
TIP
In production, we recommend using the callBackUrl parameter to receive task completion notifications instead of polling task status continuously.
TIP
This endpoint is free.
Related Resources
- Model Market — Browse all available models and capabilities
- Common API — View account credits and usage
Request Parameters
Body (application/json)
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | The model name used for generation. This field is required. This endpoint must use the grok-imagine-image-2-0/segment-map model. Default:"grok-imagine-image-2-0/segment-map"。 Allowed values:grok-imagine-image-2-0/segment-map。 示例:grok-imagine-image-2-0/segment-map。 |
callBackUrl | string | No | Callback URL for task completion notifications. Optional parameter. If provided, the system will send a POST request to this URL when the task completes, whether it succeeds or fails. If omitted, no callback notification will be sent. 示例:https://your-domain.com/api/callback。 |
input | `object | object` | Yes |
Request Example
bash
curl -X POST "https://ai.modelfold.online/v1/jobs/createTask" \
-H "Authorization: Bearer $MODELFOLD_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-imagine-image-2-0/segment-map",
"callBackUrl": "https://your-domain.com/api/callback",
"input": {
"task_id": "task_grok_imagine_1765180586443"
}
}'json
{
"model": "grok-imagine-image-2-0/segment-map",
"callBackUrl": "https://your-domain.com/api/callback",
"input": {
"task_id": "task_grok_imagine_1765180586443"
}
}Response
200 — Request successful
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
data | object | 否 | — |
data.taskId | string | 否 | Task ID used to query task status and results. 示例:task_grok_segment_map_1765180586443。 |
json
{
"code": 200,
"msg": "success",
"data": {
"taskId": "task_grok_segment_map_1765180586443"
}
}Callback
onTaskCompleted
Callback URL: {$request.body#/callBackUrl} (the callBackUrl in the request body).
Sent when the task succeeds or fails.
Callback body parameters
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
code | integer | 是 | 200: success. 501: failure; see data.failCode and data.failMsg. Allowed values:200 / 501。 示例:200。 |
msg | string | 是 | Callback status message. 示例:Playground task completed successfully.。 |
data | object | 是 | Task completion data returned by the segment map task. |
data.completeTime | integer | 否 | Task completion time, represented as a Unix timestamp in milliseconds. 示例:1786701857096。 |
data.costTime | integer | 否 | Processing time in seconds. Present on both success and failure callbacks. 示例:39。 |
data.createTime | integer | 否 | Task creation time, represented as a Unix timestamp in milliseconds. 示例:1786701799000。 |
data.creditsConsumed | number | 否 | Credits consumed by the task; 0 for failed tasks. 示例:0。 |
data.model | string | 否 | The model used for the task. Allowed values:grok-imagine-image-2-0/segment-map。 示例:grok-imagine-image-2-0/segment-map。 |
data.param | string | 否 | JSON string containing the parameters submitted when creating the task. 示例:{"input":"{\"task_id\":\"8507949ab5358de2262c3f351f12c7df\"}","callBackUrl":"https://your-domain.com/api/callback","model":"grok-imagine-image-2-0/segment-map"}。 |
data.resultJson | string | 否 | JSON string containing the segment map result. The parsed result contains resultObject.segments_count and the resultObject.segments array. Present only when state is success. 示例:{"resultObject":{"segments_count":11,"segments":[{"maskUrl":"https://tempfile.aiquickdraw.com/ggg/dd9fa155-2f7e-46fc-82f7-089144b43cd5_seg_0.png","name":"golden retriever","index":0},{"maskUrl":"https://tempfile.aiquickdraw.com/ggg/dd9fa155-2f7e-46fc-82f7-089144b43cd5_seg_1.png","name":"dog tongue","index":1},{"maskUrl":"https://tempfile.aiquickdraw.com/ggg/dd9fa155-2f7e-46fc-82f7-089144b43cd5_seg_2.png","name":"dog nose","index":2},{"maskUrl":"https://tempfile.aiquickdraw.com/ggg/dd9fa155-2f7e-46fc-82f7-089144b43cd5_seg_3.png","name":"dog eyes","index":3},{"maskUrl":"https://tempfile.aiquickdraw.com/ggg/dd9fa155-2f7e-46fc-82f7-089144b43cd5_seg_4.png","name":"dog eyes","index":4},{"maskUrl":"https://tempfile.aiquickdraw.com/ggg/dd9fa155-2f7e-46fc-82f7-089144b43cd5_seg_5.png","name":"dog ears","index":5},{"maskUrl":"https://tempfile.aiquickdraw.com/ggg/dd9fa155-2f7e-46fc-82f7-089144b43cd5_seg_6.png","name":"dog ears","index":6},{"maskUrl":"https://tempfile.aiquickdraw.com/ggg/dd9fa155-2f7e-46fc-82f7-089144b43cd5_seg_7.png","name":"dog fur","index":7},{"maskUrl":"https://tempfile.aiquickdraw.com/ggg/dd9fa155-2f7e-46fc-82f7-089144b43cd5_seg_8.png","name":"green grass","index":8},{"maskUrl":"https://tempfile.aiquickdraw.com/ggg/dd9fa155-2f7e-46fc-82f7-089144b43cd5_seg_9.png","name":"green grass","index":9},{"maskUrl":"https://tempfile.aiquickdraw.com/ggg/dd9fa155-2f7e-46fc-82f7-089144b43cd5_seg_10.png","name":"blurred trees","index":10}]}}。 |
data.state | string | 否 | Terminal task state. Allowed values:success / fail。 示例:success。 |
data.taskId | string | 否 | The unique task identifier. 示例:a8584a5b29a6188957b923b47571a278。 |
data.updateTime | integer | 否 | Use completeTime as the completion time; updateTime may equal createTime. 示例:1786701811000。 |
data.failCode | string | 否 | Failure code, a numeric string such as "400" or "500". Present only when state is fail. 示例:500。 |
data.failMsg | string | 否 | Failure reason. Present only when state is fail. 示例:<error detail>。 |
Task completed successfully
json
{
"code": 200,
"msg": "Playground task completed successfully.",
"data": {
"taskId": "a8584a5b29a6188957b923b47571a278",
"model": "grok-imagine-image-2-0/segment-map",
"state": "success",
"param": "{\"input\":\"{\\\"task_id\\\":\\\"8507949ab5358de2262c3f351f12c7df\\\"}\",\"callBackUrl\":\"https://your-domain.com/api/callback\",\"model\":\"grok-imagine-image-2-0/segment-map\"}",
"resultJson": "{\"resultObject\":{\"segments_count\":11,\"segments\":[{\"maskUrl\":\"https://tempfile.aiquickdraw.com/ggg/dd9fa155-2f7e-46fc-82f7-089144b43cd5_seg_0.png\",\"name\":\"golden retriever\",\"index\":0},{\"maskUrl\":\"https://tempfile.aiquickdraw.com/ggg/dd9fa155-2f7e-46fc-82f7-089144b43cd5_seg_1.png\",\"name\":\"dog tongue\",\"index\":1},{\"maskUrl\":\"https://tempfile.aiquickdraw.com/ggg/dd9fa155-2f7e-46fc-82f7-089144b43cd5_seg_2.png\",\"name\":\"dog nose\",\"index\":2},{\"maskUrl\":\"https://tempfile.aiquickdraw.com/ggg/dd9fa155-2f7e-46fc-82f7-089144b43cd5_seg_3.png\",\"name\":\"dog eyes\",\"index\":3},{\"maskUrl\":\"https://tempfile.aiquickdraw.com/ggg/dd9fa155-2f7e-46fc-82f7-089144b43cd5_seg_4.png\",\"name\":\"dog eyes\",\"index\":4},{\"maskUrl\":\"https://tempfile.aiquickdraw.com/ggg/dd9fa155-2f7e-46fc-82f7-089144b43cd5_seg_5.png\",\"name\":\"dog ears\",\"index\":5},{\"maskUrl\":\"https://tempfile.aiquickdraw.com/ggg/dd9fa155-2f7e-46fc-82f7-089144b43cd5_seg_6.png\",\"name\":\"dog ears\",\"index\":6},{\"maskUrl\":\"https://tempfile.aiquickdraw.com/ggg/dd9fa155-2f7e-46fc-82f7-089144b43cd5_seg_7.png\",\"name\":\"dog fur\",\"index\":7},{\"maskUrl\":\"https://tempfile.aiquickdraw.com/ggg/dd9fa155-2f7e-46fc-82f7-089144b43cd5_seg_8.png\",\"name\":\"green grass\",\"index\":8},{\"maskUrl\":\"https://tempfile.aiquickdraw.com/ggg/dd9fa155-2f7e-46fc-82f7-089144b43cd5_seg_9.png\",\"name\":\"green grass\",\"index\":9},{\"maskUrl\":\"https://tempfile.aiquickdraw.com/ggg/dd9fa155-2f7e-46fc-82f7-089144b43cd5_seg_10.png\",\"name\":\"blurred trees\",\"index\":10}]}}",
"costTime": 39,
"createTime": 1786701799000,
"completeTime": 1786701857096,
"updateTime": 1786701811000,
"creditsConsumed": 0
}
}Task failed
json
{
"code": 501,
"msg": "Playground task failed.",
"data": {
"taskId": "a8584a5b29a6188957b923b47571a278",
"model": "grok-imagine-image-2-0/segment-map",
"state": "fail",
"param": "{\"input\":\"{\\\"task_id\\\":\\\"8507949ab5358de2262c3f351f12c7df\\\"}\",\"callBackUrl\":\"https://your-domain.com/api/callback\",\"model\":\"grok-imagine-image-2-0/segment-map\"}",
"costTime": 39,
"createTime": 1786701799000,
"completeTime": 1786701857096,
"updateTime": 1786701811000,
"creditsConsumed": 0,
"failCode": "500",
"failMsg": "<error detail>"
}
}