API docs › Recipes

Long video to Shorts

Upload a long video, let the AI find the best moments and render clips.

  1. Upload the long video as a raw stream (or import a direct .mp4 link with POST /api/long/url):

    curl -X POST https://photonsphere.ai/api/long -H "Authorization: Bearer nok_YOUR_KEY" -H "Content-Type: application/octet-stream" -H "x-file-name: talk.mp4" --data-binary @talk.mp4
    # → {"id":"LONG_ID","duration":…}
  2. Find the best moments (charged, refunded if it fails), then poll:

    curl -X POST https://photonsphere.ai/api/long/LONG_ID/find -H "Authorization: Bearer nok_YOUR_KEY" -H "Content-Type: application/json" -d '{"language":"auto","focus":"","length":"auto"}'
    curl https://photonsphere.ai/api/long/LONG_ID -H "Authorization: Bearer nok_YOUR_KEY"
  3. Create a clip project for a moment and run it:

    curl -X POST https://photonsphere.ai/api/projects -H "Authorization: Bearer nok_YOUR_KEY" -H "Content-Type: application/json" -d '{"name":"Clip 1","script":"[SCENE 1: clip]\nclip","settings":{"clip":{"videoId":"LONG_ID","start":120.5,"end":158,"reframe":"face"}}}'
  4. Start the render (credits are charged now and refunded if it fails):

    curl -X POST https://photonsphere.ai/api/projects/PROJECT_ID/run -H "Authorization: Bearer nok_YOUR_KEY"
  5. Poll until status is ready (or error), then download the MP4:

    curl https://photonsphere.ai/api/projects/PROJECT_ID -H "Authorization: Bearer nok_YOUR_KEY"
    curl -o video.mp4 https://photonsphere.ai/api/projects/PROJECT_ID/file/video -H "Authorization: Bearer nok_YOUR_KEY"

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