Every spell has an accompanying API endpoint. Using the API provides ultimate flexibility to use your own frontend interface, as opposed to the Spell Run Page.

The benefits of using Respell’s API as your AI backend are:

  • Extremely simple. A super complex chain of logic and AI models can be rediced to a simple POST request.
  • Upgrading or changing your AI models is as simple as clicking “X” andd dragging a new one. No code changes required.
  • Access to all the latest models. Many small business and indie developer don’t get priority access to top of the line models. Respell makes this available for all users.

Running your spell

Runs this spell from start to finish. Supply the inputs values for each block and the outputs will be based on the spell models’ interactions with these inputs. To always run the latest version of the spell, omit the spell version ID.

Javascript
const response = await fetch('https://api.respell.ai/v1/run', {
  method: 'POST',
  headers: {
    authorization: 'Bearer ' + RESPELL_API_KEY,
    accept: 'application/json',
    'content-type': 'application/json',
  },
  body: JSON.stringify({
    spellId: RESPELL_SPELLID,
    // This field can be omitted to run the latest published version
    spellVersionId: RESPELL_SPELL_VERSIONID,
    // Fill in a value for your dynamic input block
    inputs: {
      input: 'Example text',
    },
  }),
});