Skip to content

Environment Variables

To call your LLM from a third-party service, you’ll likely need some environment variables to keep your API keys safe.

Setting Up Env Variables

  1. Create a .env file in the root of your project:

    .env
    OPENAI_API_KEY=your-api-key
  2. Add .env to your .gitignore, if it’s not already there

    .gitignore
    .env
  3. Install dotenv:

    Terminal window
    pnpm add -D dotenv
  4. Add an evalite.config.ts file:

    evalite.config.ts
    import { defineConfig } from "evalite/config";
    export default defineConfig({
    setupFiles: ["dotenv/config"],
    });

Now, your environment variables will be available in your evals.