Skip to Content

Grok

Overview

Grok is a powerful text-to-image and image-to-image model that creates high-quality images from text prompts or existing images.

Test API KEY: key_00000000000000000000000000000000

Endpoints

1. Create Task

Request

POST https://api.pixwithapi.online/api/task/create

Headers

HeaderValueRequired
Content-Typeapplication/jsonYes
Api-Key{API_KEY}Yes

Request Parameters

ParameterTypeRequiredDescription
promptstringYesThe input prompt (e.g., “a futuristic city”)
image_urlsarrayConditional[“https://cdn.pixwithapi.online/xxx.jpg ”]. Required for image-to-image mode. Provide 1 image.
model_idstringYes0-19 (Text-to-Image)
optionsobjectYesConfiguration options for the task
options.prompt_optimizationbooleanYesIf true, all prompt words will be automatically translated into English.
options.aspect_ratiostringConditionalAspect ratio of the output. Valid values: '2:3' (Default), '3:2', '1:1', '9:16', '16:9'. Note: This parameter is only allowed for text-to-image mode. Do not include this parameter when using image-to-image mode (when image_urls is provided).

Example Request - Text-to-Image

{ "prompt": "a futuristic city", "model_id": "0-19", "options": { "prompt_optimization": true, "aspect_ratio": "2:3" } }

Example Request - Image-to-Image

{ "prompt": "turn this into a cyberpunk style", "image_urls": [ "https://cdn.pixwithapi.online/images/cf0ddb5ad6a0f0c85ab4d1dceb9fd89c_0.jpeg" ], "model_id": "0-19", "options": { "prompt_optimization": true } }

Response Parameters

ParameterTypeDescription
codeint1=success, 0=error
messagestringSuccess and failure messages
dataobject
data.task_idstring
data.estimated_timeintEstimated time in seconds

Response

{ "code": 1, "message": "success", "data": { "task_id": "d425ab4dc256f0ebaa84862b9cea8a3d", "estimated_time": 30 } }
Last updated on