Magics

Generate Magic From Prompt

Generate text (description, records, abilities and more) based on input.

post
/v1/magic/{promptId}/generate

Authorization

ChatBotKit API Secret * Required

HTTP Authorization Scheme: bearer

Path Parameters

promptIdstring* Required

The ID of the prompt to use for generation

Request Body * Required

Request Body Schema: application/json

textstring

The text to use as input

propsobject

Additional properties to pass to the prompt

modelstring

Optional language model to use for generation

import { ChatBotKit } from '@chatbotkit/sdk'

const cbk = new ChatBotKit({

secret: process.env.CHATBOTKIT_API_KEY!

})

const response = await cbk.magic.generate(

promptId,
{
"text":"string",
"props":"object",
"model":"string"
}
)
{
"text":"string",
"usage":{
"token":"number"
}
}
The magic prompt completed successfully