In this tutorial, we’ll walk you through the process of making a Straico API call using image URLs in ZeroWork. This process involves setting up your workspace, creating a table, configuring variables, building a task bot flow, and running your task bot. Let’s dive right in!
Table of Contents
ToggleStep 1: Setting Up Your Workspace
Adding a Table
First things first, we need to create a table to store image URLs and the descriptions generated by the Straico model. The table should have two columns: one for the image URL and another for the description.
Configuring Variables
Next, we’ll set up the variables needed for the API call:
- Content Path: The path to the content from the Straico API response (always the same; you can change the model name).
- Status Catch: A variable to capture the API status response.
- API Key: The actual API key from Straico.
The content path is:
data['completions']['MODEL NAME']['completion']['choices'][0]['message']['content']
Step 2: Building the Task Bot Flow
Start Repeat Block
Begin by adding a “Start Repeat” block to iterate over all the rows in your table. Since we’re using a native ZeroWork table, select “Dynamic” as the loop type and choose the table you created earlier.
Send HTTP Request
Now, we’ll configure the “Send HTTP Request” block, where the actual API call will happen. Here’s what you need to do:
- Change Method to Post: We’re sending information to the API.
- Paste the Endpoint: Ensure it’s the prompt completion endpoint from the API docs.
- Set Headers: Add authorization with the API key variable.
- Configure Request Body: Include the model, message, and image URL that the task bot will iterate over.
Save Response
In the “Save Response” tab, allocate the response body to the appropriate variable. Ensure the model name matches. Also, save the response code to troubleshoot if something goes wrong.
Update Data Block
Finally, add an “Update Data” block to send the Straico model response to your table. This way, you’ll have both the image link and the description in the same place.
Step 3: Adding Image URLs
Open the table view and paste the image URLs you want to use. For this example, we’ll use some images generated with Flux directly in Straico, but you can source your images from anywhere you like.
Step 4: Running the Task Bot
Make sure your ZeroWork agent is running. Execute the task bot and wait for the API call to complete and for all the data to save. Once done, check the table to see the image descriptions for each image.
Conclusion
And that’s it! You’ve successfully made a Straico API call with image URLs using ZeroWork. If you have any questions or need further assistance, feel free to leave a message or join our Discord server to learn more.
We hope you found this tutorial helpful. Stay tuned for more tips and tricks on how to get the most out of Straico and ZeroWork!