Skip to main content

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.

info

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

  1. Go to xAI API.

  2. Sign in or create an account.

  3. Obtain your API key.

  4. 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

  1. Go to Groq console.

  2. Sign in or create an account.

  3. Obtain your API key.

  4. Open the .env file and set the following:

    XAI_API_KEY=your_api_key_here
  5. Update the baseURL in /agent/services/openai.ts to:

    baseURL: "https://api.groq.com/openai/v1",
  6. Update the model in the following locations:

    • agent/config.yml: Replace the model field with your chosen model, e.g., llama-3.1-8b-instant.
    • agent/tools/memory.ts: Replace the model 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

  1. Obtain an API key from the chosen provider.

  2. Open the .env file and set the following:

    XAI_API_KEY=your_api_key_here
  3. Update the baseURL in /agent/services/openai.ts to match the provider's endpoint.

  4. Update the necessary configuration files, such as agent/config.yml, and modify any hardcoded values, like the model variable in agent/tools/memory.ts, to match the specific model or API requirements.