Configure your API key
To enable the chat agent, set up your API key. The project is pre-configured to use xAI
, but feel free to switch to Groq
or any OpenAI-compatible API.
If the .env
file does not exist, create it using the .env.sample
file and update it with your chosen API key.
Default option: xAI
-
Go to xAI API.
-
Sign in or create an account.
-
Obtain your API key.
-
Open the
.env
file and set the following:XAI_API_KEY=your_api_key_here
After configuration, proceed to Test your setup.
Alternative option: Groq
-
Go to Groq console.
-
Sign in or create an account.
-
Obtain your API key.
-
Open the
.env
file and set the following:XAI_API_KEY=your_api_key_here
-
Update the
baseURL
in/agent/services/openai.ts
to:baseURL: "https://api.groq.com/openai/v1",
-
Update the model in the following locations:
agent/config.yml
: Replace themodel
field with your chosen model, e.g.,llama-3.1-8b-instant
.agent/tools/memory.ts
: Replace themodel
variable with your chosen model.
Example in
agent/config.yml
:model: "llama-3.1-8b-instant"
Example in
agent/tools/memory.ts
:model: string = "llama-3.1-8b-instant";
Check the Groq documentation for a list of available models.
After updating, proceed to Test your setup.
Using other OpenAI-compatible APIs
-
Obtain an API key from the chosen provider.
-
Open the
.env
file and set the following:XAI_API_KEY=your_api_key_here
-
Update the
baseURL
in/agent/services/openai.ts
to match the provider's endpoint. -
Update the necessary configuration files, such as
agent/config.yml
, and modify any hardcoded values, like themodel
variable inagent/tools/memory.ts
, to match the specific model or API requirements.