AI Story Generator

Generate story based on mode, topic and genre

Try Demo

Endpoints

  1. Endpoint: POST request to "https://api.magicapi.dev/api/v1/capix/story/generate/story/v1/".

  2. Headers:

    • Content-Type: Specifies the format of the request body, which is application/json.

    • x-magicapi-key: The API key for authentication. Replace "API_KEY" with your actual API key.

  3. Request Body:

    • Format: JSON

    • Parameters:

      • mode: Specifies the mode of story generation. In this case, it's set to "Creative".

      • text: The text providing details about the story to be generated. This includes the story topic, setting, main characters, plot details, resolution, and themes.

      • word_count: Specifies the desired word count for the generated story, set to 1200 in this example.

      • story_genre: Specifies the genre of the story. In this case, it's set to "Mystery".

  4. Authentication: The API requires an API key (token) for authentication.

Here's the documentation based on the provided cURL command:


Story Generation API Documentation

Endpoint:

POST https://api.magicapi.dev/api/v1/capix/story/generate/story/v1/

Request Body (JSON):

{
  "mode": "Creative",
  "text": "Story Topic: A Time-Travel Adventure Setting: The story is set in both the present day and the Victorian era. The present-day setting is a bustling modern city known for its technological advancements. The Victorian setting is characterized by cobblestone streets, gas-lit lamps, and the early stages of industrialization. Main Characters: Alex: A curious and adventurous software engineer from the present day who inadvertently discovers a time-travel device. Eliza: A resourceful and intelligent Victorian-era inventor who dreams of changing the future. Plot Details: Discovery of the Time Machine: Alex discovers an old, mysterious device in their attic, left behind by a forgotten ancestor. Experimenting with it, they accidentally activate it and are transported to the Victorian era. Meeting Eliza: Alex meets Eliza, who is fascinated by the time machine and Alex's futuristic knowledge. Together, they explore the possibilities of time travel. A Threat Emerges: A sinister figure from the Victorian era learns about the time machine and wants to use it for nefarious purposes, threatening both the past and the future. Race Against Time: Alex and Eliza must work together to safeguard the time machine and prevent the alteration of history. They face challenges in both eras, blending elements of Victorian society with futuristic technology. Resolution: The story concludes with a thrilling confrontation, and a decision that affects both characters' destinies. Themes: The story explores themes of adventure, the ethics of time travel, the impact of technology on society, and the timeless nature of human curiosity and ambition.",
  "word_count": 1200,
  "story_genre": "Mystery"
}

Request Parameters:

  • mode: Specifies the mode of story generation.

  • text: Details about the story, including topic, setting, characters, plot, resolution, and themes.

  • word_count: Desired word count for the generated story.

  • story_genre: Genre of the story.

Code Examples

curl -X 'POST' \
  'https://api.magicapi.dev/api/v1/capix/story/generate/story/v1/' \
  -H 'accept: application/json' \
  -H 'x-magicapi-key: API_KEY' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d 'text=Story%20Topic%3A%20A%20Time-Travel%20Adventure%0A%0A%0ASetting%3A%20The%20story%20is%20set%20in%20both%20the%20present%20day%20and%20the%20Victorian%20era.%20The%20present-day%20setting%20is%20a%20bustling%20modern%20city%20known%20for%20its%20technological%20advancements.%20The%20Victorian%20setting%20is%20characterized%20by%20cobblestone%20streets%2C%20gas-lit%20lamps%2C%20and%20the%20early%20stages%20of%20industrialization.%0A%0A%0AMain%20Characters%3A%0A%0A%0AAlex%3A%20A%20curious%20and%20adventurous%20software%20engineer%20from%20the%20present%20day%20who%20inadvertently%20discovers%20a%20time-travel%20device.%0AEliza%3A%20A%20resourceful%20and%20intelligent%20Victorian-era%20inventor%20who%20dreams%20of%20changing%20the%20future.%0APlot%20Details%3A%0A%0A%0ADiscovery%20of%20the%20Time%20Machine%3A%20Alex%20discovers%20an%20old%2C%20mysterious%20device%20in%20their%20attic%2C%20left%20behind%20by%20a%20forgotten%20ancestor.%20Experimenting%20with%20it%2C%20they%20accidentally%20activate%20it%20and%20are%20transported%20to%20the%20Victorian%20era.%0AMeeting%20Eliza%3A%20Alex%20meets%20Eliza%2C%20who%20is%20fascinated%20by%20the%20time%20machine%20and%20Alex'\''s%20futuristic%20knowledge.%20Together%2C%20they%20explore%20the%20possibilities%20of%20time%20travel.%0AA%20Threat%20Emerges%3A%20A%20sinister%20figure%20from%20the%20Victorian%20era%20learns%20about%20the%20time%20machine%20and%20wants%20to%20use%20it%20for%20nefarious%20purposes%2C%20threatening%20both%20the%20past%20and%20the%20future.%0ARace%20Against%20Time%3A%20Alex%20and%20Eliza%20must%20work%20together%20to%20safeguard%20the%20time%20machine%20and%20prevent%20the%20alteration%20of%20history.%20They%20face%20challenges%20in%20both%20eras%2C%20blending%20elements%20of%20Victorian%20society%20with%20futuristic%20technology.%0AResolution%3A%20The%20story%20concludes%20with%20a%20thrilling%20confrontation%2C%20and%20a%20decision%20that%20affects%20both%20characters'\''%20destinies.%0AThemes%3A%20The%20story%20explores%20themes%20of%20adventure%2C%20the%20ethics%20of%20time%20travel%2C%20the%20impact%20of%20technology%20on%20society%2C%20and%20the%20timeless%20nature%20of%20human%20curiosity%20and%20ambition.&word_count=1200&mode=Creative&story_genre=Mystery'

