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, Flux 2 Klein, Agnes Image 2.1 Flash and Agnes Video 2.0); every other model always requires 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: allow up to 6 minutes for image models and up to 12 minutes for video. A job that overruns comes back as
failedand the credits are refunded in full — the output is discarded, so a late result never arrives. Short of that, the opposite applies: if your client stops polling early, the job still completes and is still charged. Poll untilstatusis terminal (completed/failed), and treat the wall-clock values above only as a backstop. The slowest cases are Seedance 2.0 and Veo 3.1 at high resolution / long duration. Per-model typical times are listed on the Models page.
Caching
Some GET endpoints return cached responses:
Model list changes — a new model, a retired one, a changed default — can therefore take up to an hour to become visible. Plan your own refresh cadence accordingly.
Credits
Each generation deducts credits from your account. Image models charge per image (the amount can vary with resolution and quality); video models are billed per second or per generation, depending on the model. See the Models page for the full per-model pricing table.Error Responses
For
POST /api/generate/v2, error bodies include extra fields useful for debugging, and most carry a machine-readable code alongside the human-readable error:
Errors without a
code (such as an unsupported aspect ratio) should be handled by status code and error text.
Endpoints
Generate Image
POST /api/generate/v2
List Models
GET /api/models
Get Image
GET /api/images/:id
API Tokens
Create & revoke in account settings