Exploring LiveCode Integration with AI APIs in 2025

Deploying to Linux? Get penguinated here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
benedictwinifred
Posts: 1
Joined: Mon Nov 10, 2025 8:05 am
Contact:

Exploring LiveCode Integration with AI APIs in 2025

Post by benedictwinifred » Mon Nov 10, 2025 8:06 am

Has anyone here tried integrating LiveCode with modern AI APIs like OpenAI or Hugging Face?
I’m experimenting with creating a desktop app that uses LiveCode as the frontend and connects to an AI backend for text generation. I’m curious about best practices for handling authentication, request limits, and response parsing in LiveCode scripts.
Any insights or sample projects would be appreciated!

ClipArtGuy
Posts: 260
Joined: Wed Aug 19, 2015 4:29 pm

Re: Exploring LiveCode Integration with AI APIs in 2025

Post by ClipArtGuy » Thu Nov 13, 2025 9:36 pm

benedictwinifred wrote:
Mon Nov 10, 2025 8:06 am
Has anyone here tried integrating LiveCode with modern AI APIs like OpenAI or Hugging Face?
I actually am just finishing up a sample stack that integrates Anthropic's Claude API and demonstrates basic text generation, conversational chat, vision (image analysis), document analysis (PDF), structured output (JSON), simulated streaming output, and advanced system prompts. You will need a claude API key. The pictured responses were using Sonnet 4.5, which is expensive. I highly recommend testing with a cheaper model like one of the haiku models.

BASIC.png
vision.png
conversational.png
Here is the complete script generated in the first screenshot, which works as-is:

Code: Select all

on mouseUp
   -- Ask user to select an image file
   answer file "Please select an image file:" with type "Image files|jpg,jpeg,png,gif,bmp|All files|*"
   
   -- Check if user cancelled
   if it is empty then
      exit mouseUp
   end if
   
   put it into tImagePath
   
   -- Create a new image object
   create image "ImportedImage"
   put it into tImageID
   
   -- Import the image file
   set the filename of image tImageID to tImagePath
   
   -- Get the card dimensions
   put the width of this card into tCardWidth
   put the height of this card into tCardHeight
   
   -- Get the original image dimensions
   put the width of image tImageID into tImageWidth
   put the height of image tImageID into tImageHeight
   
   -- Check if resizing is needed
   if tImageWidth > tCardWidth OR tImageHeight > tCardHeight then
      
      -- Calculate scaling factor to fit within card (with some padding)
      put tCardWidth - 40 into tMaxWidth -- 20 pixel padding on each side
      put tCardHeight - 40 into tMaxHeight
      
      put tMaxWidth / tImageWidth into tScaleX
      put tMaxHeight / tImageHeight into tScaleY
      
      -- Use the smaller scale to ensure image fits both dimensions
      put min(tScaleX, tScaleY) into tScale
      
      -- Calculate new dimensions
      put round(tImageWidth * tScale) into tNewWidth
      put round(tImageHeight * tScale) into tNewHeight
      
      -- Resize the image
      set the width of image tImageID to tNewWidth
      set the height of image tImageID to tNewHeight
      
   end if
   
   -- Center the image on the card
   set the loc of image tImageID to the loc of this card
   
end mouseUp


I will upload here soon.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10411
Joined: Wed May 06, 2009 2:28 pm

Re: Exploring LiveCode Integration with AI APIs in 2025

Post by dunbarx » Thu Nov 13, 2025 10:16 pm

Anyone think the OP is a warm-blooded being?

Craig

ClipArtGuy
Posts: 260
Joined: Wed Aug 19, 2015 4:29 pm

Re: Exploring LiveCode Integration with AI APIs in 2025

Post by ClipArtGuy » Thu Nov 13, 2025 10:31 pm

dunbarx wrote:
Thu Nov 13, 2025 10:16 pm
Anyone think the OP is a warm-blooded being?

Craig
Is it that bad over here? I didn't see any reason to not believe this was a real person? This seems like a real question that anybody might ask....

EDIT: I mean, the text could very well be AI generated, but by a person who actually would like an answer. Seems like a specific and relevant question.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10411
Joined: Wed May 06, 2009 2:28 pm

Re: Exploring LiveCode Integration with AI APIs in 2025

Post by dunbarx » Thu Nov 13, 2025 10:46 pm

We can only wait and see. Your reply was terrific. We will find out what or who it impressed.

Craig
Last edited by dunbarx on Fri Nov 14, 2025 3:28 pm, edited 1 time in total.

SparkOut
Posts: 2969
Joined: Sun Sep 23, 2007 4:58 pm

Re: Exploring LiveCode Integration with AI APIs in 2025

Post by SparkOut » Thu Nov 13, 2025 11:29 pm

I think one of the (many) problems with AI is that it lacks the capacity to be impressed. The bystanders and spectators can be impressed though.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10411
Joined: Wed May 06, 2009 2:28 pm

Re: Exploring LiveCode Integration with AI APIs in 2025

Post by dunbarx » Fri Nov 14, 2025 3:28 pm

The OP is biding his time...

Craig

ClipArtGuy
Posts: 260
Joined: Wed Aug 19, 2015 4:29 pm

Re: Exploring LiveCode Integration with AI APIs in 2025

Post by ClipArtGuy » Fri Nov 14, 2025 6:48 pm

Regardless of OP's suspected inhumanity, here's the stack. You will need an Anthropic API key, which can be activated with as little as $5. I highly suggest using "Haiku" models while testing. Sonnet 4.5 is extremely capable, but will eat through credits, especially when analyzing large images or documents.

ClaudeSampler.zip
(15.72 KiB) Downloaded 64 times

Post Reply