API docs › Recipes

Script to video

Send your own scene-by-scene script and get a narrated vertical video.

  1. Write the script: each scene is [SCENE n: image description in English] followed by the narration line(s). Create the project:

    curl -X POST https://photonsphere.ai/api/projects -H "Authorization: Bearer nok_YOUR_KEY" -H "Content-Type: application/json" \
      -d '{"name":"Ocean facts","script":"[SCENE 1: A deep blue ocean trench]\nThe ocean hides mountains taller than Everest.\n[SCENE 2: A submarine light in the dark]\nOnly a few people have ever been there.","settings":{"coverLine1":"DEEPER","coverLine2":"THAN EVEREST"}}'
    # → {"id":"PROJECT_ID"}
  2. Optional: ask the price first (same body):

    curl -X POST https://photonsphere.ai/api/estimate -H "Authorization: Bearer nok_YOUR_KEY" -H "Content-Type: application/json" -d '{"name":"Ocean facts","script":"…","settings":{}}'
  3. Optional: tighter narration. "trimPauses": true cuts the silences between spoken words (off by default; works with any voice, also your own audio):

    curl -X POST https://photonsphere.ai/api/projects -H "Authorization: Bearer nok_YOUR_KEY" -H "Content-Type: application/json" -d '{"name":"Ocean facts","script":"…","settings":{"trimPauses":true}}'
  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.