Skip to content

sup.ex

The sup.ex package provides convenience functions for interacting with external APIs.


Functions

sup.ex.fal()

(modelName: string, input: JSONObject, key: string) → JSONObject

// Run inference with a Fal AI model
const result = sup.ex.fal(
"fal-ai/fast-sdxl",
{
prompt: "pixel art of a frog in a rabbit costume",
num_inference_steps: 20,
},
sup.secret("FAL_API_KEY")
);

Calls the Fal AI API to run machine learning models.

sup.ex.elevenlabs()

(voiceId: string, text: string, key: string) → Audio

// Generate speech from text
const audio = sup.ex.elevenlabs(
"CJvvY4cO767O6IVtXUG1",
"sup sup",
sup.secret("ELEVENLABS_API_KEY")
);
// Display audio in chat
return audio;

Calls the ElevenLabs API to convert text to speech. Returns an Audio instance that can be played in chat.

sup.ex.openrouter()

(model: string, prompt: string) → string

// Generate text using OpenRouter models
const response = sup.ex.openrouter(
"anthropic/claude-3-haiku",
"Explain quantum computing in simple terms"
);

Calls the OpenRouter API for text generation using various AI models including GPT, Claude, and others.

sup.ex.huggingface()

(model: string, prompt: string, key: string) → string

// Generate text using Hugging Face models
const response = sup.ex.huggingface(
"microsoft/DialoGPT-medium",
"What is machine learning?",
sup.secret("HUGGINGFACE_API_KEY")
);

Calls the Hugging Face Inference API for text generation using thousands of available AI models.

sup.ex.glif()

(glifId: string, input: JSONObject, key: string) → JSONObject

// Run a Glif
const result = sup.ex.glif(
"clxa7m2f80004lkozza8ralld",
{ "image-input1": sup.input.image },
sup.secret("GLIF_API_KEY")
);

Calls the Glif API to access various AI and machine learning services.


Notes

  • Each method requires an API key for the respective service.
  • The request and response formats will depend on the APIs and models being used. Refer to each service’s documentation for details.