> ## Documentation Index
> Fetch the complete documentation index at: https://docs.baserun.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Authentication

### Use cases

You only need a Baserun API key if you are using the SDK. You don't need it if your primary activities are using the prompt playground, monitoring your application, or evaluating outputs.

<Steps>
  <Step title="Install Baserun">
    <CodeGroup>
      ```bash python theme={null}
      pip install baserun
      ```

      ```bash typescript theme={null}
      npm install baserun
      # or
      yarn add baserun
      ```
    </CodeGroup>
  </Step>

  <Step title="Get an API key">
    Create an account at [https://app.baserun.ai/sign-up](https://app.baserun.ai/sign-up).
    Navigate to the [Settings](https://app.baserun.ai/settings) tab.
    In this tab, you will find a section for creating a Baserun API key. Click the 'New Token' button, name your token, and then copy the key.

    <Frame>
      <img src="https://mintcdn.com/baserun/sfThaUjl8v9XCswy/images/generate-api-key.gif?s=b42501b22af1c32e7b639ebd642bb1ea" alt="Generate API key" width="1228" height="720" data-path="images/generate-api-key.gif" />
    </Frame>
  </Step>

  <Step title="Set the Baserun API key as an environment variable">
    ```bash theme={null}
    export BASERUN_API_KEY="your_api_key_here"
    ```

    Alternatively set the Baserun API key when initializing the SDK

    <CodeGroup>
      ```python python theme={null}
      import baserun

      baserun.api_key = "br-..."

      baserun.init()
      ```

      ```typescript typescript theme={null}
      import { baserun } from "baserun";

      // init needs to be awaited. If top-level await is not available, wrap it in an async function,
      // but make sure it is called before instantiating OpenAI, Anthropic or Replicate
      await baserun.init({
        apiKey: "br-...",
      });
      ```
    </CodeGroup>
  </Step>
</Steps>
