Your First Midio App
In this guide you will learn how to set up a basic web API in Midio using several nodes from the Http package. Create a new project, and let’s begin.
Create our API endpoint
Add a new endpoint by searching for
Http Endpointin the Node Palette.

Configure it to handle requests to
/poemwith a query param namedqueryusing the following path value:/poem?query. Leave the other parameters at their default values.Your
Endpointnode should look like this:
Responding to requests
Add an
Http Respond to HTTP Requestnode and hook it up to the endpoint node we added previously, in order to respond to requests. You can also add some dummy data to thebodyinput if you want.

Test our endpoint using
Http.FetchThe easiest way to test out our endpoint is to click “Go to app” button in the project header, and modify that url to target our new endpoint, which will be something like:
https://<your-project-name>.midio.dev:<port>/poem?query=testing

Add LLM Chat Complete
Add the open-ai package using the package manager.

open the package manager 
search for open-ai and install it Add an instance of
OpenAI Chat Complete.Give it a system message like: “Write a short haiku style poem based on the users request.”

Provide an API key (if you received free OpenAI credits when you signed up for Midio, you can skip straight to step 5.c)
Add it to Midio as a secret

Open the secrets editor 
Add a new secret 
Give the secret a name Add an instance of
Get Environment Variable, select our key from the dropdown menu, and connect it to theapi keyinput in ourChat Completenode.
Connect the
Chat Completenode to our endpoint.

Congratulations! You've made your first AI-driven application in Midio. You can easily experiment with it directly from Midio using the Http Fetch node, like so (pick text for the response type you you're not returning an object):

Further reading
Check our our various guides for recipes and examples of how common tasks, like HTTP, working with data and looping is done in Midio.
The reference section is a good place to look for definitive information about every aspect of Midio.
The available nodes section contains a comprehensive overview of all nodes available out of the box in Midio.
Last updated
Was this helpful?