API docs › Recipes

Idea (prompt) to video

Let the AI write the script from a one-line idea, then render it.

  1. Write the script from an idea (optionally pick a format id and length):

    curl -X POST https://photonsphere.ai/api/ideas -H "Authorization: Bearer nok_YOUR_KEY" -H "Content-Type: application/json" \
      -d '{"kind":"script","topic":"Why octopuses have three hearts","language":"English","format":"facts","seconds":45}'
    # → {"script":"[SCENE 1: …]…","coverLine1":"…","coverLine2":"…"}
  2. Create the project with that script (you can edit it first), then run it:

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