Skip to content

Gateway reference (/v1) ​

📝 TODO — this English page is a skeleton. The structure mirrors the Chinese page, which is fully written.

All gateway endpoints authenticate with an API key:

text
Authorization: Bearer mf-...

GET /v1/models ​

bash
curl "$API_BASE/models" -H "Authorization: Bearer $MODELFOLD_API_KEY"

POST /v1/images/generations ​

FieldTypeRequiredNotes
modelstringyesImage model ID
promptstringyesUp to 2000 characters
image_urlstringnoReference image for edit models
resolutionstringnoResolution preset

POST /v1/videos/generations ​

Same fields as images, plus:

FieldTypeRequiredNotes
durationnumbernoLength in seconds
resolutionstringnoe.g. 720p

POST /v1/chat/completions ​

FieldTypeRequiredNotes
modelstringyesChat model ID
messagesarrayyesNon-empty array of { role, content }
max_tokensnumbernoDefaults to 1024
temperaturenumbernoSampling temperature

Billing ​

  1. Balance is checked first — 402 before the upstream is called.
  2. Media is charged a fixed number of credits; chat is pre-authorized on an estimate.
  3. Chat is settled from the real token usage (adjusted up or down).
  4. Failures are refunded automatically and reported as 502.
  5. Every request is logged, successful or not.

Errors ​

HTTPerror.type
400unsupported_model / invalid_prompt / invalid_messages
401unauthorized
402insufficient_credits
429rate_limited
502upstream_failed (refunded)
503upstream_unavailable

ModelFold — one API for all the best AI models.