⏩ Video Continuation — the “Continue” button for your app

Native endpoint + ready-to-use widget: after every video generated with the Neuralai API, your app shows a “Continue” button that extends the scene natively, with perfect visual and audio continuity.

How it works

1

Generate the video with the API endpoint (neuralaiPublicApi with video intent, or any video generation): the response includes result.video_id.

2

Under every video, show the “Continue” button: with the included widget (neuralai-continue.js) it is automatic; with your own code use the video_continue endpoint.

3

When the button is pressed, the scene continues from the last frame of the previous video: same characters, voice, lighting and style, no jumps.

4

The new video arrives with a video_id: the “Continue” button appears under it too, so the chain continues up to the 40-second ceiling.

Endpoint

POST https://app.neuralaiweb.com/functions/neuralaiVideoContinue

Request parameters

api_keystringrequired

API key with the “video” scope (or in the x-api-key header).

video_idstringrequired

ID of the source video: result.video_id (or operation_name) returned by the video generation.

promptstringrequired

How the scene should continue. Continuity (characters, voice, lighting) is applied automatically.

duration_secondsnumberoptional

Duration of the new clip: 4, 6, 8 or 10 seconds (default: inherited from the source video).

resolutionstringoptional

“720p” (default) or “1080p”. If omitted, inherited from the source video.

aspect_ratiostringoptional

“16:9”, “9:16” or “1:1”. If omitted, inherited from the source video.

operation_namestringoptional

RESUME only: repeats the polling of an in-progress continuation, at no cost.

Response

video_url

Public URL of the continued video (MP4, ready for <video>).

google_video_uri

Native source URI of the video: for the next continuation it is used automatically by the API.

video_id

ID of the new clip: pass it as video_id to the next call to continue the chain.

chain_seconds

Total seconds of the chain so far (40 ceiling).

PENDING: if the continuation is not ready within ~78s the response is { status: 'pending', operation_name }: repeat the request with operation_name until success (free polling, recommended every 10s for up to 9.5 minutes). The 200 tokens are charged only on delivery.

Limits and billing

  • •Continuation chain: maximum 40 total seconds (Gemini Omni). Over the ceiling the API replies chain_limit_reached.
  • •Cost: 200 tokens per continuation, charged ONLY on video delivery (automatically refunded if generation fails).
  • •The source video must be YOUR video job completed successfully (result.video_id from the orchestrator or the video API's operation_name).
  • •The key requires the “video” scope; the token balance is checked before every request.

Native widget — ready-made “Continue” button

Include the official script and tag every video: the “Continue” button (label automatically in the visitor's language, 13 languages) handles pending, polling and insertion of the new video with its own button by itself, up to the chain ceiling. Style customizable via CSS variables, automatic dark/light.

Auto-embed with data attributes

<!-- 1. Includi lo script ufficiale (dopo ogni blocco di video) -->
<script src="https://app.neuralaiweb.com/neuralai-continue.js" defer></script>
 
<!-- 2. Marca ogni video generato con il suo video_id -->
<div data-neuralai-video="RESULT_VIDEO_ID" data-neuralai-prompt="La donna esce dal negozio" data-neuralai-duration="6"></div>
 
<!-- 3. Inizializza il widget con la tua API key (scope video) -->
<script>
NeuralaiVideoContinue.init({ apiKey: "nai_xxx" });
</script>

Programmatic mount

// Mount programmatico (controlla tu quando/come il pulsante compare)
NeuralaiVideoContinue.init({ apiKey: "nai_xxx" });
 
NeuralaiVideoContinue.mount("#video-card-1", {
videoId: "RESULT_VIDEO_ID",
prompt: "La donna esce dal negozio e si dirige verso la macchina",
durationSeconds: 6,
onContinue: (data) => {
// data: { video_url, video_id, chain_seconds, duration_seconds, ... }
console.log("Nuova clip:", data.video_url);
}
});
 
// Oppure: proxy server-side (la chiave non tocca il browser)
NeuralaiVideoContinue.init({ proxyUrl: "https://tuoserver.com/neuralai-continue" });

Integration examples

curl

curl -X POST https://app.neuralaiweb.com/functions/neuralaiVideoContinue \
-H "Content-Type: application/json" \
-d '{
"api_key": "nai_xxx",
"video_id": "RESULT_VIDEO_ID",
"prompt": "La donna esce dal negozio e si dirige verso la macchina",
"duration_seconds": 6
}'
 
# Se la risposta è {"status":"pending","operation_name":"JOB_ID"}:
curl -X POST https://app.neuralaiweb.com/functions/neuralaiVideoContinue \
-H "Content-Type: application/json" \
-d '{"api_key":"nai_xxx","operation_name":"JOB_ID"}'

JavaScript

async function continueVideo(apiKey, videoId, prompt, durationSeconds = 6) {
const ENDPOINT = "https://app.neuralaiweb.com/functions/neuralaiVideoContinue";
let payload = { api_key: apiKey, video_id: videoId, prompt, duration_seconds: durationSeconds };
const deadline = Date.now() + 9.5 * 60 * 1000; // polling max ~9,5 min
 
while (Date.now() < deadline) {
const res = await fetch(ENDPOINT, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(payload),
});
const data = await res.json();
if (data.status === "pending" && data.operation_name) {
await new Promise(r => setTimeout(r, 10000));
payload = { api_key: apiKey, operation_name: data.operation_name }; // polling gratuito
continue;
}
if (data.status === "success") return data; // video_url, video_id, chain_seconds
throw new Error(data.error);
}
throw new Error("Continuazione non completata in tempo");
}
 
// Uso: sotto ogni video generato mostra il pulsante Continua
function renderContinueButton(container, videoId, prompt) {
const btn = document.createElement("button");
btn.textContent = "Continue";
btn.onclick = async () => {
btn.disabled = true;
const data = await continueVideo(API_KEY, videoId, prompt);
const video = document.createElement("video");
video.src = data.video_url;
video.controls = true;
container.appendChild(video);
renderContinueButton(container, data.video_id, prompt); // catena
};
container.appendChild(btn);
}

Error codes

401 invalid_api_key

Key missing, invalid or revoked.

403 missing_scope

The key does not have the “video” scope.

402 insufficient_tokens

Token balance below 200.

404 video_not_found

video_id is not your video job (or the operation_name no longer exists).

400 chain_limit_reached

The chain would exceed the 40 total seconds.

500 generation_failed

Generation failed on the worker: no tokens charged.

Related references

  • • Endpoint video — /api-docs/generators
  • • Response Schema — /api-docs/schema
  • • API Key Security — /api-docs/security
  • • Instructions for AI Assistants