Developer Center

Resources to get you started with Algorithmia

Javascript

Updated

We offer a vanilla JavaScript client for calling algorithms in the marketplace.

Download

You can download our JavaScript client from:

https://algorithmia.com/v1/clients/js/algorithmia-0.2.0.js

You can include the JavaScript file as a script tag:

<script src="//algorithmia.com/v1/clients/js/algorithmia-0.2.0.js" type="text/javascript"></script>

Call an Algorithm

Next, login to Algorithmia to get your API key:

Now import the Algorithmia library and create the Algorithmia client:

var client = Algorithmia.client("YOUR_API_KEY");

After setting your API key, you can then use the client variable from the above line to call algorithms.

The format for calling an algorithm is client.algo() with the algorithm name passed in. To pass input to the algorithm, use the .pipe method.

client.algo("demo/Hello").pipe(input)

Here is an example of how to authenticate and call an algorithm in JavaScript:

var input = 41;
var client = Algorithmia.client("YOUR_API_KEY");
client.algo("docs/JavaAddOne").pipe(input).then(function(output) {
  if(output.error) return console.error("error: " + output.error);
  console.log(output.result);
});

Limits

Your account can make up to 80 Algorithmia requests at the same time (this limit can be raised if needed).