Export to PostHog
Send LLM usage events from Future AGI's Prism Gateway to PostHog for product analytics.
Connect your PostHog project and Future AGI will push LLM usage events from the Prism Gateway on every sync cycle. Each gateway request becomes a PostHog event you can use in funnels, trends, and dashboards.
What this does
This integration sends your Prism Gateway traffic to PostHog as product analytics events. Every API call that passes through the gateway becomes a prism_request event with properties like model, provider, latency, token counts, and cost.
This is useful when your product team wants to understand LLM usage patterns alongside other product events in PostHog - which features trigger the most LLM calls, or how costs break down by user segment.
What gets exported
Each Prism Gateway request becomes a PostHog event:
| Property | Example | Description |
|---|---|---|
event | prism_request | Event name |
distinct_id | prism-gateway | Identifies the source |
properties.model | gpt-4o | Model used |
properties.provider | openai | Provider |
properties.latency_ms | 842 | End-to-end latency |
properties.input_tokens | 1200 | Prompt tokens |
properties.output_tokens | 323 | Completion tokens |
properties.total_tokens | 1523 | Total tokens |
properties.cost | 0.02 | Cost in USD |
properties.status_code | 200 | HTTP status |
properties.is_error | false | Whether the request failed |
properties.cache_hit | true | Whether the response was cached |
Events are sent via PostHog’s Batch API, so they appear in your PostHog project like any other tracked event.
Before you start
You’ll need:
- A PostHog account (cloud or self-hosted)
- Your Project API Key (
phc_...), found in PostHog > Project Settings > Project API Key - Admin or Owner role in your Future AGI workspace
- The Prism Gateway set up and receiving traffic
Note
PostHog Cloud runs in two regions: US and EU. Make sure you select the right one during setup, or events will be sent to the wrong endpoint.
Connect PostHog
Open Integrations
Go to Settings > Integrations in your Future AGI workspace. Click Add Integration or click the PostHog card.

Enter your PostHog credentials
On the Credentials step, fill in:
| Field | Required | Description |
|---|---|---|
| PostHog Region | Yes | US Cloud or EU Cloud. Not shown if self-hosted. |
| Project API Key | Yes | Your PostHog project API key (phc_...). |
If you’re running a self-hosted PostHog instance, click “Using self-hosted PostHog?” to switch to a custom host URL field.

Click Validate & Continue.
Configure sync settings
Set how often Future AGI batches and sends events to PostHog, and whether to backfill historical gateway data.

Click Connect Integration.
Done
Events start flowing to PostHog on the next sync cycle.

Verify in PostHog
Once the first sync completes:
- Go to PostHog > Events and filter for event name
prism_request - Or go to PostHog > Insights and create a trend for
prism_requestevents to see request volume over time
If nothing shows up after 10 minutes, check the sync status in Settings > Integrations.
Sync status
Monitor your integration from the detail page (Settings > Integrations > click your PostHog connection).
| Status | Meaning | Action |
|---|---|---|
| Active | Exporting on schedule | None needed |
| Syncing | A batch is being sent right now | Wait for it to finish |
| Paused | You paused the export manually | Click Resume when ready |
| Error | API key invalid or PostHog rejected the request | Check your API key and region |
Troubleshooting
No events appearing in PostHog
Check that you selected the correct region (US vs EU). If your PostHog project is on EU Cloud but you selected US Cloud, events are being sent to the wrong endpoint. Edit the integration and switch the region.
Events appear but properties are missing
Make sure your Prism Gateway requests include model and provider information. If you’re using custom routing, some properties may be empty for requests that didn’t complete successfully.
Connection shows Error status
Your PostHog API key may have been revoked or rotated. Get a new key from PostHog > Project Settings > Project API Key, then edit the integration to update it.