Thursday, 14 May 2026

Uploading files using the @ character in curl

The Terminal’s Secret "Upload" Button: Mastering the @ Symbol in curl

If you’ve ever tried to interact with an AI inference server -like a Whisper model for audio transcriptionn in the previous post- from your command line, you’ve likely encountered a curl command that looks like this:


curl http://100.92.17.43:8090/inference \
   -H "Content-Type: multipart/form-data" \
   -F file="@whisper_input.wav" \
   -F beam_size="5" \
   -F best_of="5" \
-F language="auto" \ -F response_format="srt"

To the untrained eye, that small @ symbol before the filename looks like a typo or a minor syntax quirk. In reality, it is the "magic" character that makes the entire request work. Without it, your transcription will fail every single time.

What does the @ actually do?

When you use the -F (form) flag in curl, you are simulating a digital web form—the same kind you see on websites with "Choose File" and "Submit" buttons. In this environment, curl needs to know if the data you are providing is a literal string or a pointer to a local file.

  • The String (Without @): If you wrote file="audio.wav", curl would literally send the text "audio.wav" to the server. The server would receive 9 bytes of text, realize it isn't an actual audio file, and return a confusing error.

  • The File (With @): By adding the @, you are giving curl a specific instruction: "Don't send this text. Instead, go to my hard drive, open the file named 'audio.wav', and stream its binary contents to the server."

Sending More Than Just Audio

When you send a request to a Whisper server, the @ symbol handles the heavy lifting of the audio data, but the other -F flags provide the instructions for the engine:

  • language="auto": Tells the model to detect the spoken language before it starts transcribing.

  • beam_size="5": Instructs the model to explore multiple "paths" of transcription simultaneously to find the most accurate result.

  • response_format="srt": Instead of returning a raw block of text, the server uses its internal timestamps to format the output as a SubRip file, ready to be used as video subtitles.

Why It Matters

AI models are incredibly powerful, but they are also rigid about input formats. Because a model like Whisper processes raw audio data, it cannot "guess" your intent if you send it a filename string instead of the file itself.

The @ symbol is your bridge. It takes the audio file sitting on your machine and transforms it into the digital stream that the server is waiting to process.

Next time you are debugging a failed API call from the terminal, check your syntax. That single character is the "Upload" button of the command-line world. Without it, your data stays on your drive, and the server stays silent.

No comments:

Post a Comment