Skip to content

API Reference ​

ModelFold exposes two groups of HTTP APIs:

GroupPrefixAuthenticationPurpose
Model gateway/v1API keyCall image, video and chat models
Console APIs/apiSession token (JWT)Registration, login, profile, API keys, wallet and email

Both groups use the same domain:

text
https://modelfold.ai          # Current deployment URL
https://modelfold.ai     # Production domain

Model gateway /v1 ​

MethodPathDescription
GET/v1/modelsList available models
POST/v1/images/generationsGenerate or edit images
POST/v1/videos/generationsGenerate videos
POST/v1/chat/completionsOpenAI-compatible chat completions

See the Gateway reference.

Console APIs /api ​

MethodPathDescription
POST/api/auth/registerRegister
POST/api/auth/loginSign in and receive a JWT
GET/api/auth/meGet the signed-in user
POST/api/auth/logoutSign out and revoke the current session
GET/api/accountAccount overview
PUT/api/account/profileUpdate display name
POST/api/account/avatarUpload avatar
DELETE/api/account/avatarDelete avatar
POST/api/account/passwordChange password
GET/api/account/sessionsList signed-in devices
DELETE/api/account/sessions/:idSign out a specific device
DELETE/api/account/sessionsSign out all other devices
GET/api/keysList API keys
POST/api/keysCreate an API key
DELETE/api/keys/:idRevoke an API key
GET/api/walletBalance and transactions
POST/api/wallet/topupTop up credits
GET/api/wallet/usageUsage history
GET/api/mail/statusMail transport status
POST/api/mail/testSend a test email
POST/api/email/verifyVerify email
POST/api/email/resendResend verification email
POST/api/email/forgotRequest password reset
POST/api/email/resetReset password with a token
GET/api/healthHealth check

Lists return a fixed number of recent records: 50 transactions or 100 model requests. Pagination parameters are not currently provided.

Detailed references: Authentication, Account, API Keys, Wallet, Email.

Response format ​

Success:

json
{ "ok": true, "...": "各接口自有字段" }

Failure:

json
{ "ok": false, "error": { "type": "insufficient_credits", "message": "积分不足:需要 18,当前 5" } }

Some console endpoints return error as a string rather than an object. For example, failed login returns {"ok":false,"error":"invalid_credentials"}. Refer to each endpoint's reference page.

Rate limits ​

ScopeLimit
/v1 gateway60 requests per key per minute
API key creation30 requests per account per minute
Registration / login30 requests per IP per ten minutes
Password changes30 requests per account per ten minutes
Top-ups10 requests per account per minute
Email resend / recovery / reset10 requests per IP per ten minutes
Test email5 requests per account per ten minutes

Exceeding a limit returns 429. Responses use the draft-7 RateLimit and RateLimit-Policy headers.

Status codes ​

HTTPMeaning
400Invalid parameters, such as email format, password strength or model/endpoint mismatch
401Missing or invalid credentials
402Insufficient balance
403Account suspended
404Resource not found
409Conflict, such as an already registered email
429Rate limit exceeded
500Server error
502Provider call failed; gateway credits refunded automatically
503Provider not configured

Health check ​

bash
curl https://modelfold.ai/api/health
json
{ "ok": true, "db": "up" }

If the database is unavailable, returns 503 with {"ok":false,"db":"down"}.

ModelFold — one API for all the best AI models.