Using eliza with the kluster.ai API#
eliza is an open-source framework designed to create and manage AI agents that can handle a variety of tasks, from simple chat interactions to more complex automation.
In this guide, you'll learn how to integrate kluster.ai into eliza so you can leverage its powerful models and quickly set up your AI-driven workflows.
Prerequisites#
Before starting, ensure you have the following kluster prerequisites:
- A kluster.ai account - sign up on the kluster.ai platform if you don't have one
- A kluster.ai API key - after signing in, go to the API Keys section and create a new key. For detailed instructions, check out the Get an API key guide
Next, you can clone and install the eliza repository by following the installation instructions on the eliza Quick Start guide. Pay careful attention to the eliza prerequisites, including the minimum supported versions of Node.js and pnpm. You can pause at the Configure Environment section in the Quick Start guide, as those steps will be addressed in this guide.
Configure your environment#
After you have eliza installed, it's simple to utilize kluster.ai with eliza. Only three main changes to the .env
file are required. You can run the following command to generate a .env
file from the provided example.
cp .env.example .env
Then, set the following variables in the .env
file:
- OPENAI_API_KEY - replace
INSERT_API_KEY
in the code below with your own kluster.ai API key. If you don't have one yet, refer to the Get an API key guide - OPENAI_API_URL - use
https://api.kluster.ai/v1
to send requests to the kluster.ai endpoint - OPENAI_DEFAULT_MODEL - choose one of kluster.ai's available models based on your use case. Ensure that the model's full name starting with
klusterai/
is listed. For more details, see kluster.ai's models. It's also recommended that you setSMALL_OPENAI_MODEL
,MEDIUM_OPENAI_MODEL
,LARGE_OPENAI_MODEL
to the same value. This will allow you seamless experimentation with the different characters because different characters default to using different models
The OpenAI configuration section of your .env
file should resemble the following:
# OpenAI Configuration
OPENAI_API_KEY=INSERT_KLUSTER_API_KEY
OPENAI_API_URL=https://api.kluster.ai/v1
# Community Plugin for OpenAI Configuration
OPENAI_DEFAULT_MODEL=klusterai/Meta-Llama-3.3-70B-Instruct-Turbo
SMALL_OPENAI_MODEL=klusterai/Meta-Llama-3.3-70B-Instruct-Turbo
MEDIUM_OPENAI_MODEL=klusterai/Meta-Llama-3.3-70B-Instruct-Turbo
LARGE_OPENAI_MODEL=klusterai/Meta-Llama-3.3-70B-Instruct-Turbo
Run and interact with your first agent#
Now that you've configured your environment properly you're ready to run your first agent! eliza comes with a number of characters that you can interact with by prompting or that can autonomously perform tasks like tweeting. This guide relies on the Dobby
character for its minimal setup requirements. Other agents, particularly those that handle tweets, would necessitate additional steps, such as X login and similar information.
By default, Dobby
uses the openai
model, which has been properly configured to rely on the kluster.ai API, but it doesn't hurt to double-check the dobby.character.json
file under the characters
folder. You should see the configuration start with the following:
{
"name": "Dobby",
"clients": [],
"modelProvider": "openai" // json truncated for clarity
}
To run the Dobby
agent, run the following command from the project root directory:
pnpm start --character="characters/dobby.character.json"
In another terminal window, run the following command to launch the web UI:
pnpm start:client
You'll be prompted to open your browser to http://localhost:5173/.
You can now interact with Dobby by clicking on the Chat button and starting the conversation:
That's it! You've successfully integrated eliza with the kluster.ai API. You're now ready to harness the power of AI agents with the kluster.ai API!