DEV Community

Cover image for HTTPie AI assistant
Jakub Roztocil for HTTPie

Posted on • Originally published at httpie.io

HTTPie AI assistant

Today we’re launching HTTPie AI, a new way to interact with APIs ✨

HTTPie AI in action

HTTPie AI assistant, built into HTTPie for Web & Desktop, uses state-of-the-art artificial intelligence to increase your productivity when testing and talking to APIs.

Free product preview

This initial release allows you to create requests using human language. While in preview, you can use HTTPie AI for free with an HTTPie account. Gradually, AI capabilities will expand throughout the platform.

The problem

Let’s say you want to fetch the details of the httpie/desktop repo from the GitHub API. This requires translating the intent to the corresponding HTTP request and entering it into the client’s UI. You need to have some degree of understanding of the following:

  • How the API or server works (e.g., hostname, endpoints, auth)
  • How HTTP works (e.g., headers, methods, body)
  • How to instruct the client to send the exact request

What if instead of creating requests manually, we could tell HTTPie to “fetch repo details of httpie/desktop”? Or even in another language like Spanish, «obtén los detalles del repositorio httpie/desktop»?

Well, now you can!

Craft requests using human language

You can type your prompt directly in HTTPie’s URL field. It’s similar to typing a search query in your browser’s address bar instead of the exact URL.

Alternatively, you can open the HTTPie AI dialog from the “+” menu in the library. In the desktop app, you can also use ⌘I. There’s a difference in that when you start in the URL field, accepting the generated request will update the one in the current tab instead of creating a new one.

Then hit “Generate” to get a suggestion.

If you like the request, save it. The saved request automatically gets a short name generated by the AI. If you don’t like it, you can hit “Generate” again, which often produces a different result. You can also try editing the prompt. If the request includes any placeholders or obvious errors, you can modify it straight from the dialog before saving it (or you can do that after).

There are two strategies for writing HTTPie prompts: describing the request and describing the intent.

Describing the request

You can ask the AI to generate an HTTP request by describing its low-level components like the URL, headers, and body:

Generate an array of 3 blog posts with title, author, and summary and post it to localhost 3000 api as user agent HTTPie AI
Enter fullscreen mode Exit fullscreen mode

Describing the intent

For actions involving public APIs of popular services, you can describe the high-level tasks you want to accomplish:

List GitHub users
Enter fullscreen mode Exit fullscreen mode

Here is another example, where the model picks up that we mean a GitHub repo:

Fetch last release details of httpie/desktop
Enter fullscreen mode Exit fullscreen mode

Feedback and accuracy

Like many generative AI applications, the accuracy of the outcome may vary depending on the prompt and other factors. Review the generated request and iterate on the prompt as needed. Higher specificity often leads to better results. You can quickly correct errors directly in the dialog before saving the request. As you use HTTPie AI, please provide quick feedback on the suggestions via the thumb-down and thumb-up buttons to help us fine-tune accuracy.

Entering the era of AI copilots

As large language models (LLMs) gain robust generative capabilities, creative tools are evolving toward AI-powered experiences.

HTTPie is now becoming the first API development platform with AI assistance, and we’d love your feedback!

AI copilots: GitHub Copilot, Replit Ghostwriter, Canva Magic Write, Notion AI, HTTPie AI

How we built it

We built this initial feature preview using OpenAI’s GPT-3 models.

In the process, we refactored the openai/openai-python library to make the default installation size ~7⨉ smaller (167M → 23M). Now it’s much more manageable to deploy OpenAI-powered applications using this library in environments with code size constraints, such as AWS Lambda.

What’s next

We’ll continue improving the assistant’s accuracy and adding more capabilities throughout the HTTPie platform.

Jump into the Web app or download the Desktop app and check it out!

PS: We’re looking for a more personable name for our assistant 💡


Originally published at https://httpie.io/blog/ai

Top comments (0)