Video to GIF API
Convert an uploaded video or a public video URL into a GIF. Uses the same wallet and results history as the online tool.
Default price: 1 credit per second, configurable by the administrator under Settings → Video to GIF. Charge = ceil(selected clip seconds) × gifPricing.perSecond; no base fee. Read the current price from GET /api/config. A 5-second clip costs 5 credits at the default rate. Failed or interrupted tasks are automatically refunded.
MP4, WebM and MOV, up to 50 MB. Clips up to 30 seconds, output within 720 × 720 while retaining aspect ratio. Two conversions across the service, with a 90-second processing timeout. No upscaling. Results are saved in call history; download promptly (standard result retention: 30 days).
Endpoint
POST /v1/tools/video-to-gif
Authorization: Bearer YOUR_MODELFOLD_API_KEY
Submit conversion parameters directly; this tool does not use a model ID.
Request parameters
Content-Type: application/json
Request example
{
"url": "https://example.com/video.mp4",
"start": 0,
"duration": 5,
"width": 480,
"fps": 15,
"loop": true,
"expectedCredits": 5
}Parameters
| Parameter | Type | Default | Limits |
|---|---|---|---|
| url | string | — | Public HTTP(S) video URL |
| start | number | 0 | ≥ 0 seconds |
| duration | number | 5 | > 0, ≤ 30 seconds; within source duration |
| width | number / string | 480 | 320, 480, 640, "original" (≤ 720) |
| fps | number | 15 | 10, 15, 20 |
| loop | boolean | true | true = repeat forever; false = play once |
| expectedCredits | number | optional | Reject changed quote with HTTP 409 |
Upload the raw video bytes with Content-Type: application/octet-stream; put the same parameters in the query string (omit url).
curl -X POST 'https://modelfold.ai/v1/tools/video-to-gif?start=0&duration=5&width=480&fps=15&loop=true&expectedCredits=5' -H "Authorization: Bearer $MODELFOLD_API_KEY" -H 'Content-Type: application/octet-stream' --data-binary @video.mp4Response example
HTTP 202:
{"ok":true,"id":"123","credits":5}Poll and download
GET /v1/tools/video-to-gif/jobs/:id
curl https://modelfold.ai/v1/tools/video-to-gif/jobs/123 \
-H "Authorization: Bearer $MODELFOLD_API_KEY"Poll every 2 seconds with the same API Key. Status: pending, ok or failed. Only the task owner can read a result. A failed task returns credits=0 after refund. If a connection is lost, query the task or check your call history before retrying.
{"ok":true,"id":"123","status":"ok","credits":5,"url":"/uploads/outputs/example.gif","size":123456,"latencyMs":2500}url is relative to https://modelfold.ai; size is bytes and latencyMs is milliseconds. Generated results also appear in the account call history.
Errors
| HTTP | Error | Meaning |
|---|---|---|
| 400 | invalid_parameters / invalid_video | Invalid parameters, unsupported source or clip outside duration |
| 401 | unauthorized / invalid_api_key | Sign in or use a valid API Key |
| 402 | insufficient_credits / key_credit_limit_exceeded | Add credits or increase Key quota |
| 409 | price_changed | Review returned credits and perSecond, then submit again |
| 413 | file_too_large | Maximum 50 MB |
| 429 | busy | Two active conversions; retry later |
| 504 | timeout | Input processing exceeded timeout |
Failures after HTTP 202 are reported as task status failed with an automatic refund.
