AIME API JavaScript Client Interface

A Javascript interface to connect your client with an AIME API server

Setup

The JavaScript client interface is contained in a single file: model_api.js

To use the AIME API with Node.js, you’ll need:

  • Node.js (v14 or later recommended)

To use the AIME API include the model_api.js in your JS file:

const { doAPIRequest } = require('../model_api');

For browser usage, include the model_api.js file in your HTML:

<script src="path/to/model_api.js"></script>
<script>
// Your code using the ModelAPI class
</script>

Note

When using in a browser, you’ll need to handle CORS (Cross-Origin Resource Sharing) appropriately on your server.

Examples can be found in the examples directory. To run an example:

node examples/synchronous_example.js

Note

Make sure to update the API credentials in each example file before running them.

Examples

Simple single call example:

<script src="/js/model_api.js"></script>
<script>
function onResultCallback(data) {
    console.log(data.text) // print generated text to console
}

params = new Object({
    text : 'Your text prompt'
});

doAPIRequest('llama3_chat', params, onResultCallback, 'api_email', 'api_key');
</script>

Note

This project is under active development.