Skip to content

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 ​

json
{
  "url": "https://example.com/video.mp4",
  "start": 0,
  "duration": 5,
  "width": 480,
  "fps": 15,
  "loop": true,
  "expectedCredits": 5
}

Parameters ​

ParameterTypeDefaultLimits
urlstring—Public HTTP(S) video URL
startnumber0≥ 0 seconds
durationnumber5> 0, ≤ 30 seconds; within source duration
widthnumber / string480320, 480, 640, "original" (≤ 720)
fpsnumber1510, 15, 20
loopbooleantruetrue = repeat forever; false = play once
expectedCreditsnumberoptionalReject 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).

bash
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.mp4

Response example ​

HTTP 202:

json
{"ok":true,"id":"123","credits":5}

Poll and download ​

GET /v1/tools/video-to-gif/jobs/:id

bash
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.

json
{"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 ​

HTTPErrorMeaning
400invalid_parameters / invalid_videoInvalid parameters, unsupported source or clip outside duration
401unauthorized / invalid_api_keySign in or use a valid API Key
402insufficient_credits / key_credit_limit_exceededAdd credits or increase Key quota
409price_changedReview returned credits and perSecond, then submit again
413file_too_largeMaximum 50 MB
429busyTwo active conversions; retry later
504timeoutInput processing exceeded timeout

Failures after HTTP 202 are reported as task status failed with an automatic refund.

ModelFold — one API for all the best AI models.