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

# Quickstart

> Get started with Gentrace in 5 minutes

## Prerequisites

* Node.js 20+ (for TypeScript) or Python 3.8+ (for Python)
* An OpenAI API key (or another supported LLM provider)
* A Gentrace account ([sign up free](https://gentrace.ai/signup))

## Getting Started

<Steps>
  <Step title="Get your API key">
    Generate a Gentrace API key:

    1. Log in to [Gentrace](https://gentrace.ai)
    2. Navigate to [API Keys](https://gentrace.ai/s/api-keys)
    3. Click "Create key" and copy the key

    <Warning>
      Keep your API key secure and never commit it to version control. Use environment variables instead.
    </Warning>
  </Step>

  <Step title="Install the SDK">
    <Tabs>
      <Tab title="TypeScript">
        <CodeGroup>
          ```bash npm theme={null}
          npm install gentrace
          ```

          ```bash yarn theme={null}
          yarn add gentrace
          ```

          ```bash pnpm theme={null}
          pnpm add gentrace
          ```
        </CodeGroup>
      </Tab>

      <Tab title="Python">
        <CodeGroup>
          ```bash pip theme={null}
          pip install gentrace-py
          ```

          ```bash uv theme={null}
          uv pip install gentrace-py
          ```
        </CodeGroup>
      </Tab>
    </Tabs>
  </Step>

  <Step title="Initialize Gentrace">
    The Gentrace SDK now automatically configures OpenTelemetry for you. Simply call `init()` with your API key:

    <CodeGroup dropdown>
      ```typescript quickstart.ts theme={null}
      import { init } from 'gentrace';

      // Initialize Gentrace with automatic OpenTelemetry setup
      init({
        apiKey: process.env.GENTRACE_API_KEY,
      });
      ```

      ```python quickstart.py theme={null}
      import os
      import gentrace

      # Initialize Gentrace with automatic OpenTelemetry setup
      gentrace.init(
          api_key=os.getenv("GENTRACE_API_KEY"),
      )
      ```
    </CodeGroup>

    <Info>
      The `init()` function automatically:

      * Configures OpenTelemetry SDK with proper exporters ([read more](./initialization))
      * Sets up authentication with Gentrace
      * Registers shutdown handlers to ensure traces are flushed correctly
      * Configures sampling and span processing
    </Info>
  </Step>

  <Step title="Create your first traced interaction">
    Now let's create a simple interaction for Gentrace to trace:

    <Note>
      The `interaction()` function is required to see spans in your pipeline. Without wrapping your code in an `interaction()` with a `pipelineId`, traces won't appear in the Gentrace dashboard. This function associates your spans with a specific pipeline for viewing and analysis.
    </Note>

    <CodeGroup dropdown>
      ```typescript example.ts theme={null}
      import { init, interaction } from 'gentrace';

      init({
        apiKey: process.env.GENTRACE_API_KEY,
      });

      const boringInteraction = interaction(
        'boring-interaction',
        async () => {
          return 'TODO: replace me with a call to an LLM or agent';
        },
      );

      boringInteraction();
      ```

      ```python example.py theme={null}
      import os
      import gentrace
      from gentrace import interaction

      gentrace.init(
        api_key=os.getenv("GENTRACE_API_KEY"),
      )

      @interaction(
        name="boring-interaction",
      )
      def boring_interaction():
        return "TODO: replace me with a call to an LLM or agent"
      ```
    </CodeGroup>
  </Step>

  <Step title="View your trace">
    After running the code above:

    1. Go to [Gentrace](https://gentrace.ai/t)
    2. Navigate to the Pipelines section
    3. You'll see your trace with full details.

    <Warning>
      If you're not seeing traces in your Gentrace pipeline, visit [https://gentrace.ai/s/otel-metrics](https://gentrace.ai/s/otel-metrics) to monitor span ingestion. This shows distributions of accepted, rejected, and buffered spans to help identify configuration issues.
    </Warning>
  </Step>
</Steps>

## What's next?

Now, it's time to replace your boring interaction with a real agent or LLM call.

Go to the [instrumentations page](/tracing/instrumentations) to pick your LLM library or agent framework.
