Bug Description
The PostHogOpenAI class in PostHog's LLM analytics typescript SDK is a wrapper around OpenAI's OpenAI TS client class and as such I expect it to behave in the same way. The problem is it doesn't. When I use it to call the /chat/completions API endpoint via the .chat.completions.create, I don't get an APIPromise object unlike what I get from OpenAI's client. This prevents me from calling .withResponse() on it to access rate limiting information that OpenAI stashes in its HTTP response headers.
Additional context
I'm using the latest posthog-node and posthog-ai packages
Debug info
- [ ] PostHog Cloud, Debug information: [please copy/paste from https://us.posthog.com/settings/project-details#variables or https://eu.posthog.com/settings/project-details#variables]
- [ ] PostHog Hobby self-hosted with `docker compose`, version/commit: [please provide]
- [ ] PostHog self-hosted with Kubernetes (deprecated, see [`Sunsetting Kubernetes support`](https://posthog.com/blog/sunsetting-helm-support-posthog)), version/commit: [please provide]
Bug Description
The
PostHogOpenAIclass in PostHog's LLM analytics typescript SDK is a wrapper around OpenAI'sOpenAITS client class and as such I expect it to behave in the same way. The problem is it doesn't. When I use it to call the/chat/completionsAPI endpoint via the.chat.completions.create, I don't get anAPIPromiseobject unlike what I get from OpenAI's client. This prevents me from calling.withResponse()on it to access rate limiting information that OpenAI stashes in its HTTP response headers.Additional context
I'm using the latest posthog-node and posthog-ai packages
Debug info