calling-the-ai-gateway

calling-the-ai-gateway is a skill for Claude Code, Codex from PostHog/posthog-foss. It costs 161 tokens per session (1,084 once invoked), scanned A, original, MIT.

A set of instructions for adding or changing callers to a Go AI gateway in a monorepo. A monorepo is one repository containing multiple related projects; the gateway handles access, billing, routing, providers, and models for AI calls.

In plain words
What is it for?
Use it when Django code, background workers, or sandbox agents need to call language models through the gateway, or when changing those callers.
Why use it?
It helps keep gateway credentials, model settings, attribution, timeouts, retries, and error handling consistent instead of implementing them differently in each caller.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: installed under .agents/ (shared by several agents).

Good fit Use it when Django code, background workers, or sandbox agents need to call language models through the gateway, or when changing those callers.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/posthog/posthog-foss/calling-the-ai-gateway
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add PostHog/posthog-foss --skill calling-the-ai-gateway
Clone the repo
git clone --depth 1 https://github.com/PostHog/posthog-foss

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for calling-the-ai-gateway

README.md
[![agentmods](https://agentmods.dev/badge/skills/posthog/posthog-foss/calling-the-ai-gateway/github.svg)](https://agentmods.dev/skills/posthog/posthog-foss/calling-the-ai-gateway)
Your own site
<a href="https://agentmods.dev/skills/posthog/posthog-foss/calling-the-ai-gateway"><img src="https://agentmods.dev/badge/skills/posthog/posthog-foss/calling-the-ai-gateway/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for calling-the-ai-gateway

Your own site · 80×15
<a href="https://agentmods.dev/skills/posthog/posthog-foss/calling-the-ai-gateway"><img src="https://agentmods.dev/badge/skills/posthog/posthog-foss/calling-the-ai-gateway.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 161 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,084 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00161 $0.01084
Opus 5.5 $0.00064 $0.00434
Sonnet 5.5 $0.00032 $0.00217
Haiku 4.5 $0.00016 $0.00108

Measured 6d ago against content hash a408aa4f95cf, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

calling-the-ai-gateway scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.agents/skills/calling-the-ai-gateway/SKILL.md · 62 lines

How it starts

The opening of the file, as written. The whole thing — 62 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Calling the AI gateway

Gateway behavior (auth, billing, routing, providers, models) lives in PostHog/ai-gateway. A change to what the gateway does lands there. This monorepo only calls it.

Inventory the caller

Find the call site, client construction, settings, deployment wiring, and tests. Record:

  • the use case and the ai_product it reports as
  • the credential source and the team whose wallet pays
  • API shape (OpenAI or Anthropic), model, streaming, and tool or structured-output needs
  • distinct ID, trace ID, session ID, and custom property attribution
  • timeout, retry, and error handling

Build the client

  1. For Django and worker code, use a builder from posthog/llm/gateway_client.py. build_openai_client, build_async_openai_client, build_anthropic_client and build_async_anthropic_client authenticate with the AI_GATEWAY_API_KEY project secret. build_ai_gateway_openai_client sends the caller's own pha_ or phe_ bearer; build_anthropic_client also takes privacy_mode. Each raises GatewayNotConfiguredError when the gateway is not configured; handle it where the caller can degrade.
  2. Use the slugless base URL from AI_GATEWAY_URL (it ends in /v1). The Anthropic builders strip /v1 because the SDK appends /v1/messages.
  3. Authenticate with a phs_ or pha_ credential that carries llm_gateway:read. Do not expose a shared secret to an untrusted runtime.
  4. Send event labels in one X-PostHog-Properties JSON object, through the builder's properties argument or ai_gateway_headers. Use the dedicated distinct ID and trace ID arguments where the caller has them.
  5. Treat ai_product as telemetry. It does not grant product auth or billing policy.
  6. Check the model and API shape against the gateway's /v1/models catalog.

If the process has no gateway credential, enable the ai-gateway feature flag for the paying team, create a phs_ project secret with llm_gateway:read, and wire it through the existing deployment secret mechanism. Check with the AI gateway team before adding deployment variables or secrets, so existing shared configuration can be reused.

Read the full file on GitHub · 62 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 62 lines · 161 tokens per session scan A a408aa4f95cf

Subscribe to this mod's changes

calling-the-ai-gateway is a skill published in the GitHub repository PostHog/posthog-foss (736 stars, last pushed today), licensed MIT. It adds 161 tokens to every session and 1,084 once invoked, about $0.0006 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-11-28.

Related

calling-the-ai-gateway compared with skills from other repositories

calling-the-ai-gateway next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
calling-the-ai-gatewayPostHog/posthog-fossSkill736todayMITA161Claude Code, Codex
open-sourcebrowser-use/browser-useSkill123ktodayMITA101Claude Code
gemini-api-agent-platformdavila7/claude-code-templatesSkill35ktodayMITA61Claude Code, Codex
prowler-mcpprowler-cloud/prowlerSkill15ktodayApache-2.0A67Claude Code
gemini-api-devgoogle-gemini/gemini-skillsSkill5.1kyesterdayApache-2.0A96Claude Code
deepstream-sopNVIDIA/skillsSkill4.3ktodayApache-2.0A219Claude Code
tao-run-inference-serviceNVIDIA/skillsSkill4.3ktodayApache-2.0A92Claude Code