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

# PostHog Integration

> Combine Helicone's LLM analytics with PostHog, a comprehensive product analytics platform. View LLM insights alongside other application data for holistic performance analysis.

<Warning>
  This integration method is maintained but no longer actively developed. For the best experience and latest features, use our new [AI Gateway](/gateway/overview) with unified API access to 100+ models.
</Warning>

## How to Integrate Helicone with PostHog

<Steps>
  <Step title="Sign up for PostHog">
    Create an account for PostHog [here](https://posthog.com/).
  </Step>

  <Step title="Add two new headers">
    Similar to how you set `Helicone-Auth` [header](https://docs.helicone.ai/getting-started/integration-method/openai-proxy#openai-v1), add two new headers `Helicone-Posthog-Key` and `Helicone-Posthog-Host` with your API key and PostHog host.
    <Tip>You can find both your API key and PostHog host in your [PostHog project settings](https://us.posthog.com/settings/project). </Tip>

    <Tabs>
      <Tab title="Python">
        ```python theme={null}
        client = OpenAI(
        	api_key="<your-api-key-here>", # Replace with your OpenAI API key
        	base_url="https://oai.helicone.ai/v1" # Set the API endpoint
        	default_headers= {
        		"Helicone-Auth": f"Bearer {HELICONE_API_KEY}",
        		"Helicone-Posthog-Key": "<ph_project_api_key>",
        		"Helicone-Posthog-Host": "<ph_client_api_host>", # (Optional)
        	}
        )
        ```
      </Tab>

      <Tab title="Node.js">
        ```typescript theme={null}
        import { Configuration, OpenAIApi } from "openai";

        const configuration = new Configuration({
        apiKey: process.env.OPENAI_API_KEY,
        basePath: "https://oai.helicone.ai/v1",
        baseOptions: {
        	headers: {
        		"Helicone-Auth": `Bearer ${process.env.HELICONE_API_KEY}`,
        		"Helicone-Posthog-Key": "<ph_project_api_key>",
        		"Helicone-Posthog-Host": "<ph_client_api_host>",
        	},
        },
        });

        const openai = new OpenAIApi(configuration);
        ```
      </Tab>

      <Tab title="Terminal">
        ```bash theme={null}
        curl --request POST \
        	--url https://oai.helicone.ai/v1/chat/completions \
        	--header "Authorization: Bearer $OPENAI_API_KEY" \
        	--header "Content-Type: application/json" \
        	--header "Helicone-Posthog-Key: Bearer $POSTHOG_PROJECT_API_KEY" \
        	--header "Helicone-Posthog-Host: Bearer $POSTHOG_CLIENT_API_HOST" \
        	--header "Helicone-Auth: Bearer $HELICONE_API_KEY" \
        	--data '{
        		"model": "gpt-4o-mini",
        		"messages": [
        			{
        				"role": "system",
        				"content": "Say Hello!"
        			}
        		],
        		"temperature": 1,
        		"max_tokens": 30
        	}'
        ```
      </Tab>
    </Tabs>

    Helicone events will now be exported into PostHog as soon as they're available.
  </Step>

  <Step title="Create a dashboard in PostHog">
    Create your own dashboard, or use our template to start.

    1. Go to the [dashboard tab](https://us.posthog.com/dashboard) in PostHog.
    2. Click the `New dashboard` button in the top right.
    3. Select `LLM metrics – Helicone` from the list of templates, or `Blank dashboard` to start from scratch.
  </Step>
</Steps>
