Skip to content

API Examples

Introduction

This document details the steps required to interact with CalypsoAI's API, and provides simple use case examples of interacting with the API.

To fully utilize the examples and maximize their potential, please download the Python SDK. This will equip you with all the essential tools and resources needed to proceed effectively.

Send prompt to default Provider

py
from calypsoai import CalypsoAI

# Define the URL and token for CalypsoAI
CALYPSOAI_URL = "https://www.us1.calypsoai.app"
CALYPSOAI_TOKEN = "ADD-YOUR-TOKEN-HERE"

# Initialize the CalypsoAI client
cai = CalypsoAI(url=CALYPSOAI_URL, token=CALYPSOAI_TOKEN)

# Send a prompt request
prompt = cai.prompts.send("What is your name?")
print(prompt.model_dump_json(indent=2))
shell
curl "/backend/v1/prompts" -X POST \
  -H "Authorization: Bearer ${CALYPSOAI_TOKEN}" \
  -H 'Content-Type: application/json' \
  --data-raw '{"input": "What is your name?"}'

Updated at: