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 meigen.ai’s own browser integration, a logged-in session access token is accepted. Daily free credits cover basic models only (currently Z Image Turbo); premium models always require welcome or purchased credits. Third-party integrations should always use the API Token above.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 - Read the resulting
imageUrl/imageUrls/videoUrldirectly from the status response oncestatus === "completed".
Polling Best Practices
- Recommended interval: 3 seconds between status checks
- Stop when:
statusiscompletedorfailed - Timeout: 5 minutes for image models, 10 minutes for video. Per-model typical times are listed on the Models page.
Rate Limits
POST /api/generate/v2 is limited to 12 requests per minute per user. Exceeding the limit returns 429 Too Many Requests with these response headers:
Retry-After: 60X-RateLimit-Limit: 12X-RateLimit-Remaining: 0
Retry-After and apply exponential backoff for repeated failures.
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 deducts credits from your account. Image models charge a flat amount per image; Seedance 2.0 is billed per second. See the Models page for the full per-model pricing table.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 |
POST /api/generate/v2, the 400 / 402 bodies include extra fields useful for debugging:
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