# What if we just used chatGPT as an API to the internet?

##   
<mark>I give you generative APIs</mark>

I love drinking the kool-aid of this new AI age but in the hype cycle we are currently in there is a lot of noise and tools like chatGPT are being overlooked for more simple yet powerful tasks such as acting as an API to the internet.

In this video, I walk through how I iterate on a series of prompts to create an API that itself was written with chatGPT and returns chatGPT generated data in a format (JSON) that can be understood by other systems or to go in a crazy inception loop may be read by chatGPT. It’s all very inception!

You can read through the slides or watch the video below.

Video: [https://youtu.be/UdwP1OZxNU0](https://youtu.be/UdwP1OZxNU0)

[![](https://cdn.hashnode.com/res/hashnode/image/upload/v1680923603716/19f5dfc6-864f-4950-9d0c-906123103445.png align="center")](https://youtu.be/UdwP1OZxNU0)

### <mark>Slides</mark>

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1680923646534/294cdb4a-a25c-4b59-84c5-7faa51cc3f8e.jpeg align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1680923652104/5050edb2-9060-4986-bb58-e0cc28ac5df9.jpeg align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1680923655723/b11ca271-bf5b-40ba-b199-cc032b1a1b82.jpeg align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1680923664557/b6935837-ec9c-4ffa-80cb-0198b325764a.jpeg align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1680923670144/1fd28f25-0fd8-4d39-bf83-2d13e86ce878.jpeg align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1680923675044/e27d88e6-e4b9-4c4b-9e2b-967d74492847.jpeg align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1680923680040/b2937c9b-aff9-480b-89d4-7efc16538e52.jpeg align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1680923685985/8da4fcb0-a232-4f88-a666-a689ec11caa7.jpeg align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1680923693810/f0cc98eb-2cda-46a6-954a-a67049634973.jpeg align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1680923699451/5aaaba75-ad20-431d-ae98-48c034780a67.jpeg align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1680923703846/00434110-ffa1-4254-badb-fb25c3684647.jpeg align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1680923722393/43619adb-0d5c-4b92-b31e-c4db9c03f2f3.jpeg align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1680923726312/0cca05e1-152a-48eb-9957-84da882b6d6b.jpeg align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1680923730310/780583b5-648c-4448-978e-104a6c8725bf.jpeg align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1680923735224/3d7160f2-0c04-4ce6-ad7b-5f333646b70b.jpeg align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1680923739950/19dce84d-5aad-4dbe-8ac4-0d3c89b02cf0.jpeg align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1680923745291/e6ae0d7b-c596-47fb-87f4-aea8622cde96.jpeg align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1680923891457/45be24e1-8483-4c41-b2a7-6c32b314d5ac.jpeg align="center")

![https://promptapidemo.kidventuresai.com/api/promptapi](https://cdn.hashnode.com/res/hashnode/image/upload/v1680923901730/40717471-e112-4c56-ba9a-6c8965f90433.jpeg align="center")

[https://promptapidemo.kidventuresai.com/api/promptapi](https://promptapidemo.kidventuresai.com/api/promptapi)

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1680923908292/c1debebf-c814-4680-aea0-b44860656784.jpeg align="center")

### <mark>The final prompt:</mark>

Create a JSON object containing a list of the 10 most populated cities in the world, sorted alphabetically by city name. For each city, include the following properties:

* id: an incremental number from 1 to 10
    
* city\_names: a list of dictionaries, where each dictionary has the keys language and name, and contains the name of the city in English, French, and German
    
* country\_name: the name of the country the city is located in
    
* city\_population: the population of the city
    
* description: a one-line sentence describing the city
    
* createdOn: a random date and time in March 2023
    
* imageUrl: a URL pointing to an image of the corresponding country
    
* hash: a MD5 hash of the country\_name
    

The JSON object should have a top-level property called createdOn, which is a string representing the date and time when the JSON object was created.

### <mark>The api to see the magic:</mark>

[https://promptapidemo.kidventuresai.com/api/promptapi](https://promptapidemo.kidventuresai.com/api/promptapi)

#   
<mark>Contact</mark>

I would love to hear any feedback/comments on this concept of creating generative AI APIs.  
  
Or if you need any support with your AI strategy please get in touch at **www.leemallon.com.**
