The Storytelling API allows users to submit scripts and analyze their content to extract moods, themes, emotions, and more. It also provides the capability to generate media such as images, voices, and videos based on the analyzed script.
- Script Analysis: Submit a story and receive detailed analysis, including mood, tone, and themes.
- Media Generation: Generate images, voices, and videos based on analyzed scripts.
- API Key Authentication: Secure your API usage with an API key.
- Worker Coordination: The worker manages media generation and video bundling using FFmpeg.
-
Install dependencies:
pnpm install
-
Start required services using Docker:
docker-compose up
-
Run database migrations:
pnpm run db:migrate
-
Start the API:
pnpm run start
Send a POST request to /users with the following payload:
{
"email": "user@example.com"
}Send a POST request to /api-keys:
{
"label": "My API Key",
"user_id": "your-user-id"
}The API key should be included in all subsequent requests using the x-api-key header.
Send a POST request to /scripts/analyze with your story:
{
"content": "Eager to transcend earthly bounds, Mira, a meticulous software engineer, spent every spare moment crafting a code-driven lunar rocket, defying gravity with lines of TypeScript until, against all odds, she touched down on the moon—her laptop glowing triumphantly under the silent lunar sky."
}{
"script": {
"id": "uuid",
"content": "...",
"type": "STORY",
"analysis": {
"mood": "uplifting",
"tone": "inspiring",
"scenes": [
{ "text": "Eager to transcend...", "emotion": "determination" },
{ "text": "defying gravity...", "emotion": "excitement" },
{ "text": "her laptop glowing...", "emotion": "pride" }
],
"themes": ["space exploration", "engineering", "persistence"]
}
}
}Based on the script analysis, you can make additional requests:
- Generate Images:
POST /images - Generate Voices:
POST /voices - Create a Video:
POST/stories
pnpm run dev- Start API in development modepnpm run worker- Start background workerpnpm run start- Start both API and workerpnpm run db:migrate- Run database migrationspnpm run lint- Check code lintingpnpm run lint:fix- Auto-fix linting issues
Feel free to open an issue or submit a pull request if you would like to contribute.