/api/generate endpoint accepts a JSON request body with the following parameters.
TypeScript Interface
Parameters
The user’s request describing the animation to create or changes to make.For initial generation, this should describe the desired animation (e.g., “Create a countdown timer from 10 to 0”).For follow-up edits, this should describe the changes (e.g., “Change the background to blue”).
The OpenAI model to use for generation. Can include optional reasoning effort.Format:
model-name or model-name:reasoning_effortExamples:"gpt-5.2""gpt-5.2:high""o1-mini"
The existing animation code to edit. Required when
isFollowUp is true.Should be the complete React/Remotion component code including imports.Array of previous messages in the conversation for context.The API uses the last 6 messages for context in follow-up edits.
Determines the operation mode:
false: Initial generation mode (streaming)true: Follow-up edit mode (non-streaming)
true, currentCode must be provided.Indicates whether the user has manually edited the code.When
true, the AI will attempt to preserve user edits unless explicitly asked to change them.Context for self-healing error correction loops.Used when previous generation attempts failed due to compilation errors or edit failures.
Array of skill names already used in this conversation.Prevents redundant skill content from being added to context. Skills are automatically detected based on the prompt.Example:
["chart", "3d", "text-animation"]Array of base64-encoded image data URLs for visual context.Supports multimodal prompts where users can reference images.Format:
["data:image/png;base64,iVBORw0KGgo...", ...]Example Requests
Initial Generation
Follow-up Edit with Targeted Changes
With Visual Context
With Conversation History
Validation
For initial generation requests (whenisFollowUp is false), the API validates that the prompt is appropriate for motion graphics generation. Invalid prompts will return a 400 error with type "validation".
Valid prompts include requests for:
- Animated text, titles, or typography
- Data visualizations (charts, graphs, progress bars)
- UI animations (buttons, cards, transitions)
- Logo animations or brand intros
- Social media content
- Any visual/animated content
- Questions or general chat
- Requests for written content
- Non-visual tasks