With Client SDKs you can call custom or public AI model with just one line of code!

Prerequisite

  • Select a model from Model Yard
  • Create an API Key

You can use three ways to call a model on Each

Client SDK

With Client SDK you need to initialize our SDK in your langauage and then you may able to use custom methods and calls to Each backend servers.

Initialize SDK

// Please make sure that you run 'npm install @eachlabs/aiflow@latest'
import Each from '@eachlabs/aiflow';

const each = new Each({
    auth: process.env.EACH_API_KEY || 'YOUR_API_KEY'
});

Run Inference

// Please make sure that you run 'npm install @eachlabs/aiflow'
import Each from '@eachlabs/aiflow';
const each = new Each({
    auth: process.env.EACH_API_KEY || 'YOUR_API_KEY'
});
const out = await each.predictions.run({
  model: "meta-llama-3-8b-instruct",
  version: "0.0.1",
  input: {
    "top_p": 0.9,
    "prompt": "Write a paragraph about Turkish tea",
    "max_tokens": 512,
    "min_tokens": 0,
    "temperature": 0.6,
    "prompt_template": "<|begin_of_text|><|start_header_id|>system<|end_header_id|>\n\nYou are a helpful assistant<|eot_id|><|start_header_id|>user<|end_header_id|>\n\n{prompt}<|eot_id|><|start_header_id|>assistant<|end_header_id|>\n\n",
    "presence_penalty": 0,
    "frequency_penalty": 0
  },
});
console.log(out)

Fine-tune models with your own data

You can improve open-source models with your own data to create new models that are better suited to specific tasks.

Image models like SDXL can generate images of a particular person, object, or style.

// Please make sure that you run 'npm install @eachlabs/aiflow'
import Each from '@eachlabs/aiflow';

const each = new Each({
    auth: process.env.EACH_API_KEY || 'YOUR_API_KEY'
});

const training = each.training.create("sdxl-training:13853038482995843", {
    input: {
        "input_images": "https://example.url/pictures.zip
    },
    destination: "eftal/sdxl-finetuned-with-pictures"
})

console.log(training)

// When Traning completed you can call your custom inference api 
const output = each.predictions.run("eftal/sdxl-finetuned-with-pictures", {
    input: {
        width: 512,
        height: 512,
        prompt: "a spaceship into the ocean, dramatic lights, hd",
        scheduler: "K_EULER",
        num_outputs: 1,
        guidance_scale: 7.5,
        num_inference_steps: 50
    },
})

console.log(output)

That’s it!

Console

The easiest way! You can call public or custom model via console. Select your model and you can use ▶ Demo tab on the page.