New to Claude Skills? Learn how to install them β†’

posthog on GitHub

Auditing LLM Gateway Parity

Free

Ensure consistent API behavior between gateways.

Get this skill

Free Β· Opens the source repo

What Auditing LLM Gateway Parity does

The Auditing LLM Gateway Parity skill is designed to facilitate the comparison and auditing of the implementations between the Python-based llm-gateway and the Go-based ai-gateway within the PostHog ecosystem. This skill helps developers and engineers maintain a clear understanding of the current state of both gateways by updating the PARITY.md file based on the latest implementation evidence. It is particularly useful when changes occur in various aspects such as authentication, billing, or routing, ensuring that the gateways remain aligned in functionality and behavior.

When using this skill, it first fetches the latest commits from the PostHog repository to establish a baseline for comparison. It then inspects the relevant directories and files in both gateways to gather detailed information about routes, authentication methods, billing policies, and other critical components. The skill classifies the evidence into categories such as supported, blocking, or needing verification, allowing users to quickly identify any discrepancies that may affect the migration of callers between the two gateways.

This skill is particularly valuable for teams who are actively developing or maintaining integrations with the PostHog services, as it provides a systematic approach to auditing and documenting the parity between the two gateways. By keeping the PARITY.md file up to date, teams can ensure that they are aware of any changes that could impact their applications or services, thereby reducing the risk of unexpected behavior in production environments.

Overall, the Auditing LLM Gateway Parity skill is essential for developers and engineers working with PostHog's LLM gateways, enabling them to maintain consistency and reliability in their API integrations.

When to use it

Use this skill when changes are made to either gateway that could affect authentication, billing, or routing, or when reviewing changes in the Python gateway.

When not to use it

This skill is not suitable for migrating callers or for auditing unrelated services outside the LLM gateways.

What you can build with it

Auditing after Gateway Changes

After a change is made to the authentication method in the AI gateway, use this skill to audit and update the parity documentation.

Maintaining API Consistency

Regularly run this skill to ensure that any updates in the llm-gateway are reflected in the ai-gateway documentation.

Preparing for Migration

Before migrating callers from the Python gateway to the Go gateway, use this skill to identify any potential issues.

How to install Auditing LLM Gateway Parity

View source

1. Install with the skills CLI

npx skills add posthog/posthog/auditing-llm-gateway-parity --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by posthog

Auditing 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/master and 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 master yet.
  • Read the current PostHog/ai-gateway main SHA with gh api repos/PostHog/ai-gateway/commits/main and 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-gateway at main.

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 behavior
  • services/llm-gateway/src/llm_gateway/auth/ for accepted credentials
  • services/llm-gateway/src/llm_gateway/products/config.py for trusted product policy, models, and billing
  • services/llm-gateway/src/llm_gateway/rate_limiting/ for budgets and limits
  • services/llm-gateway/src/llm_gateway/callbacks/ for event attribution
  • posthog/llm/gateway_client.py and real call sites for required contracts

For the Go gateway, inspect:

  • internal/httpapi/routes.go and dispatch packages for API shapes
  • internal/auth/ and internal/principal/ for credential and identity policy
  • internal/httpapi/admission.go, internal/ledger/, and internal/quota/ for billing and limits
  • internal/catalog/, internal/router/, and internal/dispatch/ for models, providers, translation, and failover
  • internal/emitter/ and request parsing for attribution and metadata
  • docs/product.md for 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

Frequently asked questions about Auditing LLM Gateway Parity

Similar skills