Model Information
| Model ID | midjourney/text-to-image |
| 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: midjourney/text-to-image | |
| niji | enum: close | 0 | 5 | 6 | "close" | Niji mode for anime/Eastern aesthetics | |
| seed | number | -1 | Random seed (-1 for random) | |
| sref | url | URL of a reference image for style guidance | ||
| chaos | number (0..100) | 0 | Variety in results (0-100) | |
| weird | number (0..3000) | 0 | Unconventional aesthetics (0-3000) | |
| prompt | string | ✓ | Text prompt describing the image to generate | |
| quality | enum: 0.25 | 0.5 | 1 | 2 | "1" | Image detail and processing time (0.25=draft, 1=standard, 2=high) | |
| stylize | number (0..1000) | 100 | Artistic style intensity (0-1000) | |
| version | enum: 6 | 6.1 | 7 | "7" | Midjourney model version | |
| aspect_ratio | enum: 1:1 | 9:16 | 16:9 | 4:3 | 3:4 | 2:3 | 3:2 | 9:21 | 21:9 | "1:1" | Aspect ratio of the generated image |
Code Examples
curl -X POST https://shark.ai/api/v1/images/generations \
-H "Authorization: Bearer <api-key>" \
-H "Content-Type: application/json" \
-d '{
"model": "midjourney/text-to-image",
"niji": "close",
"seed": -1,
"chaos": 0,
"weird": 0,
"prompt": "Your prompt here",
"quality": "1",
"stylize": 100,
"version": "7",
"aspect_ratio": "1:1"
}'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 |