Model Information
| Model ID | x-ai/grok-imagine-image/edit |
| Category | Image |
| Endpoint | /api/v1/images/generations |
Request
POST https://shark.ai/api/v1/images/generationsAuthentication: Authorization: Bearer <api-key>
Request Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| model | string | ✓ | Model ID: x-ai/grok-imagine-image/edit | |
| image | url | ✓ | The source image to edit | |
| prompt | string | ✓ | The prompt to edit the image with |
Code Examples
curl -X POST https://shark.ai/api/v1/images/generations \
-H "Authorization: Bearer <api-key>" \
-H "Content-Type: application/json" \
-d '{
"model": "x-ai/grok-imagine-image/edit",
"image": "https://example.com/image.jpg",
"prompt": "Your prompt here"
}'Response
Response (200 OK)
{
"created": 1700000000,
"data": [
{
"url": "https://cos.example.com/images/...signed..."
}
],
"usage": {
"input_tokens": 14,
"output_tokens": 1542,
"total_tokens": 1556
},
"credit": 90
}Error Codes
| HTTP | Type | Description |
|---|---|---|
| 400 | invalid_request_error | Invalid parameters |
| 400 | content_moderation | Content blocked by safety system |
| 400 | input_too_large | Input exceeds model limit |
| 401 | auth_error | Invalid API key |
| 402 | insufficient_credits | Not enough credits |
| 429 | rate_limit_error | Too many requests |
| 502 | provider_error | Upstream error, retry later |
| 504 | timeout_error | Request timed out |