Requests and Responses

Currently we only have 2 API endpoints, which are execute Prompts and execute Workflows. You can use the endpoints to deploy individual prompts or the whole workflow.

Prompt ID

All prompts have a unique id used to reference it. You can find the id at the end of the URL:

Execute Prompt

API Examples

This example API involves a prompt that uses a character's information as inputs to generate a background story.

These are some sample parameters to make the prompt API work:

Sample Request

curl --location 'https://pms.chasm.net/api/prompts/execute/3129' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{ Your API Key }}' \
--data '{"input":{"name":"Alaric","age":30,"physical traits":"strong, kind"}}'

Sample Response

{
    "result": {
        "content": "Name: Alaric\n Age: 30\n Physical Traits: Strong and muscular, with a commanding presence\n Backstory: Alaric is a seasoned warrior, known for his strength and kindness. He hails from a noble lineage and has been a protector of his people for many years. His unwavering dedication to justice and his ability to inspire others make him a natural leader.",
        "status": "length",
        "completionTime": 3147.252650976181,
        "tokens_in": 236,
        "tokens_out": 227,
        "amount_usd": 0.000513,
        "amount_credit": 0.0513,
        "credit_balance": 443.21589
    }
}


Workflow ID

All workflows have a unique id used to reference it. You can find the id at the end of the URL:

Execute Workflow

API Examples

This example API involves a workflow that combines the information of two characters from a previously generated prompt and creates a story based on the given input.

These are some sample parameters to make the workflow API work:

Sample Request

curl --location 'https://pms.chasm.net/api/workflows/execute/785' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{ Your API Key }}' \
--data '{"input":{"name":"Alaric","age":"30","physical traits":"strong, kind","name2":"Mary","age2":"28","physical traits2":"swift"}}'

Sample Response

{
    "Intro": "Alaric and Mary found themselves face to face on the battlefield. Alaric, with his imposing stature, swung his sword with the force of a thunderstorm, while Mary, swift and agile, darted around him like a playful breeze.\n\"Ha! You're quick, I'll give you that,\" Alaric grunted, impressed by Mary's nimbleness as she dodged his attacks.",
    "Climax": "Mary's eyes sparkling with mischief as she evaded Alaric's powerful strikes with ease.\nDespite their differences in fighting styles, they found a strange harmony in their battle, a mutual respect growing between them with every exchange.\nAs their fight drew to a close, both combatants paused, panting and grinning at each other.",
    "Resolution": "You fight well, Mary,\" Alaric said.\n\"Likewise, Alaric.\" Mary replied, a playful glint in her eyes.\nWith a nod of mutual respect, they sheathed their swords, their fight ending not with animosity, but with newfound camaraderie. As they walked away from the battlefield, their laughter echoed in the air, two warriors who had met as adversaries and emerged as unlikely friends."
}

Last updated