API docs › Recipes

AI video with first frame, last frame and references

Generate a clip that starts and ends on your images, keeping up to 4 reference ingredients.

  1. Upload the first frame, the last frame and up to 4 references (images, or videos up to 10 s) (multipart field "file"). The answer has the input id ("t-…"):

    curl -X POST https://photonsphere.ai/api/tools -H "Authorization: Bearer nok_YOUR_KEY" -F "file=@my-file"
    # → {"id":"t-…","kind":"video|audio|image|text"}
  2. Run the tool (credits shown in the app are charged now and refunded if it fails):

    curl -X PUT https://photonsphere.ai/api/tools -H "Authorization: Bearer nok_YOUR_KEY" -H "Content-Type: application/json" \
      -d '{"input":"t-FIRST","tool":"imagevideo","params":{"prompt":"The camera pushes in as the product lights up","ratio":"9:16","seconds":8,"tier":"pro","endImage":"t-LAST","refs":["t-REF1","t-REF2"]}}'
    # → {"id":"JOB_ID"}
  3. Poll the job, then download the result:

    curl https://photonsphere.ai/api/tools/JOB_ID -H "Authorization: Bearer nok_YOUR_KEY"
    # {"state":"running"|"ready"|"error","progress":0-100}
    curl -o result.mp4 "https://photonsphere.ai/api/tools/JOB_ID?download=1" -H "Authorization: Bearer nok_YOUR_KEY"
  4. Not every model accepts everything: the answer explains what to change when the chosen tier does not support last frames or reference videos.

All calls need Authorization: Bearer nok_… (see Authentication). Prices are the same as in the app.