Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(desktop): allow open source models on free tier (#81478)

Adam Bowker8918c63d9fae
diff --git a/services/llm-gateway/PARITY.md b/services/llm-gateway/PARITY.md
index 5749e4b264f1..8a3fa9b93258 100644
--- a/services/llm-gateway/PARITY.md
+++ b/services/llm-gateway/PARITY.md
@@ -35,14 +35,14 @@ Existing Django callers should use `build_openai_client`, `build_async_openai_cl
### ⛔ Stay on the Python gateway for now
-| Use case | Blocking contract |
-| ------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| PostHog Desktop, PostHog Code, cloud agents, onboarding, Wizard, and similar first-party products | Trusted product identity, OAuth application allowlists, OAuth user attribution, server-minted credential requirements, per-product model policy, and product billing or unbilled policy are not available together in Go. Desktop also requires a request-selected project validated against OAuth scope, live organization membership, and project-level access control. An `ai_product` event property is not an authorization or billing boundary. |
-| Product or user budget enforcement | Python supports product and user cost limits, plan checks, quota buckets, and requests that debit no wallet. Go currently admits against the credential owner's team wallet and does not branch settlement on credential billing mode. |
-| OpenRouter, Fireworks, Cloudflare Workers AI, or Baseten | These provider paths are not available in Go. |
-| OpenAI audio transcription | Go has no transcription endpoint. |
-| OpenAI models through Anthropic Messages | Go does not provide this reverse translation. |
-| Python product usage status | The Python product usage and quota API is different from Go request usage and wallet APIs. |
+| Use case | Blocking contract |
+| ------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| PostHog Desktop, PostHog Code, cloud agents, onboarding, Wizard, and similar first-party products | Trusted product identity, OAuth application allowlists, OAuth user attribution, server-minted credential requirements, per-product model policy, free-tier model allowlists, and product billing or unbilled policy are not available together in Go. Desktop also requires a request-selected project validated against OAuth scope, live organization membership, and project-level access control. An `ai_product` event property is not an authorization or billing boundary. |
+| Product or user budget enforcement | Python supports product and user cost limits, plan checks, quota buckets, and requests that debit no wallet. Go currently admits against the credential owner's team wallet and does not branch settlement on credential billing mode. |
+| OpenRouter, Fireworks, Cloudflare Workers AI, or Baseten | These provider paths are not available in Go. |
+| OpenAI audio transcription | Go has no transcription endpoint. |
+| OpenAI models through Anthropic Messages | Go does not provide this reverse translation. |
+| Python product usage status | The Python product usage and quota API is different from Go request usage and wallet APIs. |
### 🔎 Verify before switching
@@ -64,7 +64,7 @@ These are compatibility checks, not automatic blockers:
| Authentication | `phs_` project secrets and `pha_` OAuth credentials with the literal `llm_gateway:read` scope; credential resolves a fixed team and revocation state. | `phx_` personal keys, wildcard OAuth scope handling, product-specific API key or OAuth application rules, and Desktop's request-selected project validated against OAuth scope and live organization membership. |
| Trusted first-party identity | No trusted product identity or product-scoped authorization boundary. | Product route selects allowlisted OAuth apps, server credential requirements, and model policy. |
| Attribution | Distinct ID comes from `X-PostHog-Distinct-Id` or falls back to team ID. Supports trace ID, custom JSON properties, team project token, provider, usage, and cost. | OAuth user identity, body-derived OpenAI or Anthropic end-user identity, gateway-owned `$ai_product` and `$ai_billable`, per-key properties, and feature flag headers. |
-| Billing and limits | Wallet reservation and settlement, idempotency, balance read, request usage read, and front-line rate limiting. | Product and user cost windows, plans, quota buckets, free tiers, unbilled products, and product usage status. |
+| Billing and limits | Wallet reservation and settlement, idempotency, balance read, request usage read, and front-line rate limiting. | Product and user cost windows, plans, quota buckets, product-specific free-tier model allowlists, unbilled products, and product usage status. |
| OpenAI APIs | Chat Completions, Responses, bare Responses alias, and normalized router chat. | Audio transcription and broader LiteLLM translation. |
| Anthropic APIs | Messages and token counting, including Bedrock-hosted models. | OpenAI models exposed through the Anthropic shape and Python-specific Bedrock opt-in behavior. |
| Providers | OpenAI, Anthropic, Azure OpenAI, Bedrock, and selected Modal models. | OpenRouter, Fireworks, Cloudflare Workers AI, and Baseten. |
@@ -87,10 +87,10 @@ Run `/migrating-llm-gateway-callers` to inventory and convert a caller.
Run `/auditing-llm-gateway-parity` after either gateway changes auth, attribution, billing, endpoints, providers, models, routing, or event metadata. The skill audits implementation sources in both repositories and updates this file without migrating callers.
-Last verified on 2026-08-10 against:
+Last verified on 2026-08-11 against:
-- `PostHog/posthog` master at `5b663afc7882e4e13de4cbe8aad921d09b1e8c04`
-- `PostHog/ai-gateway` main at `de0094020b615f5afc207a71e1c54d3e1df95374`
+- `PostHog/posthog` master at `be4bd7c005a5c13980c7f89e3131cfca3d4ae501`
+- `PostHog/ai-gateway` main at `107c9d62cf33d0a5a08b2ace40257f036914102a`
## References
diff --git a/services/llm-gateway/src/llm_gateway/config.py b/services/llm-gateway/src/llm_gateway/config.py
index e6b174bc9bcc..aa2fe21a72cd 100644
--- a/services/llm-gateway/src/llm_gateway/config.py
+++ b/services/llm-gateway/src/llm_gateway/config.py
@@ -203,7 +203,11 @@ class Settings(BaseSettings):
# TODO: flip on when Code migrates all users to usage-based billing
posthog_code_model_gate_enabled: bool = False
- posthog_code_free_tier_models: list[str] = ["@cf/zai-org/glm-5.2"]
+ posthog_code_free_tier_models: list[str] = [
+ "@cf/zai-org/glm-5.2",
+ "deepseek-ai/deepseek-v4-flash-0731",
+ "moonshotai/kimi-k3",
+ ]
default_fallback_cost_usd: float = 0.01
diff --git a/services/llm-gateway/tests/test_models_api.py b/services/llm-gateway/tests/test_models_api.py
index 05ec0a47b133..0d29408ca3f3 100644
--- a/services/llm-gateway/tests/test_models_api.py
+++ b/services/llm-gateway/tests/test_models_api.py
@@ -418,7 +418,10 @@ class TestFreeTierModelListing:
assert premium["restriction_reason"] == "paid_plan_required"
# exact, not subset: the default free model must survive the allowlist
# and the annotation, or free-tier callers have no usable model
- assert {m["id"] for m in body["data"] if m["allowed"]} == {"@cf/zai-org/glm-5.2"}
+ assert {m["id"] for m in body["data"] if m["allowed"]} == {
+ "@cf/zai-org/glm-5.2",
+ "deepseek-ai/deepseek-v4-flash-0731",
+ }
# codex reads the `models` mirror; the marks must be there too
assert body["models"] == body["data"]
diff --git a/services/llm-gateway/tests/test_product_config.py b/services/llm-gateway/tests/test_product_config.py
index 1e5e7fb1a4c9..fcf68eb7cc81 100644
--- a/services/llm-gateway/tests/test_product_config.py
+++ b/services/llm-gateway/tests/test_product_config.py
@@ -546,6 +546,8 @@ class TestCheckFreeTierModelAccess:
# Unbilled org on the Code surface: premium blocked, open model allowed
("posthog_code", "claude-fable-5", False, False, False),
("posthog_code", "@cf/zai-org/glm-5.2", False, False, True),
+ ("posthog_code", "deepseek-ai/deepseek-v4-flash-0731", False, False, True),
+ ("posthog_code", "moonshotai/kimi-k3", False, False, True),
# The alias routes are the same surface - a URL spelling must not bypass
("array", "claude-fable-5", False, False, False),
("twig", "gpt-5.5", False, False, False),