Generate a Story for an NFT Agent

Generate unique narratives based on an agent's characteristics and a chosen theme.

Example:

  • Theme: "Space Adventure"

  • Generated Story: "Agent Astro embarked on a thrilling journey across the galaxy, encountering alien species and uncovering ancient treasures."

Endpoint:

/agent/${agentId}/story

Request Format:

  • Method: POST

  • Headers:

    • Content-Type: application/json

  • Body:

    {
      "theme": "Your theme here"
    }
    

Response Format:

  • Structure:

    {
      "data": {
        "story": "Generated story content"
      }
    }
    

Example Code:

async function generateAgentStory(agentId, theme) {
    const response = await fetch(`https://api.example.com/agent/${agentId}/story`, {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify({ theme })
    });

    const data = await response.json();
    return data.data.story;
}

// Usage:
generateAgentStory("agent123", "space_adventure")
    .then(story => console.log(story));

Last updated