auditing-llm-gateway-parity
Audite services/llm-gateway par rapport à PostHog/ai-gateway et met à jour services/llm-gateway/PARITY.md à partir des preuves de l'implémentation actuelle. À utiliser lorsque l'une ou l'autre des passerelles…
npx skills add https://github.com/posthog/posthog --skill auditing-llm-gateway-parityAuditing LLM gateway parity
Compare the current implementations of both gateways and update services/llm-gateway/PARITY.md. Keep this audit separate from caller migration.
Record source revisions
- Fetch
origin/masterand record its SHA as the PostHog baseline. - Audit the current working tree, including committed and uncommitted changes relative to that baseline. Do not ignore an in-flight gateway change because it is not on
masteryet. - Read the current
PostHog/ai-gatewaymain SHA withgh api repos/PostHog/ai-gateway/commits/mainand record it as the Go baseline. - If the audit is for an in-flight Go change, inspect that PR branch or working tree relative to
main. Treat its contracts as pending until the change merges; do not record them as currently supported. - Otherwise, inspect an authenticated checkout of
PostHog/ai-gatewayatmain.
Audit implementation code. README files and the existing parity table are starting points, not proof.
Inspect each contract
For the Python gateway, inspect:
services/llm-gateway/src/llm_gateway/api/for routes and wire behaviorservices/llm-gateway/src/llm_gateway/auth/for accepted credentialsservices/llm-gateway/src/llm_gateway/db/required_tables.pyfor the tables the gateway may read; a change adding a table read needs its posthog-cloud-infra SELECT grant landed in every environment firstservices/llm-gateway/src/llm_gateway/products/config.pyfor trusted product policy, models, and billingservices/llm-gateway/src/llm_gateway/rate_limiting/for budgets and limitsservices/llm-gateway/src/llm_gateway/callbacks/for event attributionposthog/llm/gateway_client.pyand real call sites for required contracts
For the Go gateway, inspect:
internal/httpapi/routes.goand dispatch packages for API shapesinternal/auth/andinternal/principal/for credential and identity policyinternal/httpapi/admission.go,internal/ledger/, andinternal/quota/for billing and limitsinternal/catalog/,internal/router/, andinternal/dispatch/for models, providers, translation, and failoverinternal/emitter/and request parsing for attribution and metadatadocs/product.mdfor intended and deferred contracts, verified against code
Check both request and response behavior. Matching route names do not prove parity for headers, streaming, errors, timeouts, retries, billing, or emitted events.
Classify the evidence
- ✅ Supported: the Go gateway satisfies the contract.
- ⛔ Blocking: an active use case would lose auth, trusted attribution, billing policy, API, provider, or wire behavior.
- 🔎 Verify: support exists, but a caller must confirm configuration or behavior.
Do not treat caller-supplied telemetry as trusted policy. An ai_product event property does not replace product authentication, authorization, or billing.
Do not treat Python's unbilled flag as an automatic blocker. An internal workload can move to Go with a PostHog-owned team credential when debiting that wallet is the intended way to attribute PostHog spend. It is blocked only when it must preserve customer-specific billing policy or must debit no wallet.
For each difference, identify at least one affected use-case class. Remove details that do not change a migration decision.
Update the parity record
Update services/llm-gateway/PARITY.md with the evidence:
- Move use cases between supported, blocked, and verify sections.
- Add or remove migration-relevant contracts in the parity map.
- Update the source SHAs and verification date.
- Keep detailed Go design in
PostHog/ai-gateway.
When a gap closes, name obvious caller classes that are newly eligible to migrate. Do not modify those callers unless the user also asks for migration work. Use /migrating-llm-gateway-callers for that separate job.
Validate
Run:
pnpm exec oxfmt services/llm-gateway/PARITY.md .agents/skills/auditing-llm-gateway-parity/SKILL.md
pnpm exec markdownlint-cli2 --config .config/.markdownlint-cli2.jsonc services/llm-gateway/PARITY.md .agents/skills/auditing-llm-gateway-parity/SKILL.md
git diff --check