https://www.meigen.ai/api/.
Authentication
API requests require a Bearer token. There are two authentication methods:API Token (Recommended)
Use an API key that starts withmeigen_sk_. Create one from your account settings under API Keys.
Session Token
For browser-based integrations, you can use a Supabase session access token. This method uses both daily and purchased credits.Base URL
Request Format
All request bodies must be sent as JSON with theContent-Type: application/json header.
Response Format
All responses return JSON. Successful responses include asuccess: true field:
error field:
Asynchronous Generation
Image generation is asynchronous. The flow is:- Submit a generation request →
POST /api/generate/v2 - Poll the status endpoint →
GET /api/generate/v2/status/:id - Retrieve the completed image →
GET /api/images/:id
Polling Best Practices
- Recommended interval: 3 seconds between status checks
- Stop when:
statusiscompletedorfailed - Timeout: consider giving up after 5 minutes for image models, 10 minutes for video
Typical Generation Times
| Model | Typical Time |
|---|---|
| Z Image Turbo | ~5 seconds |
| Nanobanana 2, Seedream | ~15 seconds |
| Nanobanana Pro | ~15 seconds |
| GPT image1.5 | ~20 seconds |
| Midjourney V7 / Niji 7 | ~60 seconds |
| Seedance 2.0 (video) | ~1–3 minutes |
| Veo 3.1 (video) | 2–6 minutes |
Rate Limits
API requests are subject to rate limiting. If you receive a429 Too Many Requests response:
- Wait 10–30 seconds before retrying
- Implement exponential backoff for repeated failures
- Specific rate limits may vary based on server load
Caching
Some GET endpoints return cached responses:| Endpoint | Cache Duration |
|---|---|
GET /api/models | 5 minutes |
GET /api/images/:id | 1 hour |
POST endpoints | No caching |
Credits
Each generation consumes credits based on the model used. Check the Models page for per-model pricing.| Model | Credits |
|---|---|
| Z Image Turbo | 2 |
| GPT image1.5 | 2 |
| Nanobanana 2 | 5 |
| Seedream 5.0 Lite | 5 |
| Seedream 4.5 | 5 |
| Nanobanana Pro | 10 |
| Midjourney V7 | 15 |
| Niji 7 | 15 |
| Seedance 2.0 | Per-second (see Models) |
| Veo 3.1 | 20 |
Error Responses
| Status Code | Meaning |
|---|---|
| 400 | Bad request — invalid parameters |
| 401 | Unauthorized — invalid or missing token |
| 402 | Payment required — insufficient credits |
| 404 | Not found |
| 429 | Rate limited — wait and retry |
| 500 | Server error |
Endpoints
Generate Image
POST /api/generate/v2
List Models
GET /api/models
Get Image
GET /api/images/:id
Manage Tokens
POST/GET/DELETE /api/tokens