Skip to content

Online Models API

noco-ai edited this page Feb 24, 2024 · 2 revisions

Spell Book provides an API for accessing any running Elemental Golem skills from a single API endpoint. Below are some examples of calls to the API endpoint.

List Online Skills

curl http://localhost:3000/api/v1/skill/online

Call Golem Skill

The skill routing key is present in the GET request and the payload body will vary depending on the skill called. See the Elemental Golem schema/ folder for all validators. Expected JSON bodies

curl -X POST "http://localhost:3000/api/v1/skill/execute/llama_v2_chat_7b" \
-H "Content-Type: application/json" \
-d '{
    "messages": [ { "role": "user", "content": "Why is the sky blue?" } ],
    "max_new_tokens": 758
}'

curl -X POST "http://localhost:3000/api/v1/skill/execute/llama_v2_code_instruct_7b" \
-H "Content-Type: application/json" \
-d '{
    "messages": [ { "role": "user", "content": "How do I open a firewall port on Linux?" } ],
    "debug": true,
    "temperature": 1,
    "top_p": 0.9,
    "top_k": 0.9,
    "max_new_tokens": 758
}'

curl -X POST "http://localhost:3000/api/v1/skill/execute/dream_shaper_image_gen" \
-H "Content-Type: application/json" \
-d '{
  "guidance_scale": 7.5,
  "height": 512,
  "negative_prompt": "ugly, tiling, poorly drawn hands, poorly drawn feet, poorly drawn face, out of frame, extra limbs, disfigured, deformed, body out of frame, bad anatomy, watermark, signature, cut off, low contrast, underexposed, overexposed, bad art, beginner, amateur, distorted face",
  "steps": 40,
  "width": 512,
  "prompt": "A man walking down the beach"
}'
Clone this wiki locally