Your first request
📝 TODO — this English page is a skeleton. The structure mirrors the Chinese page, which is fully written.
bash
export API_BASE="https://ai.modelfold.online/v1"
export MODELFOLD_API_KEY="mf-..."Image generation
bash
curl -X POST "$API_BASE/images/generations" \
-H "Authorization: Bearer $MODELFOLD_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"nano-banana-2","prompt":"a paper boat drifting down a rainy street","resolution":"1K"}'| Field | Required | Notes |
|---|---|---|
model | yes | An image model ID |
prompt | yes | Up to 2000 characters |
image_url | no | Reference image for edit models |
resolution | no | Resolution preset |
Video generation
bash
curl -X POST "$API_BASE/videos/generations" \
-H "Authorization: Bearer $MODELFOLD_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"kling-2.6/text-to-video","prompt":"a paper boat in the rain","duration":5,"resolution":"720p"}'Chat completions
bash
curl -X POST "$API_BASE/chat/completions" \
-H "Authorization: Bearer $MODELFOLD_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"claude-sonnet-4-6","messages":[{"role":"user","content":"hello"}],"max_tokens":512}'Errors
json
{ "ok": false, "error": { "type": "insufficient_credits", "message": "..." } }| HTTP | error.type | Meaning |
|---|---|---|
400 | unsupported_model | Unknown model, or modality does not match the endpoint |
402 | insufficient_credits | Not enough credits; nothing was charged |
429 | rate_limited | Rate limit exceeded |
502 | upstream_failed | Upstream failed — refunded automatically |
503 | upstream_unavailable | Upstream not configured for this model |