Centre for Language and Speech Technology

CLAM

CLAM

CLAM turns command-line applications into RESTful webservice with a web-interface, so both automated clients and humans can interact with your tool over the web.

Introduction

CLAM expects a description of your tool in the form of desired endpoints, commands to call, input parameters to pass on, and expected input & output formats. All this is provided in a configuration file.

CLAM is set up in a generic fashion and requires minimal effort on the part of the service developer. Your actual application is treated as a black box, of which only the parameters, input formats and output formats need to be described. Your application itself needs not be network aware in any way, nor aware of CLAM, and the handling and validation of input can be partially taken care of by CLAM.

Users call your tool over the web, via CLAM, by filling the necessary parameters and (if needed) uploading input files. They then start the system and are presented the output, which may consist of multiple files.

CLAM is suitable both for simple runs with a quick turn-around (we call them actions), as well as batch processing which may take a long time to process in the background (we call those projects). Actions provide a response immediately, projects need to be polled at a regular interval for their completion status. Unlike actions, projects allow multiple input and output files. Users can come back to their projects to inspect the output at any time until they explicitly deleted the project.

Features

CLAM v4 is written in Rust, but it is completely agnostic to your underlying tool which can be written in any language. It aspires to be a fairly minimal yet flexible tool you can use to wrap around your own tools and scripts to be able to serve them over the web. CLAM is written with full human attention without AI/LLMS, no parts have been vibe-coded or written by agents. The contributor guidelines ensure it stays this way.

Installation

For the time being (pending release and packaging), install CLAM by cloning this git repository and running:

$ make
$ sudo make install

You just need cargo (the rust packager) and rustc (the Rust compiler) for this. On a Debian/Ubuntu Linux system, they can be installed with: apt install cargo rustc.

If you want it in a custom location and possibly without superuser permissions, you can do something like this instead:

$ PREFIX=~/.local make install

Usage

After installation, CLAM is available as clam.

Documentation is available in manual pages (and online):

History

CLAM was created in 2010 and has been in use and development ever since. The current incarnation, version 4, however, is a complete rewrite that is no longer backward compatible with versions 3 and below, which were written in Python and user their own API and XML formats. Both the implementation as well as the configuration syntax have changed completely. So if you want to upgrade your webservice from CLAM 3 to CLAM 4, you will need to rewrite it. After 16 years, some of the fundamental principles in the old implementation needed to be revised and modernised for CLAM to make it into the future.