DEV Community

Sarfaraz
Sarfaraz

Posted on

I Was Tired of Pasting curl Commands into ChatGPT Just to Convert Them — So I Built a Free Converte

If you work with APIs, this is a familiar loop: you copy a curl command from Postman, an API doc, or your browser's dev tools network tab — and now you need it as actual code in your project. Python requests? JavaScript fetch? PHP? You either hand-translate it (slow, error-prone with headers and escaped quotes) or paste it into an AI chatbot and wait.

I got tired of that loop, so I added a curl to code converter to SamToolkit — a free, browser-based dev tools site. Here's why I built it, how it works, and how it's different from most converters out there.

The problem with copy-pasted curl commands

A typical curl command copied from Chrome's "Copy as cURL" looks like this:

curl -X POST https://api.example.com/users \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer abc123" \
  -d '{"name":"John","email":"john@example.com"}'
Enter fullscreen mode Exit fullscreen mode

Turning that into working Python or JS by hand means manually mapping -X to a method, -H to a headers dict, unescaping the -d payload, and remembering the right syntax for whichever library you're using. It's not hard, it's just tedious — and easy to get subtly wrong (trailing commas, wrong quote escaping, forgetting json= vs data= in requests).

Why I didn't just tell people to use ChatGPT

Most people's default is pasting it into an AI assistant. That works, but:

  • It's overkill for a mechanical, deterministic transformation — there's no reasoning involved, just parsing flags.
  • Your API keys and auth tokens go over the network to a third-party model provider, which is a real concern if the curl command has live credentials in it (and it usually does).
  • It's slower than a purpose-built tool for something you might do a dozen times in a day.

What the SamToolkit curl converter does differently

Like every tool on SamToolkit, the curl converter runs entirely client-side — nothing you paste in ever leaves your browser. No server call, no logging, no risk of your Authorization header ending up in someone's request logs. That matters more than it sounds like it should once you realize how often people paste live tokens into random web tools.

It supports converting curl commands into:

  • Python (requests)
  • JavaScript (fetch)
  • Node.js (axios)
  • PHP (cURL/Guzzle style)

It handles the common flags you actually use: -X/--request, -H/--header, -d/--data/--data-raw, -u/--user, and -F for form data — so headers, JSON bodies, auth, and multipart uploads all convert correctly instead of just the happy-path GET request.

Try it

Paste any curl command — from Postman, browser dev tools, or an API doc — and get working code in the language you need:

👉 https://samtoolkit.com

FAQ

Does this send my API keys anywhere?
No. The conversion happens entirely in your browser using JavaScript — nothing is transmitted to a server. You can disconnect your internet after the page loads and it'll still work.

Which languages are supported?
Currently Python (requests), JavaScript (fetch), Node.js (axios), and PHP. More are planned based on demand.

Can it handle curl commands with file uploads or basic auth?
Yes — -F for multipart form data and -u for basic auth are both supported.

Is it free?
Yes, no signup, no limits.


I'm building SamToolkit, a growing set of free, privacy-first developer tools that run entirely in your browser. If you've got a tool you wish existed, I'd love to hear about it in the comments.

Top comments (0)