It returns response like this

{
  "story": "In the heart of a bustling modern city, Alex, a curious and adventurous software engineer, stumbled upon a hidden secret tucked away in the dusty corners of their attic. An old, mysterious device, left behind by a forgotten ancestor, beckoned to Alex with its enigmatic aura. Intrigued, Alex couldn't resist the temptation to tinker with it, resulting in a dazzling display of lights and whirring mechanisms. In a heartbeat, they found themselves transported back in time to the Victorian era.\n\nAs Alex stood bewildered amidst cobblestone streets bathed in the soft glow of gas-lit lamps, a figure approached – Eliza, a resourceful and intelligent Victorian-era inventor with a gleam of curiosity in her eyes. She was drawn to the strange contraption that had whisked Alex away and marveled at the futuristic knowledge Alex possessed.\n\nTogether, Alex and Eliza embarked on a thrilling journey through time, exploring the intricacies of the time machine and the vast possibilities it presented. Their collaboration bridged two eras, blending Victorian society's traditions with Alex's technological insights from the future.\n\nHowever, their newfound adventure took a sinister turn when a shadowy figure from the Victorian era unearthed the existence of the time machine. Driven by malevolent intentions, the mysterious antagonist sought to harness the power of time travel for their own nefarious purposes, posing a grave threat to both the past and the future.\n\nFaced with impending danger, Alex and Eliza realized that they held the fate of history in their hands. With time running out, they raced against the clock, navigating through the complexities of each era and confronting unforeseen challenges that tested their resolve.\n\nAs the tension mounted, a final showdown unfolded, blending elements of mystery and suspense. Alex and Eliza found themselves in a thrilling confrontation with the malevolent figure, the stakes higher than ever before. In a climactic turn of events, they made a decision that would not only safeguard the integrity of the timeline but also shape their destinies in ways they never imagined.\n\nAmidst the whirlwind of adventure and intrigue, the timeless themes of human curiosity and ambition resonated deeply. The ethics of time travel, the impact of technology on society, and the unyielding spirit of exploration painted a tapestry of wonder and reflection, transcending the boundaries of time itself.\n\nAs Alex and Eliza bid farewell to the Victorian era, their hearts enriched by the bond forged through their extraordinary journey, they carried with them a newfound understanding of the interconnectedness of past, present, and future. And as the time machine hummed to life once more, propelling them back to the present day, they knew that their adventures had only just begun – for time, like the mysteries it held, was infinite and ever beckoning to those who dared to explore its depths."
}

Data values

  • You can explain the story on the topic parametr

  • Word Count is the max word count of the story. Max 2000 is received.

  • Writing Mode could be either: Standard, Complex, Creative, Simple

  • Story Genre could be eighter: science fiction, mystery, fantasy, descriptive

Last updated